RFID Door Opener, Part 1

Inspired by the numerous door openers out there, I decided I’d give it a shot (ok, really, I was just looking for something to do with my spiffy Parallax RFID reader). At first I was hoping I could use the RFID tag that opens the entrances to my apartment building; however, those turned out to be on the 13.56MHz frequency for which there is very little hobby-level gear out there – certainly nothing in the price range that would be acceptable for a basic door opener. So I settled on using 125KHz and having to carry two tags on my keychain (or possibly a credit-card tag in my wallet).

Thinking this out from the beginning, there are several parts that make up this system:

1) Controller. I’ll be using the Arduino platform – quit moaning, I can hear you. Honestly, for something so simple (take serial characters from reader, activate servo), it’s not worth prototyping a little AVR board and programming through an FTDI cable. Plus the Arduino environment already has a Servo library and there is code written for the Parallax RFID module – if you’ve read the title of this blog, you might know why this appeals to me.

2) RFID reader. The Parallax module does all the work of generating a 125KHz signal and measuring the response, and converting that to a string of characters which it sends down by a serial connection. It requires a 5V supply which can be borrowed from the Arduino and there is a pin to enable the reader – HIGH is off, LOW is on. The state of the reader is reflected in the color of the LED; oddly, red is on/ready while green is disabled.

3) Servo. A standard, continuous rotation hobby servo will be used. Since the handle is rather hard to pull, I’ll want to use the maximum voltage the servo is rated for (6V) in order to get the most torque out of it. Another thing to keep in mind is that these servos can use a lot of current, especially when fighting against a load. A 1A power supply is probably recommended, although I wasn’t able to find anything other than rough estimates for the maximum current under load.

4) Door/Servo interface. For turning the handle of my door I’ve decided to mount a small spool on the continuous servo – it will spool up wire connected to the handle, pulling the handle down. The opening of the door is the aspect I’m most worried about – I’m no mechanical engineer and this method could fail depending on the amount of torque needed and how good my spool scheme is. A linear actuator might be called for but would probably be overkill.

Continue Reading »

DIY Audio on a “Student’s” Budget

Today, a whole new topic in DIY electronics – audio. Audiophiles (or just anyone looking to get good sound quality) can spend hundreds or thousands of dollar on systems whose parts may only cost a tiny fraction of the retail cost. So the DIY community has stepped up to the plate, with many extremely knowledgeable engineers and hobbyists collaborating on original circuit designs that rival or better many commercial “audiophile” products.

Recently, I had the great fortune to get in on a group buy of sorts, for a modified version of the Starving Student Millet Hybrid amplifier. The SSMH started life as a simple but ingenious hybrid (tube and solid state) design by Pete Millett, in which he used the heating element of the tubes to put a load on the MOSFETs of the amplifier, cutting complexity and cost. Originally, it was a very basic amplifier with a budget-minded soul, built into whatever enclosure was handy with point to point (P2P) wiring. You can see the original build at his site here, and the forum thread following it’s history here.

DIY forum user Dsavitsk then improved on the design with some slight modifications to the circuit. He also developed an equally ingenious way to mount the amp in an enclosure – a PCB would be developed and attached to the sliding top of a standard Hammond enclosure, allowing the tubes to be mounted to the “underside” of the PCB and stick out through the case. This would eliminate the P2P wiring that caused many problems in DIY builds of the amp – problems with grounding and bad connections had plagued countless hobbyists.

Collaborating with Tom Blanchard of Beezar Audio, the two developed PCBs and set the project in motion. Tom took on the arduous task of organizing the procurement of the increasingly rare 19J6 vacuum tubes, the custom-machined Hammond cases, and all the other various parts needed to develop kits of the SMMH.

I was lucky enough to get in on this undertaking and purchase a kit, and after a couple months (during which the cases were machined), I recently took delivery of the kit and quickly put it together.

Continue Reading »

USB Power Shield v2.0

The new USB Power Shield boards (rev. 2.0) have just arrived from BatchPCB! As always, they were quick, great quality, and they even sent me a few extra! Awesome service.

Top View of the USB Power Shield v2.0

Top View of the USB Power Shield v2.0


Version 2.0 has some major revisions since v1.0, including:

  • Smaller Size – cost is determined by size, so I brought it down to the bare minimum – just enough to cover the Arduino pins.
  • Power Planes – Added a 5V plane on top and a GND plane on the bottom to increase the reliability of the design, allow higher current, and also act as a bit of a heatsink
  • Thicker Traces – the traces in v1.0 are only 8mil, which is pretty small and is really only good for about 200mA. Some devices powered here may need more than that. To support the USB spec of 500mA per device, I’ve bumped up all the traces to 16mil. There’s plenty of space for traces anyways.
  • Remove the Vin LED – unnecessary.
  • Flush caps – leave space so the caps can be bent down, so another shield can be fitted on top of this one. The regulator is also mounted on the edge to allow bending it down, although in many application it will need a heatsink so they may not clear even when bent down.

And here it is built:
USB Power Shield v2.0

Parts needed:
Keep in mind not all parts on the board are needed. For instance, if you’re powering a single pair of lights (or anything running at <300ma) you can just use the Arduino’s built in DC-in with voltage regulator (USB power alone is not going to cut it). If that’s the case, you can leave out the 7805 regulator, the 100uF capacitor (keep the 10uF), and the power diode D1. You also don’t have to have the power indicator LED or its resistor RLED. And if you’re only controlling one device, you only need one relay and one USB connector. All in all, you can get the parts cost for this board down to about $4 at the minimum configuration. If you want to go all out, here’s what you’ll need:

Continue Reading »

Using the Bus Pirate v2go on Mac

My Bus Pirate v2go just arrived this morning and I was eager to try it out. There is some documentation on Hack-a-Day on how to use the bus pirate with HyperTerminal. However, all of my electronics stuff is on the other side of the room from my Windows desktop. I use my MacBook for programming the Arduino and my other AVR projects, so I wanted to use it for the Bus Pirate as well. What to do?

My first google searches ended in disappointment – using the built in Terminal program with Screen was unsuccessful (probably because it doesn’t seem like you can set the baudrate). Update: it turns out that you can set the baudrate with screen using an argument like so – “screen /dev/ttyWHATEVER 115200″. Thanks goes to the David in the comments below. After a little searching, it looked like the few serial terminal applications for Mac were old and outdated, but I did manage to find ZTerm. It’s simple and basic – perfect for use with the bus pirate.

Don’t forget that you need to have already installed the FTDI driver so that your computer will see the device over USB. Start Zterm and choose the correct port in the popup window (if it isn’t already chosen automatically). Then you need to change the connection settings to talk to the Bus Pirate properly. Go to Settings->Connection and set it like this:
ZTerm settings for Bus Pirate
Data Rate: 115200
Data Bits: 8
Parity: None
Stop bits: 1

The rest you can leave at the default. [UPDATE] On newer firmware versions you’ll need to deselect Xon/Xoff as per Ian in the comments below.

Hit ok and go back to the terminal window to start talking Continue Reading »

Woot-off Time!

Just in time to test the USB Power Shield, it’s a Woot-off! I’ll post some pics of the lights in action tomorrow, but for now, head over to the Woot Tracker to keep up with all the items.

Sketching with the USB Power Shield

So you have a USB Power Shield (or anything that uses a latching relay). How do you control it in an Arduino Sketch?

Normal relays are pretty simple – supply voltage/current to the coil and it generates a magnetic field, which pushes the switch to the ON position. You only need one pin to run it, although you may need a transistor to supply more current because most microcontrollers can only supply 50mA, which often isn’t enough current to create a magnetic field to move the switch. You must maintain the current to keep the switch on.

Latching relays are similar to this, but once put into position, it “latches” there and requires no further current to stay in that position. This uses less power and makes the switching more reliable – if there is a decrease in current supplied, the switch will still stay in position, unlike the regular relay which could flicker. The downside is that the common types require two pins. Sending current in one direction switches on, and reversing the current switches it off.

So how do you control it? Set two pins to be outputs (the USB Power Shield uses 12/11 and 10/9 for the two relays). Write one pin LOW and the other pin HIGH. After a sufficient time to make the switching happen (50ms or less, check the datasheet for the relay), switch the HIGH pin back to low. This gives the magnetic field a place to sink, as well as making sure no more current is supplied to the coil, preventing overheating and wasting power.

Ideally, with a normal relay you’d like to force the stored current from the magnetic field back through the coil by using a flyback diode across it, but with a latched relay and current running in both directions, a diode would be needed in each direction. And that would simply cause a short circuit both ways. I’ve tested the relays used in the USB Power Shield and they don’t harm the Arduino (even over thousands of cycles) so this isn’t a huge worry here.

Below is some sample code for using the USB Power Shield with an Arduino. Continue Reading »

Success! USB Power Shield v1.0

A special envelope arrived yesterday from BatchPCB – the envelope containing the prototype board for the USB Power Shield v1.0. Or should I say prototype boards – they were kind enough to produce two, even though I only ordered one. Consider me a happy customer, especially because the boards work.

That’s right, the very first prototype board actually functions. I’m amazed too.

The first working prototype

The first working prototype

Of course, there are some changes I’d like to make – expect to see a v2.0 very soon. A few big things will be happening in the next revision, including addition of power planes and making the board smaller to reduce cost (by 30% ! ).

If anyone’s interested in ordering one of these from BatchPCB, email me and I’ll send you the link and parts list . I don’t want to make it completely public yet with the upcoming revision, which will be cheaper and more stable, but if you want to try it now let me know.

Also expect to see a basic Arduino library for controlling it soon, and we’re working on completing the WootOff application – the pressure’s on now that there is a working board!

Coming Soon

Things have been quite here lately – but think of it as the lull before the storm! Coming soon to a blog near you:

USB Power Shield Prototype
The PCB has finally been produced and is on the way. Expect to see a fully functional (*fingers crossed*) version in the next few days! If the board is good, I’ll make it available as a public design on BatchPCB so others can order it – it comes out to about $25-30 a board after shipping, which is a little high but would be lower if we got enough interest to do a full panel.

Remote Control Outlet
I’ve put together an outlet on an extension cord with a built-in relay, and the next step is to install an Xbee to make it wireless. Think of it as budget home automation, especially in combination with…

Tweet-A-Watt
This isn’t a brettinman.com original, but I’m working on putting together a Tweet-A-Watt and will be posting up some photos and thoughts on this excellent kit. Perfect for apartments, since we can’t get a current meter around our incoming electrical.

All this and more, coming soon!

First USB Power Shield Prototype on the Way!

After toying with the relays and Arduino I found that the diodes weren’t necessary – especially since the relay is latching, and current will be flowing both ways, so putting a diode in each direction would just create a short.

As such, I made some modifications to the board and put it into Gerber files using Eagle, uploaded them to BatchPCB, and am now waiting for the first one to arrive so that I can populate and test it. In the meantime, I need to get around to packaging the WootOff software for distribution, and come up with some documentation of this project that’s more readable than this series of blog posts.

Here’s the board schematic of the Prototype board:

USB Power Shield v1.0 - Prototype

USB Power Shield v1.0 - Prototype

Un-Mac the Mac

So I “caved”. I bought a Mac. I’ve used Windows for years, from our first computer running 95, to the screaming gaming desktop I built by hand and continue to upgrade to the latest and greatest. Windows has always treated me well. As long as you’re semi-competent, it’s easy enough to deal with its occasional quirks (User Account Control, anyone?).

So why did I move to the Mac? Bottom line, they have great hardware. Find me a PC with a 2.26GHz, 2GB DDR3, 9400M graphics, and a 7 Hour battery (no joke) for $1099, not to mention the amazing build quality with the unibody Aluminum casing and glass screen/trackpad, and the awesome support Apple offers.

Of course, every Mac comes with OSX. After a couple weeks of using it, I’m split. As we’ll see, I’ve been able to find most of the software I need on Mac. On the other hand, OSX has some quirks that severely bother me.

As far as program compatibility, it’s half and half. Matlab has a Mac version which works great and there is a version of Spice available (called MacSpice), but it lacks a graphical schematic creator (such as Orcad Capture). Also, the Mac version of Excel lacks Basic and therefore the ability to run linear regressions (or just about any other function) on data. And of course, OSX lacks the ability to play any serious game, even though the hardware on the new MacBook is more than capable for most.

On the downside, I’m starting to get severely frustrated with some quirks in OSX. To start with, why in the world can’t I resize a window from any side – OSX only resizes from the bottom right corner, while Windows will do it on any side. It may not seem like a big deal, but on the other hand, it’s so easy to implement. It should only take a few minutes, and yet it’s been overlooked (copy/paste on the iPhone, anyone?).

Along the same lines, why can’t I fullscreen most programs? Firefox in windows can go fullscreen with the push of a button, but on the Mac I’m wasting an inch or two of screen real estate on the OSX menu bar and the Firefox toolbar. Once again, not a huge deal, but it shouldn’t be hard to do – how can you implement huge pieces of architecture (Time Machine?) and yet leave out these simple details? Apple is all about the details in their hardware; I wish this same level of obsession with usability would reach through to permeate their GUI user experience.

So how did I Un-Mac the Mac?

I boot-camped Windows 7 onto it. Installed an aftermarket 128GB solid-state drive and spun up the Release Candidate for Microsoft’s latest OS. Let’s just say I’m cursing at Windows 7 a lot less than I am at OSX.

Bottom line – excellent hardware, but the OSX user experience could be improved.

And where the hell is my dang middle-click gesture? I need to open links in new tabs with one click!