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 (https://www.instructables.com/id/Programmable-LED/) which sparked my imagination!

<SHAMELESS PLUG>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</SHAMELESS PLUG>

Step 1: 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 . . .

Step 2: 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.
- Multimeter.
- And the rest of the stuff you hopefully already own.

Step 3: 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.

PartDigikey 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)

Step 4: 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.

Step 5: Chip Socket Chipping

You need to trim the chip socket a bit first. Do this before you solder it in. I snuck a couple of resistors underneath the chip, so the socket needs to be trimmed so that they fit. Not a great idea, but it worked. I use a Dremel with a cut-off and trim off the section holding the sides together at the “dimpled” end (see photo 1).

Once you have it trimmed, insert it into the board with the trimmed section in the correct orientation (see photo 2). Make sure you don’t fold a contact over (done that). You should be able to see the four holes for the resistors in the middle of the holder. Solder it in.

Step 6: Resistance Is Futile!

Time to pack those resistors into their spot. Start with R1, which is 330 ohm (unless you use the smallest Radio Shack CdS cell, then use a 680 ohm). Put the leg closest to the end in first and pull it in a ways (see picture 1). Then put the other leg in and snug them both up. I end up pushing the resistor in toward the edge (see picture 2).

Now put in R2, which is 1000 ohm. When you get it in, make sure the legs of R1 and R2 don’t touch in the middle (see picture 3).

Solder away!

Step 7: Front End Work

Time for some work on the business end of Buggy. First is the IR emitter (clear) and detector (dark). Note the orientation of the long legs (picture 1). Bend them 90 degrees near the base and insert them into the board (picture 2).

Now for another sub-optimal trick. Insert the CdS cell as shown. One of the legs shares a hole with the detector (picture 3). If the don’t both fit, drill it out a bit. Try to leave some pad on the backside, but it is not critical. The leads just need to be solder together.

Resistor R3 (150 ohm) also shares a hole with the emitter (see picture 4).

Double check you’ve got the emitted and detector in the right places (I’ve switched them more than once), and solder away. See if you can do a better job than I am in picture 5!

Step 8: Light Em Up

The eyes! I like green/red bi-colored LEDs. Just switch the current direction and they change color! I’ve tried 5mm and 3mm. You can use a single color. Pink eyes are OK for a bug. You could use a different color for each eye. You could have only one eye! Don’t let me limit your imagination.

Just make sure you have the long legs of the LEDs to the outside (see picture 1). I put heatshrink on the legs and leave them long so they can be moved around latter. To get them equal, hold them together and put a 90 degree bend in all the legs at the same time with pliers (picture 2). Drop them in the correct holes (long leg on the outside).


Step 9: Home Stretch . . .

Almost done now! Put in the capacitor and the switch (picture 1). Solder them in place.

Now for the speaker. The red wire goes next to the switch (picture 2). Polarity does matter. Don't use the battery holder hole in the middle. Solder the leads in place.

The battery holder needs a tweak. One of the legs is in the way of where we want the speaker to be. Trim it off with a knife (picture 3).

Push the speaker through the opening and put the battery holder in place (picture 4). Solder it in place.

The speaker is loud, even using just three volts. I put a small square of double-stick tape over the opening, and then tape the opening to the bottom of the battery holder. That leaves it flush with the bottom of the board (picture 5).

You can use an old toothbrush and alcohol to remove the flux if you are as sloppy as me.

What are the odd that it works? Time to find out . . .

Step 10: Finishing Up

All that is left is a final inspection! You can use a magnifying glass to inspect the solder joints. Make sure there are no solder bridges. Use copper braided wire if you do. You can use an ohm-meter to check for shorts between the IC pins and adjacent circuits. Or, if you are confident and brave, put in a programmed chip and power it up.

When putting the chip in, the #1 pin goes to the side of the chip socket that was trimmed away (opposite to the side the button is on).

Hopefully you figured out how to program a chip. If not, head on over to LadyAda's place (http://www.ladyada.net/make/usbtinyisp/).

I wrote a test program to verify Buggy's operation (Buggy44Test.hex in the zip file below). It will flash the LEDs briefly (both colors if bi-colored), make a chirp on the speaker, and then flash codes out to indicate the sensor readings. Count the green flashes (or high tones) for each digit. A zero is a red flash or low tone. There is a pause between each digit. There is a longer pause between the readings. Visible light is first, followed by IR. It then repeats. If you have single colored LEDs, the tones are all you have (single color LEDs flashes same as red, so you probably wont see much)!

For the sensors readings, you are looking for a number between 0 and 255. Visible room light should put you mid-range, say 70 - 120. Dark is about 30. Bright direct light will likely get you a blinding 255!

As for IR in ambient room light, you are looking for something on the low end, say < 30. If you hold it up to an incandescent or the sun, you should get higher. If you get zero with an incandescent, something is wrong. For me it usually means I switched the emitter or detector or put the detector in backwards (no, say it isn' so).

These values are all fairly arbitrary, and depend greatly on the sensors and resistors you use. Every one I have built has had a different response. I tried to optimize the design for room light, but then again, I am an amateur. Hack at will and let me know what you come up with.

When you are satisfied, load the real program and give it a test. Use Buggy44biColor.hex if you have bi-colored LEDs. Use Buggy44oneColor.hex if you have a single colored LED. Getting the chip out is a bit of trick (see picture 2). Always take the battery out first to avoid shorts or damage to the chip.

Step 11: A Craft Project, Did You Say?

Did I mention this is a craft project? Time to bring in the kids! I intended for the bottom of the circuit board to be the main surface to work with. With all the solder and leads it is quite pokey, and could use a layer of adhesive backed foam as a base to work from.

Kids will probably need help getting pipe cleaners legs on in a safe and secure manner. I feed the cleaner through one hole, bent a j-hook, and pulled the end back through the other hole before bending it over (picture 2). Remember, the center of most pipe cleaners contain a magical electrical conductor called a "metal wire". Watch for shorts, especially with the holes near the eye LEDs. The foam base mentioned above might help there as well.

Let me know what you come up with. I've started a blog over at http://www.projectbuggy.blogspot.com/. You can learn some background on the project, see the kids at work, and see what kind of Buggies have evolved. You can pay me back for all this by SENDING ME A PICTURE of your creation. I will post it on the blog.

What is next for Buggy . . .

Step 12: Next Stop . . .

Where do we go from here? If you made one, I hope you'll send me a picture and let me know what you did or didn't like about the design. Tell me what you did to make it better.

Here are some thoughts I had on where to go next:

- Personalities? Alter the programming so each bug has a distinct behavior. Angry, happy, sleepy.

- Temperature dependent behavior? The chip has an on board temperature sensor.

- Jar of Fireflies? Buggy's platform would work for any number of LED projects. You could use the unused ports, or multiplex an LED array using the IR and VIS sensor ports.

- Hijack aRadioShack 'HexBug'? Replace the electronics and you could program in some cool behaviors like hunter / prey with the IR. The chip will source 40 mA on the ports, which might be enough to run the motor directly.

- Songs? I've only got an octave programmed in Buggy. It wouldn't be hard to double that and have it play some melodies like ring tones.

- Practical joke? Program the board to chirp randomly and tape it under someone's desk. Have it go off at a random time every other day. It would drive them nuts!

- TV-B-Gone? Use the IR to turn off TVs at random times!

- Motion sensor. I put one on a shelf facing a lit window, and it would go off if you walked by. It drove my wife crazy!

- There must be a million others. Let me know what you think.

Good luck, and have fun.

I have an idea! What if instead of a photo resistor, you put a color sensor? And instead of changing the eye colors manually, they would change color when they &quot;talk&quot; to each other. That way, you could program them to use morse code! You could probably even make a handheld device that could be used to communicate with the critter! Great start! :)
what is the dimensions of the buggy and could you make it that one is the key and one is the lock and when the key comes close to the lock and they send ir to each other then the key unlocks or in my case works a relay a lcd and 2 LEDs Thanks can some one answer please
I might be making a IR lock system based on the arduino
The board is approximately 1" x 2" (25 x 50 mm). An IR lock/key is a novel application. I don't think it would take much to get the Attiny45 to operate a relay.
thanks but i was thinking of combinding a sort of pet idea with the lock key system but the one "key" can unlock like 1+ diffrent locks
and like if their was two sets like set 1:key -lock-lock-lock this key can't unlock set 2 set 2:key -lock-lock-lock this key can't unlock set 1
Now all you need to do is make a communication network for them. Network-Buggy.
Can anyone tell me if this will work to program the ATTiny44v I need to make a Buggy? It is listed in the device list but just wanted to hear someone say it was a decent thing to get. LOL<br/><a rel="nofollow" href="http://cgi.ebay.com/Mini-ATMEL-AVR-ATMEGA-STK500-USB-Programmer-ISP_W0QQitemZ250335943300QQcmdZViewItemQQimsxZ20081203?IMSfp=TL081203111006r15090">http://cgi.ebay.com/Mini-ATMEL-AVR-ATMEGA-STK500-USB-Programmer-ISP_W0QQitemZ250335943300QQcmdZViewItemQQimsxZ20081203?IMSfp=TL081203111006r15090</a><br/><br/>Thx<br/><br/>KrakenFan<br/>
I haven't used it myself, but yes, that is the &quot;gold standard&quot; for programming AVR chips and will do an Atttiny44.<br/><br/>If you are building Buggy to learn and have fun, why not do the same with the programmer? I built my programmer using a kit from Lady Ada, and it was only $22 (plus shipping):<br/><a rel="nofollow" href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=16&amp;products_id=46">http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=16&amp;products_id=46</a> Check out some of her other cool kits while you are there. We did the &quot;Game of Life&quot; one at the same reunion we did &quot;Buggy&quot; at.<br/>
Glad to hear it about that programmer being the "Gold Standard" for programming the AVRs. I had already ordered this before I saw the kits. Can you say impatient? I knew you could. I am also under a considerable amount of pressure to get some Buggy's into production from my quality control / product testing department. ( read: The kids ) Hope my PCb creating works out! I have ordered a Mini POV kit from Lady Ada and am considering a game of life kit as well. We have been making BlinkyBugs while we are waiting for parts to come. Those are super easy and super fun. Thanks for haveing that on your site as well! You realize my kids think you are an Electronics Superhero for creating Buggy right? They can't seem to realize the difference in the fact that I am an Electrician and not an Electronics Tech. lol
Excellent Instructable with killer explanations and parts list too!? Nicely done. This will be my first programming (does loading your program count as programming? lol ) of a chip for a project. I just ordered the programmer. Exactly what I was looking for. I can't wait to get started. KrakenFan
NICE! I know you didn't want to fuss about how to make the board, but is there a place I can find for how you did yours? thanks.
Here is a good example of the toner transfer method:<br/><br/> <a rel="nofollow" href="http://www.riccibitti.com/pcb/pcb.htm">http://www.riccibitti.com/pcb/pcb.htm</a><br/>
cool i love how they can "talk" but it would be so much cooler if they could walk or roll like soileau segusted
Nice! Made me think of a nursery rhyme my parents always told me: "Good night sleep tight, don't let the bed-bugs bite!" New version: "Good night sleep tight, don't let the LED-bugs bite!"
This would be a wonderful bot to join with a vibrobot or even better a beetlebot.
or even a muosebot.
Your images are amazingly incredible, keep up the great work! I hope to see more from you!
sorry about posting 3 times but what currency is this in?
Sorry, I forgot what an wide audience this reaches. The parts, not including the board, are about $8 USD.
You know what. That is one of the best instructables ive ever seen. It has a decent and non-violent purpose (see my other instructables and you will find out why i said this), and has a good application of technology to suit your (((*ahem*))) needs. It is a very clean instructable, and i would like to thank you for shareing it with myself and the world.
That would be soo sick if you turned them into walkers or vibrobot things they would walk around and interact!
good idea if i do end up doin this project since it is a really cool craft i may try to make it movve
you could program it that when it gets a ir singnal from another buggy they start chirping making it sound like their talking
wow you got my vote im going to try and make one
Very well planned out. Also nicely put together. Great work, with good pics.
wait....where did you get the stuff to make the pcb?? cool project thinking of maybe doing it with my camp
nvm i looked at the tutorial for the pcb and i get it now sweet project but the cost grows quite quick though
Yes, the cost grew. I was hoping to keep it under $5, but not counting the circuit board, there is about $8 in parts. <br/><br/>If you want to go cheap, use an Attiny11 and leave out everything but the button and CdS cell.<br/><br/>Tom Weber took simplicity to an art. Check out his instructable, which inspired mine:<br/><a href="https://www.instructables.com/id/Programmable-LED/">https://www.instructables.com/id/Programmable-LED/</a><br/>
Dude, awesome job!!! This is one of the coolest things that i have seen that have to do with led's! ;)
Very well done! This you make a great kit!
awesome instructable, it was well put togethen and it made me want to go and salvage materials for a whole army of them. Rating:5/5 Vote: +1
Great project, I really love it!! I love anything whit LEDs!<br/>I made an Instructables yesterday,<a rel="nofollow" href="https://www.instructables.com/id/LED-Snake/">LED Snake</a>, lots and lots of LED!!!<br/><br/>rate:***** <br/>

About This Instructable




More by MakersBox:Easy Joule Thief Soldering Project Using an Arduino Drawing Robot with Hour of Code Tutorials Arduino Drawing Robot 
Add instructable to: