Electronics

AVR Serial Communications Using XBee RF Modules

I was contacted by Element 14 (Newark.com) recently about doing some product test drives using some of the products from their line card. I took two to three seconds to think about it. I know, tough one... XBee S2 ZigBee RF modules by Digi International

I have been chomping at the bit to use ZigBee wireless technology in a project. Digi International makes some REALLY cool and easy-to-use ZigBee RF modules that bring ZigBee technology down to a level that even I can implement without more than a few terse passes at a wireless book and a couple of datasheets. So, the first piece of loot I requested from Element14 was an XBee S2 module. I would love to link you to this module at Newark.com, but it appears to be gone. That is sad. BAck to our story... There was a spending limit on my test-drive loot. I ordered one XBee S2 module on my tab. The other XBee module was sent to me courtesy of Element14.com.

The ultimate project is based on a need at our house: We hang out on the back patio quite a lot and when we invite guests over, even after we ask them to just come on in, they ring the doorbell and we can't hear it out on the back patio. The leave disappointed that we would not be home when we said we would be. I'm kidding. Usually they do walk right in.

DIY remote doorbell using XBee modules

The first drawring I made used a brass marine-type bell with a string that was routed from the front door around to the back patio. Guests could simply tug on the string to get our attention. My wife wasn't keen on the network of pulleys and string required to make that happen. The drawring above is the watered down, no-fun-havin' version. Awe, who are we kidding? It's still fun. It's ALL fun! What's not to love about electricity and radio frequency waves making things do stuff??

Plan B for the remote doorbell is much cooler and much more electronic: Rig XBee to the house doorbell system so that it can signal a solenoid type of thing to plink a brass bell on the back patio. Not as Wallace & Gromit as the pulleys and string, but still pretty darn cool.

Oh, let me get this out early: Yes, übernerd, I know that XBee is overkill for a simple remote doorbell. The final version of this thing will use a simple little OOK (on-off key) RF module pair that simply sends on or off (button pushed or not). For now, though, this is a great way to get to know Señor XBee and his amigos.

Building Wireless Sensor Networks by Robert Faludi

Before I go any deeper into this project, I want to HIGHLY recommend a book on the subject of AVR/Arduino microcontrollers and ZigBee networks. If you're interested in this stuff, go out and get a copy of Building Wireless Sensor Networks by Robert Faludi, published by O'Reilly. I also highly recommend you do NOT do what I did: Do not buy the book, read it cover-to-cover, and do absolutely nothing hands-on. I wound up having to re-read large portions of the book again to get my bearings with the XBee modules from Digi. Try to have an AVR microcontroller (or Arduino) and a couple of XBee modules on hand when you start reading the book.

Now, the first thing I have to say about these modules is that they are stupidly simple to setup and get running, as you'll see in this post. I was asked to do a write-up by Element14.com and this is an easy one: These are AWESOME. There are plenty of sources on the Web for connecting XBee modules. I won't go into major detail, but I will show you how quickly you can get to AVR microcontrollers talking wirelessly with two Digi International XBee S2 ZigBee RF modules. Keep reading...

The process for getting two XBee modules talking, or, in this case, two AVR microcontrollers talking via XBee modules, it this:

  1. Get two XBee modules (Farnell.com part 1690810) and a handful of 10-pin, 2mm headers used to adapt the non-breadboard-friendly XBee pins to your breadboard
  2. Get one or two AVR microcontollers with UART capability (and supporting components) or one or two Arduinos
  3. Build cheesy adapters for the XBee modules so that they fit your breadboards
  4. Download the X-CTU Windows program to upload newer firmware and appropriate firmware to the XBee modules (this relates to setting up one XBee module as the "coordinator" and one as the "router" [see book above])
  5. Put some serial-savvy code on an AVR chip or Arduino and connect its UART pins to one XBee module's DIN and DOUT pins
  6. Connect the other XBee module's DIN and DOUT pins to a serial cable to your computer
  7. Send commands through the air to the AVR from your favorite terminal program

OK, that's oversimplified, but if you're comfortable with building circuits and working with Arduino or AVRs, that's all there is to it. Take a look at this setup in action (and please forgive the hastily shot and edited video):

If you're a Mac person, and I know I am, you're going to disappointed in the lack of a Mac firmware updater for XBee modules. However, it is pretty darn simple to fire up Boot Camp or VMware and update the radios the way the aforementioned book suggests. I just picked up my breadboard with the two radios and the AVR and the USB-RS232 cable and plopped it on my desk next to my iMac and fired up VMware and did it. Nice and easy, save for one issue: Once the upload of the firmware was complete, Windows XP Pro went to a BSoD (Blue Screen of Death). Pretty awesome. Let me say that it is no secret that I hate Windows. I'm disappointed in Digi for note having a Mac client to update firmware on the XBee modules. Maybe someday...

If you follow the book, you can get two AVRs or a computer and an AVR communicating in pretty short order. The code I wrote for the AVR to receive the serial commands from the computer to switch the traffic LEDs was easy and it actually worked the first time. It's really cool when stuff works as advertised.

If you've got some communicating you need to do between your microcontrollers, especially multipoint stuff, XBee modules are the way to go. Soooooo easy to setup and use. Head over to Newark.com or your favorite source for Digi International products and start mesh networking your DIY gadgets.

This post was originally about the remote doorbell idea. I'll write a separate post about that completed project using simpler RF modules from SparkFun, as ZigBee is WAY overkill for a remote doorbell, unless you're putting little remote bells or buzzers all over your mansion.

Desktop Warp Core - The SMD LED Strip Years

I threw together a video of the warp core's control circuit and eight stupidly bright white SMD LED strips for the rings. The original rings were going to be through-hole bright LEDs, but I realized how much soldering and drilling would be required for that. That is dumb and painful. So, factory-built strips of LEDs, complete with self-adhesive backing, resistors, and snap-on wire ends ready for 12-volt DC power it is! Here it is in action:

There will be more to come as we start to construct the body of the warp core.

Domo Wobbly Balancing Robot Thing

Completed Domo Wobbly Bot and Remote The Short Attention Span version: I ripped apart a cheap remote controlled car and repurposed most of the parts into a self-balancing robot based on the Domo character because I thought one of the partners of the company I work for would enjoy it, as he seems to enjoy Domo stuff. I got the idea from a coworker who suggested I build this for the Domo partner.

The idea is not original to me. I was sent a link to Instructables.com that showed one in action. I didn't follow the directions, so the engineering is my own brew. But, I will say, that's an ingenius way to make an upright, two-wheeled roboto-doo-dad.

Here is the YouTube video of the robot in action:

So, the first thing I did was destory this car (or it was a close cousin):

Viper RC car

I took out the main circuit board from the car and the circuit board from the remote.

RC car circuit board

I figured out which wires ran which motor. One set ran the drive motor to make the car go zoom. The other set ran a motor that simply turned the steering all the way to the left or all the way to the right. No in-between steering on this one. The front wheels self-centered thanks to a little spring. BUT, we had two motors controllable by two rocker buttons on a remote and that's all we needed.

RC car remote control circuit board

I ordered some little rocker switches, a battery, and a plastic project box into which I could mount the remote stuff. I wound up trimming the circuit board down and resoldering the leads to the buttons so that it would fit snuggly in the project box.

4 D-cell battery holder and geared motors

I made the base and wheels (shown later on) out of some poplar I had lying around. I guesstimated all the sizes and dimensions, basing them around the way things kinda fit together on the board I used for the base. I ordered some geared down DC motors from AllElectronics.com. The wheels needed to not spin too quickly or Domo would constantly slam his head down on the ground. Gearing down the 6V supplied by the circuit was simple and cheap.

Rubber glove for grippy goodness

I cut strips of rubber gloves and lined the copper motor brackets with them. This did a nice job of preventing the motors from twisting themselves when starting up. At the point I built the base of the bot, I hadn't purchased the bike inner tube that I used to cover the wheels to make them more grippy-tactic, otherwise I would have used that material.

Perfect circle wheel bandsaw jig

Next, I needed to make wheels that were as circular as I could get them so that Domo didn't roll with a limp. I searched the web for easy jigs to cut circles with bandsaws. The crazy-simplest one I found was just a brad nail in the dead center of the circle to cut and a board below on which the piece being cut could rotate. Place an edge of the circle up against the blade and SLOWLY start rotating the piece. I say SLOWLY because pushing too quickly makes the blade run off-course. I have new round scraps of wood to prove it.

Bandsaw blade against circle to cut

Notice the lower piece right behind the blade. The closer that bottom piece is to the blade, the better it supports the piece being cut. The cut needs to start at the edge of the circle because we're only going to rotate the piece being cut. If you don't scribe your circle as perfectly as you can and you don't put that rotation point as dead-center as possible, it won't be a beautiful circle when it's completed.

Close-up of wheel and motor mounts

At first, I only used a single motor bracket. That gave the robot a sloppy angle on the wheels, so I added a second bracket to help sturdy up the axles. The wheels were 1/4-inch at first. I switched those out with 1/2-inch to add a little more stability to the wheels. As you can see in this photo, I simply hot-glued the main board in between the batteries and the right side motor.

Power switch mounted in the butt

I cut a notch and mounted the power switch facing downward, initially. That was painful and dumb. So I flipped it over. Why? First time the bot made a turning start, he switched himself off. Duh.

Skeleton made from garden mesh wire

Now, as mentioned above, the whole idea behind this thing staying upright on its own is for it to have a heavy butt. With four D-cells and a bunch of metal bars and wheel balancing weights, you'd think that would be enough to counter that wire frame. You'd be wrong about that. I had to snip out a bunch of that wire to lighten the load to make him more bottom-heavy.

Wire poked through bottom and ground down

To firmly attach the skeleton to the butt, I left plenty of extra pokey wires on the bottom edge of the skeleton. I then drilled holes in the base and pulled the skeleton down through them. I bent the wires outward and then ground them down. In fact, EVERY STEEL wire sticking out needed to be ground down. I know have lots of little holes in my hands and arms, thanks to that incredibly pointy steel wire.

I bent the shape of the skeleton on my table saw. I used a metal straight edge to push each bend down into the miter slots on the steel table of the saw. It worked great! Since I always do my own stunts, climbing up on the table saw wasn't that big of a deal.

Plenty of weight in the butt

For the bot to stay upright, as mentioned above, weight was key. Besides the big batteries, I needed some more weight below, so I picked up some joist repair bars at Home Depot. They're heavy and they have nice countersunk screw holes in them. I mounted four of them to the base and then used some car wheel balancing 0.5 gram weights I got free from a very nice guy at Pep Boys Auto Parts. I used the little weights to get the bot balanced and vertically straight. It's incredibly heavy, but stable.

Skeleton after weight reduction surgery

Another thing I think I mentioned before was the need to lose some weight up top. I cut some strategic holes into the body to lighten the load. It worked perfectly.

Construction paper is fun

With the help of a little construction paper and a glue stick, the body is complete. At this point, as you can see in the photo, the body construction paper isn't bent inward down near the base. I eventually did that and tacked the edges every inch or so with some hot glue for good measure. I also put construction paper on the wheels to add some nice finish to the thing.

Butt battery and power access flap

The power switch and the batteries are accessible through a flap in Domo's butt. It sometimes flaps in the breeze while he's running around, like the tails of a tuxedo coat.

Domo remote in project box with rocker switches

I got a handful of slick little rocker switches to run each motor forward or backward. I did some minor butchering on the holes underneath the flanges of the switches. What does one expect for a free robot skinned in construction paper? The red LED is the original from the RC car remote. The antenna was a piece of wire I had on my bench. To change the 9-volt battery, you just unscrew the four screws on the bottom of the box. Easy.

Controller and Domo bot

I used my trusty little label maker and put some stickers on the buttons to aid in its use.

To steer Domo around, you drive him like a tank: Push both buttons forward to move forward in a straight line. Push just one to make a wider turn. Push both buttons opposite each other to spin him in place. Push both buttons back and he goes straight back.

Dave, the guy I gave the bot to, has a dog. The dog doesn't like the bot. It is funny to watch, though.

iPotti™ Released!

iPotti™ 1.2 bathroom status device So, we have this issue at the office with our single-person bathrooms. We have one "m" bathroom and one "w" bathroom. We have 40+ people in the office. Many people who sit out-of-sight from the bathrooms often walk all the way across our office only to find out that someone else has beaten them to the potti.

To solve this problem, I took a Make Controller from MakingThings.com, wired a couple of Vishay TEMT6000 ambient light sensors (photo transistors) to it, then wrote a Mac desktop app to sit in the status bar to show everyone the status of the pottis. I call it, "iPotti™" and it works awesome!

At the heart of iPotti™ is the Make Controller. It's an Atmel Sam7 ARM microcontroller with the Make Interface Board stuck to it. The Interface Board has Ethernet, USB, power and breakout headers for the pins of the microcontroller. I wrote a slim little piece of firmware for it that simply broadcasts UDP packets with the status of the pottis. It broadcasts a packet about every couple of seconds.

At the receiving end of the iPotti™ system is a little Mac OS X app designed to sit up in the OS X status bar:

iPotti™ in the OS X® Status Menu

iPotti™ Status Menu - Men Busy

The letters are green when the pottis are available. They turn red when the lights go on inside the bathroom. Lights are the whole trigger in this device. I didn't want to get into sensing AC current in the light wiring or tapping into the switches. This was the cheapest and easiest to get done quickly and without forking out too much coin.

The status menu item has a drop-down menu, as well. It's how you quit the app or check the About dialog:

iPotti™ Menu

The About dialog is pretty simple, but it turns out to be indispensable, since I've now released about three updates to the client software.

iPotti™ About dialog

The sensors see ambient light like the human eye does. I mounted them up above the bathrooms and oriented them to look through little vent holes in the lighting canisters. The light cans keep themselves pretty cool, so there shouldn't be any worries about melting the little sensor thingies. (Read on to see the sensors and their PCBs.) Here is what they look like mounted near the ceiling light cans:

iPotti™ light sensor in position

The sensors are spliced to 4-wire alarm cables that run back to the main iPotti™ server. The two cables join into a single RJ-45 connector (same one used for Ethernet, looks like a big phone jack connector) and then snap into a port in the side of the iPotti™ device box.

Another sweet technical feature of the installation is that our office uses IP phones that get their power from the Ethernet switches. It's call, "POE," which stands for Power Over Ethernet. We bought a little Cisco®/Linksys® POES5 5-Volt splitter that happened to have the proper little coax power connector AND it was the proper polarity, so I didn't have to do anything to hack it together. Here's what it looks like connected up, powering and communicating (outside of the case, of course):

iPotti™ powered over Ethernet

Inside its case, the iPotti™ looks like this:

iPotti™ put together in the case

The Make Controller doesn't fit perfectly in this spare project box I had, but it's good enough for a device that nobody will ever see (hardly ever, anyway). The two white cables protruding from the left side of it are being replaced with the RJ-45 jack for the sensors. Originally, in version 1.0, the cables went right inside the case, wrapped around a screw post for strain relief, and then jacked into the controller.

The latest incarnation (the one that is live and connected now) uses some recovered USB ports from some circuit board I had in my junk pile. I took the ends off of two old USB cables and spliced them onto the ends of the bathroom light sensor cables. I should have done that from the start, but I was lazy and anxious to get this thing up for testing. Now, I can easily disconnect it and update it or maintain it.

The only fab I had to do was on the sensors. They are surface-mount (SMD) and they require a resistor, so I made little PCBs for them using my usual toner-transfer process:

Spare or reject sensor PCBs

Fully assembled, they each look like this:

iPotti™ ambient light sensor

The real trick will be getting people to remember to turn of the lights behind them. We've had signs up for the for the longest time to remind people. Occasionally, someone does forget. Overall, the solution works well.

Lessons learned from this project: A little Make Controller doesn't fair well as a web server when 40+ workstations are hitting it every two seconds. The 1.0 version of the system had the iPotti™ main device set up as a web server and the iPotti™ app hit the server every couple of seconds. This was painful and dumb. I chose that over UDP out of laziness and fear of the unknown (I had never set up UDP broadcasts on the Make Controller's lightweight IP stack AND I hadn't done it yet in my Cocoa [Mac OS X] development adventures). Turns out that UDP was stupidly simple to implement on the Make Controller AND for OS X. I should have done it from the get-go.

Here are some other photos of the installation and a famous red box...

Do not lick soldering irons

SparkFun box!!!

Designer and his new creation

Hack the SparkFun Big Red Dome Button!

Needs more shine! The light bulb inside is medium OK in its ability to attract insects and people with ADD, but I wanted a little better (not too much, though). I also wanted signage. This is a super-simple project that anyone with even questionable soldering skills can pull off. Plus, there is enough room behind the red part of the button to put most any LED you like. Finished Dome Button Upgrade: Lower power, better

First, let's start with what the awesome big red dome button from SparkFun looks like as shipped:

SparkFun Big Dome Pushbutton as shipped

Eet's Oh-Kay. What's more fun than a big-honkin' red button?? It could wind up as a History Eraser button like on the 90's cartoon Ren & Stimpy. Maybe a self-destruct button? I'm going to make something similar to the button from the movie The Box. Nice wooden case, flip-open lid, big lettering that reads, "DO NOT PRESS" and pulsing backlighting. How can you NOT press a button like that? When the button is pressed, it will play Daffy Duck going nuts.

Here is the original light bulb lit by 12 volts AC:

Original light bulb for dome pushbutton

It's OK and looked decent behind the red dome, but it draws a bit of power and it's old fashioned and not as neato as LEDs.

We start by flipping over the button and checking out what we have to work with.

Under the dome button

We need to take this thing apart to the point that we have all the pieces sitting on the desk, ready to be upgraded. The switch and light assembly twists to unlock and then pulls out of the center of the button.

Switch and light assembly

Next, pull out the lightbulb from the assembly. It simply pulls out. Just tug on it, maybe wiggle it a bit, and it will come out eventually.

Light bulb removed from switch assembly

Unscrew the big white plastic nut from the back of the button to release the main part of the dome button from the bigger black base thing. You'll be left with the basic parts and you can display them neatly like I did:

Fully disassembled big dome button

To release the top red part of the button, the dome, from the whole thing, you need to squeeze the little white tabs inside the center of the button where the switch and light assembly was.

White tabs in center of button hold top in place

Once that red dome part of the button is loose from the black base, you can pry the red off the white with a little screwdriver or other similar implement in order to get to the pulp and juice of the fruit. What?

Prying open the red dome

Now we have access to the disc inside the red dome to which we can affix signage.

Inner sanctum of dome button

I took a quick measurement of the white disc and fired up Adobe Illustrator (which I also use to create my circuit board designs) to make the appropriate sticker. I printed the words on full-sheet sticky-backed laser printer paper, available at many places. If you can't find it, this project is probably over your head.

Warning label for dome button

For this hack... I mean, upgrade, we're using my favorite little SMD LEDs from SuperBrightLEDs.com, or pick your favorite supply source. They have three little white LEDs in a single, easy-to-solder surface-mount package. I've used these many times for projects like the Iron Man arc reactor, the LED reading lamp, and a new project about to be posted (you'll have to check back to see it).

5mm triple white LED SMD package

Two things happened in this next step and I forgot to photograph the process, but I took a strip of IDE cable and peeled a section of three wires from it. I then placed that three-conductor cable and placed it inside the perimeter of the white part of the button where the light bulb used to shine through. I marked it to the length of the inner circumference of the white thing. I then divided that by 3 and chopped it in the two spot and trimmed back the insulation on each of the ends of the cables. I then soldered each of the three LEDs in each of the three SMD LED packages in series. Basically, I just daisy-chained the LED packages together. At one end, I soldered a single, 22 gauge wire to the cathodes of the LED package. On the other end, I soldered another 22 gauge wire to the anodes of the LED package. Look at the second photo of the interior of the dome below.

I lined the inside of the dome with sticky-backed foil, which I picked up from Home Depot. It's in the plumbing and heating section and they use it to seal and for reflective insulation, I think. All I know and care about is that it makes a great reflective surface for scattering light. I used it in the Man Cave lighting upgrade  and 12 VAC power supply project.

Dome button lined with sticky foil

Here is a closer shot of the LEDs and the IDE cable:

Notice the LEDs cabled together

The foil tape holds everything in place. The positive and negative leads then are routed out through the hole in the center where the light bulb used to be located.

As always, I marked the leads for positive and negative.

Leads marked with black/red

And here is the main part of the button put back together:

Reassembled dome part of button

Now, put the dome assembly back into the black holder and put the spring back:

More put back togetherness

Next, we need to prepare the switch thing a bit. The brass clips inside the switch holder need to be removed. We don't need them at all. You could solder the leads from the LEDs to the brass thingy, but I didn't. Use a small screwdriver again to pry the side away from the switch. There is a notch that the plastic snaps into on the switch. Once you pry that away, the plastic holder will slide off the switch easily.

Pry off plastic switch/bulb holder

Next, remove the brass clips. They will be bent pretty well in the process. Doesn't matter. We don't need them.

Brass bulb clips removed

Route the leads through the plastic switch holder and twist it back into the button.

Route leads and reinsert holder

Next, route the leads out the sides of the holder so that the switch will snap back into place.

Leads out the sides, switch back in place

Connect the leads to your 12-volt DC power supply with a limiting resistor (depends on your LED specs) and it should light right up!

Viola! Lighted and customized big red dome pushbutton!

USB Foam Dart Launcher Assimilated (Partially)

A coworker walked up to my desk and handed me this USB-controlled Nerf-esque dart launcher thing from Think Geek because it wasn't working. If it was dead, I thought I'd at least get a number of little motors and gears and whatnot. I took it home, removed all the screws and completely dismantled it to see how it works. It's ingenious inside. I won't get into it, but it's pretty cool. I decided to put it back together, sans its main circuit board. Everything appeared to work, as far as I could tell. I figured out that the darts were gripping the nozzles on the barrel of the gun to tightly, so I jammed a needle nose pliers in the back of the dart and spread 'em open a little more. That fixed it.

Next question: What to do with this thing. I removed the main board and had all the wires for the motors and the switches hanging out the hole where the USB cable used to be. Man Cave Security called and said we needed some kinda defensive system to connect to the new [fake] talking alarm pad. I'll post the rest of the photos of the finished weapon when it's completed. In the meantime, here is the reassembled launcher with a new 12-pin header soldered to the wires for easy breadboarding:

Hacked USB Dart Launcher

Here is a close-up of the header hanging out the back of this thing:

Launcher 12-pin Header

So, like I said, once I get some more work completed on this bad boy, I'll post the fun photos.

12VAC Power Supply from Ikea Wall Wart Light Power Supply

I recently rebuilt the lighting in my office because the crappy 12-volt strung lighting from Ikea that the previous owner installed was insufficient for working comfortably in my Man Cave™. Here's the NEW lighting above the sound-proffed barn door window shade things: New Man Cave™ Lighting

With the intensity of the photo cranked down a bit, you can see the simple valence I made out of pre-primered pine trim board:

Valence around new Man Cave™ lighting

The old lighting was 12VAC wire cable lighting with halogen lights. You seem the at Ikea. Two steel cable strung between two walls and the halogen lights hang between the wires at regular intervals. It's really cool, but it isn't very bright and the light is very yellow. I like daylight-ish fluorescent lighting, so that's what I bought to replace the old stuff.

Now, on to the real story: I salvaged the wall wart transformer/power supply for the 12VAC lighting and made a simple 12VAC power supply out of it. Not sure what I'll use that for, yet, but it was fun and I feel like I saved the landfill from containing weird metal and plastic parts.

I removed the pushbutton fuse reset thing and replaced it with a neon lamp power switch with a fuse reset feature and then cut a notch in the base of it to hold a strain-relief thing for a power cable from an old VCR I torn down. Then I put a wood base on the back and screwed in to together and sanded it for a nice finish. I haven't painted the edges black, yet. I also need to put little rubber footies on it to keep it from sliding around on the glass top of my electronics workbench.

Here are the photos:

12VAC transformer power supply

Completed power supply with power cord and switch.

Poplar Wood Bottom

Bottom is screwed into four holes built into case of wall wart. I wrote the specifications from the sticker on the transformer inside so that I would not forget how this could catch fire or trip a fuse.

Fuse reset button replaced with on/off/reset switch

I realized after I put it all together and tested the power that the replacement power switch might not trip at the same power draw as the old pushbutton. So, when I laid a big piece of copper wire across the terminals, it sparked and never did trip the switch OR the circuit breaker for the garage workbench. That's probably a fire hazard, but I'll usually have a good quality surge strip (or two) AND a house circuit breaker between my mishaps and the neighborhood power lines.

My First Amplifier Circuit: LM386 Easy Amp

It's no secret that if you read at least two articles on this blog you know that I know just slightly more than diddly-poo about electronics. That's OK, though! I'm learning and it's WAY fun! It's like making cool stuff with Legos™ but with the caveat that you could electrocute yourself or start a fire. The other day, I tore down an RCA radio and CD alarm clock that my wife had owned for a while. Its LCD display was failing. We didn't really have a used for it, so I took it apart. I got a great collection of little tactile buttons and motors and other cool circuit boards full of capacitors and diodes and whatnot. But, two of the coolest parts I got were a couple of pretty beefy but small 8-ohm speakers with really great range. They sound awesome when hooked up to something that can drive them properly.

I decided to build a quick amplifier circuit around the LM386 amplifier IC. It's an 8-pin DIP and it is really easy to get going if you're past the super-newbie stage. Or, at least if you are me. I fried two of these in the very early stages of my electronics experimentations. That's an accomplishment, since the versions I have of this IC can withstand up to 15VDC or 18VDC (I can't remember what the National Semi datasheet said). I was young and stupid and needed the lesson.

Here is the breadboard of the circuit...

Simple LM386 Audio Amplifier

The potentiometer is the volume control. The heatsink is screwed to an LM7812 12V voltage regulator. There are a couple of caps and a diode on there. The wire with what looks like gum on the end of it is actually the headphones jack wire with a three-pin header molded onto the end using that really cool putty "as seen on TV" that you knead together and it forms really hard parts. I used it to protect the super-thin wires of the headphones jack. The little chip on that board is the LM386. The red- and black-tipped wires coming into the top of the breadboard just left of the diode and the voltage regulator are the leads from a Radio Shack 12V, 500 mA wall wart.

I salvaged some really impressive little powerful speakers from an RCA clock radio and then made a quick little cabinet for one of them in a plastic parts container I had on my workbench. I used the batting that was behind the speakers in the radio, as well:

Quickie Speaker Cabinet (not great)

It was sufficient enough to make the speaker sound much better while testing. Of course, if I build a proper iPod speaker set, I'll do a better little fun cabinet for each speaker AND I'll proper match the iPod's kinda-non-standard line-out voltages.

Here is the entire 12V circuit connected to an iPod:

LM386 IC iPod Amplifier Circuit

When I pressed the little plastic speaker box against the kitchen counter more tightly, the bass was impressive. So, it seems a well thought-out speaker cabinet for these speakers could potentially make a really nice portable little speaker system. I can't remember what the wattage listed on the back of the speakers was, but it wasn't shabby. I have a number of sets of really nice small speakers I've purchased over the past couple of years for future speaker projects. They've all got pretty decent response. These little guys were lucky finds in a salvage project, so yay!

As I wirte this, I am not at my MacBook on my electronics bench, so the exact circuit diagram escapes me. Here is one that I think is VERY similar and would probably work well:

http://web.mit.edu/6.s28/www/schematics/lm386.htm

Tony Stark for Halloween 2010: The Arc Reactor (RT Mark II)

UPDATE: Want a PCB and components for your own project? I've had a deluge of requests for the PCBs for this project. If you're interested, please contact me through this blog. I'm trying to figure out whether it's worth it to sell the boards alone or maybe as a kit with the LEDs and resistors (or current limiting devices) or maybe even assembled (LEDs, resistors and power leads). I have been dying to post photos of my latest colossal time-sucker-of-a-project: My Halloween 2010 costume is Tony Stark. Iron Man would have been a pain in the mechanical arse, but Tony Stark's only challenge is that crazy super-glowy round life-saving thingy thing in his chest which is visible under a shirt. This is the most ridiculous and complicated build I've done to date.

This post is about building the arc reactor Tony Stark needed to survive in the Iron Man movies. The particular version I wanted to build was the RT Mark II, which Tony built in his home lab once he got home from his captivity in the desert. It's more refined than the first version he built in the cave and every bit as swanky. Mostly, I liked the look of the second one better, myself. The one I'm talking about can be seen in the movie fairly up-close when Pepper Potts has to remove the old one and replace it with this new one.

So, first thing's first... I had to create a round circuit board (and a circuit, for that matter) with some super-bright LEDs that wouldn't catch fire under my shirt and, at the same time, would be visible from space from under my shirt. Ideally, I wanted this thing to stay fairly bright for as long as possible, like, say, a long night at a Halloween party. I'm just sayin'... I shopped around at SuperBrightLEDs.com and found some 5mm square surface-mount LEDs. These little doods have THREE little ultra-bright LEDs in each little 5 mm X 5 mm X 1.5-ish mm package. The blue ones that I used in the were so bright that when properly powered, they left greenish-yellowish spots in my vision for a while after looking at them.

I wanted the PCB to be functional, of course. It needed to properly connect the parts of the circuit together. But, I also wanted the traces to look movie-like. Busy, complex, important, and artsy at the same time. I design the circuit in Illustrator and tried my best to make the traces look like they were more than just power for LEDs:

Circuit board plans

You can see that the PCB design even includes the Stark Industries logo at the top. The zig-zaggy parts are the landing pads for the SMD LED packages. They have three anodes on one side and three cathodes on the other. I ran each SMD LED package's individual LEDs in series. There are 14 total SMDs, or 14 total three-LED series circuits. Each of the 14 series LED circuits connects to the ground bus (the outer ring in this design) and +9.6 volts via the center "C" ring. The little squares are the through-holes for the 15-ohm resistors for each of the 14 SMDs. The final etched board looks like this:

Finished etched printed circuit board

The fuzzy edges and weird texture on the traces are due to some craptastic refurb toner cartridges I bought for our HP 2600n color laser printer. The black cartridge deposits a funky pattern of toner all over the page. This translated to the pattern being transferred onto my PCB. To make PCBs, BTW, I use the toner transfer method. The products I use are from Pulsar and their stuff works AWESOME. I never imagined I'd be able to create my own circuit board this easily and with such accuracy. I bought the laminator they recommend using. The laminator came in handy for the our badges to the 2010 Stark Expo:

Fake official Stark Expo 2010 badges laminated

I am going as Tony Stark, including growing a goatee and moostash:

Me, er, Tony Stark

My wife is going as Pepper Potts and coincidentally looks just like her.

Here is the completed board with parts populated:

Completed PCB with components

Now, on to the power supply...

8 AA cells, 9.6V power supply

Before I get too far, the power supply for this thing is an 8-pack of NiMH AA batteries and pumps out about 9.6 volts. The batteries are Energizer rechargeables that are labeled as having approximately 2,300 mAh of power in them. As you'll see later on, there are a total of 14 SMD LEDs on my circuit board. Each of those LEDs is actually THREE LEDs and each of those LEDs uses 3.2 volts and draws 20 mA of power. I ran each of the internal LEDs in each of the SMD LED packages in series, so (forgive me for being a complete n00b electronics geek) each SMD should draw 20 mA of power and drop 9.6 volts across the entire package. For safety, I did stick a 15 ohm resistor in front of each SMD. But, because I'm not too concerned about the nitty-gritty, I figure that 14 SMDs (14 x 3 LEDs) each drawing 20 mA equates to 280 mA. 2,300 mAh of battery power should light the arc reactor for upwards of 8 hours, but in reality, it will croak much sooner. So, in order to keep my glowing chest entertaining, I'll carry two sets of 8 fully charged AA batteries. If I'm out later than the productive life of those batteries, I'm probably going to be in rough shape the next day.

OK, back to the LEDs... Here is a picture of one of them:

5 mm X 5 mm blue SMD LED

That one might be white. I can't remember. But, they're tiny and bright and that's all that matters.

Did I mention that they're tiny and they're surface-mount? I hadn't tried SMD, up to this point in my inexperienced little electronics hobby career. In person, the work I did got progressively better and you can see it on the completed circuit board. Or, maybe you can't because it's hot-glued into the completed project. Anyhoo... I did perfect getting those little things onto a circuit board. It's pretty easy, once you figure it out.

So, here is the completed arc reactor, for those of you who don't care to read the ramblings about building it:

Completed RT Mark II arc reactor

Toward the end (which was the night before the first Halloween party I had to go to, I decided to make that center lens with sanded lexan and hand-drawn concentric circles. The one in the movie had a cool ridged lens like those on a lighthouse lamp. I ran out of time and patience and this is the compromise. :)

On to the steps I took, shall we?

First, I drew up plans. I'm not much of a planner, but something this weird needs some kinda goal. Dr. Stephen Covey says to start with the end in mind. Smart man. I couldn't have winged/wung/wanged this one.

Plans for my arc reactor

I drew the plans to-scale in Adobe Illustrator. I took this sheet with me to Home Depot, Michaels, Target, etc. to find parts to fit. Most of that hunt went well, save for the stupid big clear plastic ring with the copper windings around it in ten places. That's where this turned into a learning experience, as well.

Let's start with the worst part of this build, which, based on my lack of talent and knowledge in electronics, should have been the electronics. It was not. The worst part was that damn plastic ring. I've watched enough Mythbusters and on-line crafting and DIY videos to know that you can "easily" cast your own parts at home. "Easily" is a term I now use sparingly and loosely when it comes to my DIY/maker/tinker projects.

To mold a part, you have to have an original. How hard could it be to make a ring? I can cut wood, sand it, make it pretty darn smooth and shiny and nice. Attempt at making a ring original was done in wood. It sucked. My old, worn out hole saws (big circular drill bits that cut large diameter holes in things) butchered the hard wood I was trying to cut the ring out of. Usually, I can handle a rough cut and can clean up after it. This was beyond reparable. I didn't even bother to take photos. I still have it, though. Lesson learned.

Yucky wood ring attempt

Second attempt was bending acrylic rods. Can you say bubbly? Can you say distorted? Can you say FAIL?

Bending acrylic = Bleh

Third time was a charm. I ran to Michaels and bought Sculpey polymer clay. It's very cool stuff. You make a thing out of it and bake it for 15 minutes at 275° (I recall) and it becomes hard and sandable and carvable and all that jazz. Awesome stuff. I formed the ring as a long rod, first. Gave it its profile shape using some aluminum straight edges and my level, then bent it around to fit the plans I had been carrying around. I trimmed the extra length off and smooshed the ends together and smooth all of it out. It looked rough, but workable. I baked it. I sanded it and shaped it into a pretty darn good first-ever Sculpey part:

Polymer original for reactor main ring

I used a heavy bearing as a sort-of rolling pin to help shape the ring. A razor was handy and the straight edge things were perfect:

Tools of the trade

The next step, at least from what I've been reading, was to layer a bunch of latex over this thing to make a mold from which we will eventually make a clear epoxy resin ring.

Seal around the bottom

Suggestions from a number of experts say that you should glue your part to a non-porous surface and seal the gap under it with clay or something similar. I did. It was a good call, too.

Next, layers and layers of latex are painted over the part until a fairly sturdy but flexible rubbery mold was built up:

Layers of latex

Each layer needs to be dry before the next on goes on. It was tedious, but very cool when finished.

Finished latex mold

Reminder: I suck at casting and mold making. Do not follow my lead. I scraped by on this one. The image above was my second attempt because I ignored some recommendations in the first try. Buh-bye, time. This one shown above, though, was great! But, like the videos will show you on-line, you need a, "mother mold" made of something sturdier to help the latex mold keep its shape. I did that with plaster of Paris:

Plaster of Paris from DAP

You can get a bucket like this one at Michaels for cheap. A few bucks. While the latex mold was still sitting on the original in the pyrex dish, I glopped on the plaster, which I mix slightly thicker than usual to help it stay in the shape I made it:

Completed mother mold

It worked great. It was perfect, but it was good enough to cast resin thingies.

The next step was to carefully follow directions and mix clear epoxy resin with activator and pour that into this mold. That's great, in theory... Following directions, that is. I was interrupted while counting drops of activator and didn't get enough in the resin goop. I also did not sir it vigorously enough and even properly, according to directions I'd watched three or four times on YouTube. Like the silly latex mold thing, I had to do the resin casting twice. Sadly, neither was great. The second attempt was at least workable for this project.

Clear epoxy resin in latex mold

The above photo is of the second casting. Sadly, the mold was slightly gooed up by the first casting. The second was the right ratio of activator and resin and would have been awesome, but the outer surface stayed tacky for a while because it did not fully cure. Luckily, it didn't affect the overall finished product too much. Since the silly prop was going to be under my shirt most of the time, nobody would notice the craptastic casting job I did.

Here is the final part:

Final clear epoxy resin reactor ring

The texture was from me trying to impart a texture with a paper towel. It kinda worked, but mostly didn't. It's OK, though. The ring does a great job of scattering the ridiculously bright blue light from the LEDs in the final product.

The next step was to build the copper windings that are on the main reactor ring (the clear thing above). This seemed like a pretty straightforward process until it came time to actually do it, of course. I ordered some c-channel ABS model railroad strips from Plastruct. They are perfect, but there are 5 tiny parts for each of the 10 locations around the ring. Cutting those little parts was ultra-tedious and highly inaccurate and inconsistent. I had planned to cut the angles and to use model glue to build them ahead of time and then simply stick them onto the ring. Ha! Funny.

So, plan A for the windings was a FAIL. Plan B was to carefully heat the c-channel stuff and to bend it over the ring. FAIL again. It mostly just curled up and got bubbly, even with low heat. Plan C was to cut each side of the winding channels from thick, black cardboard or Sculpey (and then bake the Sculpey). During another of many trips to Michaels, I bought a sheet of photo matt stuff. It was fairly thick, I could cut it with an Exacto, and I could paint it or Sharpie it. This didn't seem horrible, at first. But, it was one of the most tiring and laborious parts of this build. Look at the parts laid out on the cutting mat:

Reactor ring winding channel sides

These were cut from a strip and I used a template drawn in Illustrator for shape them. At this point (in the photo above), they were easy to work on. The next step was the crappy part: Cutting the insides out of them:

Steps in making each of the 20 channel sides

I went through about 4 or 5 Exacto blades cutting these shapes. My hands were killing me by the time I finished. They also had to be painted all black with a Sharpie. This particular cardboard is matte for a photo or painting. It is black on one side only.

Now that the channels were ready to keep the windings in place, it was time to do the actual windings. I purchased two pounds of 22 gauge and 24 gauge bare copper wire for this. The idea had the potential to look awesome and authentic. The first and only true copper winding took about an hour. Forget that racket. Let's think more like a low-budget Hollywood prop make would... Think, think, think... I was up until about 1:30 that night and gave up on a solution. Here is the awful real copper winding:

Yucky real copper winding

The next morning, I came up with the idea that would save me countless hours of carefully wrapping copper wire around a sticky resin ring: Cut small strips of old IDE hard drive ribbon cables and kink them to the profile shape of the ring. Genius, if I do say so myself:

IDE ribbon cable as copper windings

The only thing they ribbon cable bits needed was a nice coat of copper paint. Testors makes a great copper paint, as you can see:

Genuine simulated copper windings

Now, before I move past the windings, how they're held onto the ring is another bit of niftyism: I drilled holes through the ring so that I could take some of that two pounds of bare copper wire and stick it through the ends of the ribbon cable and lock them in place:

Fastening the windings onto the ring

Also, while the outer surface of the ring was tacky, thanks to my complete lack of casting skizillz, I carefully wrapped the edges of the ring with tin foil, shiny side inward to help bounce the blue light around more inside the resin:

Tin foil reflector things

The only thing left on this whole copper winding fiasco was to glue the channel sides onto the ring along each side of each winding:

Winding channel sides glued on

Since I was running out of time, I didn't do this as cleanly as I would have liked. Upon close inspection, it looks atrocious. But, on shelf or under a shirt, nobody is none the wiser more none... Er... Yes. How about that copper paint?!

Earlier in the build process, I had to make the outer ring. In the movie, this was the container embedded in Tony's chest that held the reactor. I used ABS plastic pipe, cut a 1/2-inch slice with the band saw, and painted it with chrome(-esque) paint:

Outer ring from 3-inch pipe

The center chrome ring was a drain thing I found at Home Depot:

Drain thing from Home Depot

I cut the threading off and ground down the flange to the proper diameter for the center of the reactor.

The last hurdle was how to wear the silly reactor. My wife, in a flash of brilliance, suggest we Velcro the thing to my undershirt. Well, prior to that, I hadn't thought of wearing a shirt under my shirt. The final reactor had black felt on its back to make it more comfortable against my chest. To accommodate the Velcro idea, I just hot-glued the fluffy half of some Velcro pads to the back of the reactor:

Fluffy side of Velcro on back of reactor

Then, I sewed the hooky side of the Velcro pads to the front of a wife-beater shirt:

Hooky Velcro pads on shirt

Completed kit, Velcro on shirt

I'll be wearing the wife-beater under a thin white long-sleeve casual shirt. The reactor is still incredibly bright under even a dark brown t-shirt:

Clearly visible, even with a flash and dark brown shirt

Here is the reactor turned on:

RT Mark II arc reactor replica powered up

It's silly how bright it is. Should make for great conversation at the parties.

My Very Own Useless Machine Ever!!! (Finally!)

I finally finished my own UME Mark II for my own desk for me! Woohoo! My flavor of useless machines ever has a "presidential" look, as some have put it. Latest UME Mk II

This latest model is the first version of the UME Mk II that incorporates a small PCB (printed circuit board) underneath the lid that is attached directly to the pins of the On/Off switch and the two LEDs. It has all the discrete components required to drive the modified servo. It saves time in soldering and it tidies up the wiring under the hood of this magnificent machine.

UME Mk II PCB v1

The wiring that is there comes from the servo, the "parking" switch, and the battery. The next machine I make will have slightly better placement of the board relative to the arm. The clearance was a little tight for my taste, but it still turned out great. This first version of the integrated PCB required some hand-tweaking. I had to cut a couple traces, solder a couple of jumper wires, and notch a little corner out of the board to allow clearance for the parking switch.

The parking switch is the little microswitch inside the box that the arm trips when it retracts back into the box. Its purpose is to cut power on the back swing of the arm. When you flip the On/Off switch to On on the top of the machine, you give power to the circuit and the arm releases the parking switch. When the arm moves the On/Off switch to Off, it actually reverses its own direction. It then heads back into the box until it presses the parking switch, which cuts off power again.

UME Mk II PCB Diagram

The "3.2" version number is truthful: I revised that silly drawing about 3.2 times. The one above is the latest that incorporates the cuts in the traces I had to make on my machine's PCB. It also takes into account the trimming I did in one corner of the board. In the diagram, I just trimmed the entire edge so that it was still rectangular and easier to cut out.

Everywhere you see black is where there would be copper left on the PCB when etching is completed. The green lines and labels are there for reference but are not printed on the final PCB. The white lettering in the black gets etched out of the copper on the PCB. The little circles at the ends of the traces and a few other places in the black areas are drilled with little bits under my drill press. The final PCB turns out nicely, for a home-brew board, I think.