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!
<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 . . .
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 . . .