Introduction: Electronic Heart (Flashing LEDs) - Mother's Day Project

Mother's Day was approaching, and I am getting my 8 year old son started with electronics. So why not combine the two? In the next few pages we'll show you the project we did - a blinking heart with several effects, all driven by a microcontroller. Taught my son not only about how to make mommy happy (she LOVED the present), but also about project planning, prototyping, soldering, programming, and testing. Everything a budding little engineer needs!

By the way, if you like this project you may want to check out some other electronics design instructables I did:

https://www.instructables.com/id/DPScope-Build-Your-Own-USBPC-Based-Oscilloscope/

https://www.instructables.com/id/DPScope-SE-the-simplest-real-oscilloscopelogic-/

https://www.instructables.com/id/LCS-1M-A-Full-Featured-Low-Cost-Hobby-Oscillosc/

Step 1: Circuit Design and Assembly

As this was a learning project for my son, I wanted to keep everything as simple as possible. We started out breadboarding  some fundamental circuits - hooking up the microcontroller, blinking a single LED, and so on. Then we decided about the layout of the LEDs and went scavenging for the necessary components in my lab in our basement. 

As for the microcontroller, we used a Picaxe 18A (see http://www.picaxe.com for more info). Picaxes are a line of very simple-to-use microcontrollers, perfect for our task. The 18A is actually a pretty old model, but was sufficient for the task. Apart from programming them in a simple version of Basic it also offers flowchart programming - this is what we ended up using since for an 8-year old I think it is way more intuitive. Nothing better than having a visual representation of the program flow.

The circuit schematic is shown above; nothing out of the ordinary. The circuit runs off two rechargeable batteries. The currents into the LEDs are low enough that the microcontroller can drive them directly. The pushbutton shown in the actual circuit ended up not getting used so I omitted it from the schematic. The Picaxe has a bootloader installed and is programmed through a simple serial interface - two resistors and a 3.5mm stereo jack is all it needs for that.

You may notice that there are always two LEDs hooked up to each output of the microcontroller, which means they aren't independent. This was again to limit complexity - that way all LEDs can be driven from a single port. Using a larger microcontroller with more outputs would have been possible but I wanted to avoid the code bloat that would result - I rather have a smaller program that my son can actually understand and handle. The way that the LEDs are hooked up - the LEDs of each pair are sitting at opposite ends of the heart - still allows for lots of interesting patterns.

We built up the circuit on a standard prototype board. It was the first time my son did some soldering (under very close supervision by myself to be sure), he was very excited. Above you can see the final result.

Step 2: Enclosure

Next thing was the enclosure (box). I had found a suitable one in my drawer which even had a battery compartment. The board fit pretty tightly.

In order do drill the holes accurately we got another protoboard where we marked the location of the LEDs on the "real" board. With a needle we could punch through the two mounting holes for each position and then drill the box right between each of these two marks. This worked pretty well and we were able to fit all the LEDs through the holes.

The batteries are standard rechargeable NiMH type AA cells, held in place with a battery holder.

Step 3: Programming

As mentioned before, the Picaxe can be programmed by drawing simple flow diagrams, using a program called "Logicator". This software is available for free from http://www.picaxe.com as well. You drag and drop the appropriate elements from a toolbar into the drawing area, and then connect them with arrows to indicate the flow of actions. Double-clicking on an element brings up a window where you can change its parameters (e.g. which pin you want to turn on or off). One nice feature is that you can simulate the program on the computer, so you can observe what each command does.

Again we started with simple experiments, e.g. toggling one LED on or off. Then we went to designing the different optical effects, one at the time, e.g. blink all LEDs together, or turn on successively more LEDs and then turn them off again one by one. In the end we joined all the separate effects together. Overall this taught my son a lot about programming, including debugging ("Why doesn't it work?" - "Well, lets go through step by step"). You find a screenshot of the complete program above, and below I attached the complete source code which you can download to us as a starting point for your own version.

Step 4: Finished Project

Below I have added some pictures and a video of the final version in action. Of course anybody can get creative and come up with his or her own special effects - the ones we did are by no means all that are possible!

I was expecting maybe a day or two of battery life; after all, LEDs are relatively power-hungry beasts. But it turns out that it lasts well over a week on a set of 1800 mAh rechargable batteries - not bad!

Comments

author
LautaroR made it! (author)2015-05-20

How you upload the program to the microcontroller?

author
womai made it! (author)womai2017-05-14

as far as construction soldering iron, solder, wire cutter,electric drill, screwdriver. If you mean software tools, you need the Picaxe logicator and the Picaxe download cable (see www.picaxe.com for details).

author
womai made it! (author)womai2017-05-14

you need the Picaxe logicator and the Picaxe download cable (see www.picaxe.com for details).

author
VesaB made it! (author)2017-05-14

what materials do you need it doesn't show a list of what you need

author
womai made it! (author)womai2017-05-14

The schematic shows most of it. Apart from the Picaxe microcontroller (details on www.picaxe.com), all other parts are generic components which many hobbyists will find in their drawers. Same goes for the enclosure, I just took a suitable one from my stock of parts.

author
VesaB made it! (author)2017-05-14

what tools do you need

About This Instructable

8,287views

58favorites

License:

More by womai:Electronic Heart (Flashing LEDs) - Mother's Day ProjectDPScope SE - the simplest real oscilloscope/logic analyzer on the planetDPScope - Build Your Own USB/PC-Based Oscilloscope
Add instructable to: