Program Heart

Step 1: The Arduino

The first step is to make sure you can program your Arduino. The Arduino website is a great place to start. They even have a beginner’s guide with tons of useful information. Get some programs running on it, and become comfortable with the process.

Which Arduino should I buy?
I’ve got a number of the boards myself, and they all have their own pros and cons. If you do not have one yet, I would suggest that you simply buy the Deicimilia, as it has built in USB, and comes pre-made. Plus there are tons of shields out there that simply fit right on top, giving easy access to great features.

You can buy them in numerous stores online: Make, Adafruit, Sparkfun.

Adafruit sells a nice Arduino starter kit, and has a great tutorial to get started with.

The next option is if you want to put it in your pocket, or use you only want to use the Arduino to run a single heart. My suggestion is to go with a Boarduino, or BBB (this is the one I used in the Altoids tin, it fits in perfectly with a single 9V battery). They do not come with built in USB (there is a Boarduino with USB now though), and you have to built it yourself, but they are much cheaper. You will need an FTDI cable to program them, which costs $20. This isn’t very cost effective for a single board, but if you are going to be programing lots of Arduinos, then it is a smart way to go.

For sew-able configurations, there is only the Lillypad at the moment. I have two of them, and they are great. I designed this kit specifically to work with them, and I should hopefully have a working example of it up very shortly. You will need a 3V FTDI cable or programmer. Sparkfun sells one as well as with the other Lillypad stuff. There is also a nice power supply you might want to pick up. The Lillypad setup is the most expensive, but it’s a special design, and it looks great.

If you have any other questions or concerns, please email me (Jimmie at this website) and let me know.

Step 2: Connecting the Open Heart to the Arduino

If you are using the sew-able configuration, I would suggest using alligator clips to test out the board before you commit the time to sewing it into fabric. They are cheap, and easy to come by in any electronics store. Like soldering, I’m not going to cover the “how to sew” portion of this, as it’s been covered online elsewhere. Please check out these sites for some tips and suggestions.

If you are using the header configuration, then you are going to connect the loose wires to something that you can attach to your Adruino. If you have a Deicimilia you may want to simply solder the wires to some of the spare leads lying around your workspace (you should have tons after putting the heart together). They fit right into the female headers on the Deicimilia. A more permanent solution would be to use something like a Boarduino or BBB and solder the wires directly to it. Which is what I did for my demonstration kit. I later replaced that with a set of headers and housings as you can see here:

open heart kit 08

You need to note which wires are connected to which pins. You should write down the mapping someplace. There are six pins on the heart, and they will all map to a single pin on the Arduino (which are all clearly labeled). You will need this information for the programmer in the next step.

Step 3: Programming the animations

I have written a simple animation programmer in Flash (if it doesn’t load the first time, just refresh). Note, the page seems to be down for the moment, so the link will send you to a zip file that you can download. Just open the html page, and you will have the programmer. Also, the file contains a sample program with some fun animations. I will fix this once I am back from Berlin.

Open Heart Programmer

Basically, you click on an “LED” to turn it on or off. You then create frame by frame animation this way. This is the same tool I use to create my animations, so a number of the features I have implemented are there because I had some kind of need for them. There is no limit to the number of frames at the moment, but your Arduino will top out at around 500 or so.

If you hover over “Shortcuts” you will get a list of the keyboard shortcuts, but everything is accessible through the interface as well. You can copy/paste, as well as clear a frame or inverse it (changes anything turned “On” to “Off”, and vise a versa). You can use the arrow keys on the keyboard to change frames in the animation. By holding down the right arrow, you get a basic idea of what your animation will look like. The arrow buttons on-screen are there to shift the frame around from within the heart. This is very useful for shifting the whole frame around. By creating a new frame from current, and then shifting the frame, you can quickly create a sense of movement. The red dot in the center is how new LEDs shifted on frame will default. It can be set to “On” or “Off”. Delete will delete the current frame, and remove it. Be careful with this though, as it will work a few times, but there is a bug that I have not been able to work out yet which will mess up the order of the frame buttons.

Once you are done, you are going to hit “Generate”. This is where that pin map is going to help you out. You need to type in what your setup is into this programmer. Run speed is how many times a single frame runs before it moves to the next frame. That means, the fewer the frames, the faster the animation. I’m going to work out a time table, so that you can type in your FPS (frames per second), but I haven’t worked out the timing just yet. Once I do, I will put it in the programmer. Once you are done, hit “Finish” to generate the code.

Open Heart code generator.

Once you have your code, copy and paste it into the Arduino program, upload it, and hopefully your heart should lite up with the animation you created. If it did, then congratulations! Please send me any cool animations you come up with!

If you are having problems, then please see the Troubleshooting section below.

Step 4: Troubleshooting

If you are down here, it means you are having a problem, which is unfortunate, but hopefully we can work through it. Please read through these first to see if any of these answer your question. If none of these seem to work for you, then email me at jimmie at this website.

Nothing is displaying!

First thing, check your cable, and make sure that it is plugged in snugly, and that it is connected to the Arduino properly. Check your Arduino, and make sure you are able to do something else with it. Try something like “Hello World”. If you aren’t having a problem with the Arduino, then more than likely the pins aren’t set up properly in the program. You can change that in the programmer if it is still open, or just change it in the Arduino code. The pin declarations are the first ones in the Arduino code, so look for the series of pin1 through pin6. Follow the wires from your heart and verify that they are all properly set up.

Now upload your code, and hopefully you should see something at least.

Still nothing!

Now we need to test the heart to make sure it is working. Have some alligator clips? You will need them, or something like them. Connect the +5V from the Arduino to Pin1 on the Heart. Now with a clip or wire, connect each of the other 5 pins to ground. One LED should light up each time. Now connect ground to Pin1, and then touch +5V to each of the other 5 pins, and different LEDs should light up. Note that the outer rings will only be electrically active if you’ve bridged the connections on the back of the PCB. Otherwise you need to use the headers.

If there is still a problem, then you need to check your work. Make sure all of your solder joints look nice an neat, if not, then just re-apply a little bit of heat. If you are still having a problem, and nothing is lighting up, then shoot me an email.

Things are lighting up, but it doesn’t make any sense.

Double check your pin mappings. Follow each cable, and make sure that it is set within the program before you upload it. If you have to, check with a multimeter to make sure there is a connection between the Arduino pins, and the heart pins.

If those are correct, then check your Arduino code. Place “//” in front of “play();”, and delete the slashes from in front of “//sequenceon();”. This will cause the LEDs to light up one at a time, in order from top left to bottom right (reading order). If lights are still lighting up, but out of order, then the problem is still probably that the mappings are wrong in software, but it is also possible that the LEDs were soldered in backwards. Double check your work, and if you are still having problems, then email me.

Only parts of the animation are showing up, but some of it is missing.

Check your pin mappings. If they are all correct, then your problem is probably that one or more of your wires aren’t fully connected. You will need to verify that they are getting all the way from the heart to the Arduino by testing them with a multimeter. I’ve found problems with my own cables before, as it is an easy part to mess up. Test your cable, and find the faulty pin. You can bend the little gripping tab in with a small flat head screwdriver, and then the crimp pin will slide out. Apply a touch of solder and heat to the part near the tip of the wire. Hopefully this will bridge the connection, but test it by testing the resistance between the loop of the crimp and the opposite end of the wire. Once you have a connection, then pop the tab out by gently applying pressure with the corner of the screwdriver. It should snap back into place.

Keep checking connections till everything is working properly. Re-touch the ones on the board if you are still having problems. Worst case is that some of the LEDs were placed in improperly. If you are still having problems, then email me and I can hopefully help you out.