Buggy – A Crafty Programmable LED Creature using Microcontroller Atmel Attiny44v
Buggy is a programmable LED craft project using a homemade, single-sided, PCB board, and a programmable AVR Attiny44v microcontroller. Buggy has two bi-colored LED eyes and can sense visible and IR light and emit sounds using a piezo speaker. Not counting the board, there is about $8 USD in parts per bug.
I designed this as a craft project for the younger kids at a family reunion. The kids were given an assembled and tested board, and allowed to decorate it with foam, pipe cleaners, and feathers using hot glue. It was a big hit, and the creations that ensued were fascinating.
The real fun is getting two Buggies together. They emit and detect IR and so can “talk” with each other.
There is plenty of memory left on the chip, and several unused inputs, and given my programming ability, lots of room for improvement. I hope others find this intriguing enough to try and improve on.
Hats off to Alex Weber’s programmable LED instructable (http://www.instructables.com/id/Programmable-LED/) which sparked my imagination!
If you like this idea, give it a rating on the right, and vote for it at the top! I’ll give you a free Instructables membership! Thanks
Devil in the details . . .
Just some notes on the design. If it bores you, skip ahead to the next step.
The Atmel Attiny44v AVR is a 14-pin microcontroller with 4K bytes of flash RAM and 256 bytes of SDRAM. The chip has an internal 1 MHz oscillator, 8 and 16 bit counters, and analog to digital converters. It will run with as little as 1.8V. I used the DIP package and a socket so it can be removed for reprogramming. There are several unused ports available for hackery.
The LED eyes are connected to two ports (PA4/PA5) instead of a port and ground. This allows sending juice either way so we can light up bi-colored LEDs (see schematic).
For both sensors, power is supplied via PA1 only when a reading is needed to save juice. ADC readings are taken on PA0 (IR) and PA2 (visible), each with its own voltage divider resistor (R1 & R2).
An IR LED and current limiting resistor are connected on PA3 so it can be lit separate from the eyes.
Sound is generated on PA6 using pulse width modulation from the 16-bit counter and a piezo-electric speaker.
Power is from a CR2032 lithium coin cell which is the cheapest, easiest to find 3V source I could find. From Digikey they are about $0.28. Why they sell them in the store at $4 is beyond me. I included a 0.1uF capacitor to remove noise. It is optional.
A normally open push-button switch is connected to PA7 and used as a pin change interrupt to change modes or power down.
Nothing too terribly tricky or clever. Remember, I’m a beginner. This is my first design. Let’s see if we can build one . . .
Got to have some skills . . . and tools.
Before I try and scare you off of the project keep in mind that I recently learned how to do all this. You can to.
Disclaimer: I’ve built more than a dozen of these so far. They worked, to the amazement of my friends and family, but I’m an amateur. I can’t guarantee it will work for you. I can’t guarantee how long they work. Look at the project name, “Buggy”! I’ll make a reasonable effort to help you get yours working. I’ll keep updating design as you figure out my mistakes and how to make it better.
Skills you’ll need to buy, beg, borrow, or just learn:
– PCB board making: I’m not going to teach you. It’s on the web. I made mine in my garage. They are single-sided. I used the toner-transfer method with about a 50% percent success rate (just scrub it clean and try again). I used muric acid with peroxide to etch. Careful, careful, careful! I’ll provide you with a bitmap to print or my CadSoft Eagle files to tweak. If you are interested enough to get some manufactured, put me down for a couple!
– AVR programming: The chip needs to be programmed. I’ll provide you my “firmware”, but getting it onto the chip is a trick. I used LadaAda’s USBtinyISP kit (http://www.ladyada.net/make/usbtinyisp/). She has a pretty good tutorial on her website (no affiliation, but she knows her stuff). If it is just microcontrollers you are interested in, try LadyAda’s boArduino kit (http://www.ladyada.net/make/boarduino/). That will keep you busy for a while.
– Soldering: I found soldering on homemade boards to be a bit harder than on manufactured boards. Flux helps. If your skill needs brushing up like mine did, try LadaAda’s Game of Life kit (http://www.ladyada.net/make/conway/).
– Patience: In my homemade experience, nothing works the first time. There is always a reason. Sometimes it takes time to find the reason. The harder it is to find, the more I learn. I learned quite a bit doing this. I’m learning more as we speak.
Tools you’ll need to buy, beg, or do without:
– A high-speed rotary tool (pronounce “Dremel”). Dremel has a drill bit kit with 1/32″ and 3/64″ bits (and on up to 1/8″). The 1/16″ bit that came with your drill is going to rip the pads off of the board. That will make soldering tough. I only used it for holes that the pipe cleaners were going through.
– A good work light is a big help when you are looking for solder shorts!
– Soldering Iron.
– Side-cut pliers.
– And the rest of the stuff you hopefully already own.
Piece by piece . . .
Parts: I like Digikey (http://www.digikey.com/) despite their intimidating catalog. I’m not associated with them, but they’ve given me good service. I’ll provide you their part numbers. Substitute at your own risk. The only part I didn’t get from Digikey was the photocell. It was from RadioShack. Let me know if you find something else that works! A “RS free” buggy would be great. There is about $7 or $8 in parts per bug, but you’ll want to make a couple so they won’t be lonely. Digikey has a $5 handling charge on orders under $25 which shouldn’t be too hard to avoid.
Part Digikey Number
(1) Attiny44v MCU P/N ATTINY44V-10PU-ND
(1) IC Socket P/N 3M5474-ND
(1) Switch P/N SW400-ND
(1) Speaker P/N 102-1616-ND
(1) Battery, 225 mAh P/N P189-ND
(1) Battery holder P/N BS-3-ND
(1) IR emitter P/N 160-1028-ND
(1) IR detector P/N 160-1030-ND
(2) Red/Green LED P/N 160-1037-ND
(1) 0.1 uf cap P/N BC1160CT-ND
(1) RadioShack CdS cell (comes in 5/pack)
(1 ea.) 1000, 330, and 150 ohm resistors
(1) Single-sided 1oz copper PCB at least 1″ x 2″
Heatshrink tubing (optional)
Buggy Boarding . . .
There are other tutorials about making PCBs, so I’m not going to detail that torture here. I used the toner-transfer method. You can used the bitmap file to print out an image or use the Eagle Cad files. I used Microsoft Paint to print out the bitmap to the correct scale. Print a board image on plain paper and do a mock up with real parts first.
If at first you don’t succeed, try, try, again. It took me several tries before I got a usable transfer. You can do some touch up with a Sharpie marker, or just scrub it clean and try again. I’m getting better at it. The deadline for the project was too close, or I would have looked into having them manufactured. If you go to that trouble, put me down for a couple.
Drilling the board was a bit of a trick as well. Dremel has a drill bit kit that has 1/32″, 3/64″, and 1/16″ bits. I made a diagram (below) to show what pad is drilled to which size. Wear a mask. Breathing fiber glass dust is not recommended. The hole for the speaker is ½” . There is pad there to act as a pilot hole.
Leave a Comment
You must be logged in to post a comment.