Intro: Gift Away Your Heartbeat for Valentines Day! | Arduino Tutorial
All right people, I've got a pretty sweet project lined up, just in time for valentines day. I'm going to show you how to gift away your own heart!
This is how to use an ECG sensor along with an arduino to record your heart beat! This data will then in turn be used to make an awesome picture, so you can give away your heart to whomever you fancy! While this might seem complex from the start, the process itself is pretty straight forward and now I'm going to show you how to do it!
Let's get started!
Step 1: Watch the Video
You can start by watching the video to get an idea of the execution! Refer to the steps in this instructable to get detailed, written instructions and downloadable files.
Step 2: Plan of Action
Okay - so the heart (haha) of this project is a bitalino. This is a sensor kit that actually comes with all the electronics you need to make this project!
This kit has a sensor for measuring heartbeats. Now we're going to use this to measure our heartbeat and use this as a gift. Then you can say you have given away your heart to someone you really like. So the plan of action is to first connect the sensor and set up everything to acquire the signals from the ECG sensor. When we have the data we want, this can be used to plot a graph of the heartbeat. Now this graph will be used to make our gift!
All of this might sound somewhat complicated, but I promise its pretty straight forwards - and I'll show you how!
The bitalino comes with an arduino, bluetooth module, battery charger, and sensors for measuring:
- Electromyography - muscle activity
- Electrodermal activity - Skin conductivity
- And Electrocardiogram - or heartbeats, along with pre-gelled electrodes. This is what we're interested in!
The kit is kind of expensive so make sure you either really like the gift recipient, or you really want to experiment with these sensors. What I like about the bitalino kit is how it takes a bunch of really advanced sensors, and puts it in the hands of DIY enthusiasts. From the start it's pretty much plug and play, as the arduino comes preloaded with the necessary firmware. So no need to upload your own sketch, unless you want to of course!
If you want to write your own arduino sketch, you probably already know how to if you've played around with an arduino and basic sensors! If that's something you would like to brush up on do a quick read through on this page.
While we get complex information out from the ECG sensor, acquiring the sensor information itself is easy! The sensor will send analog signals to the arduino. So you can break away the sensor and connect it to any of the analog input pins on any type of arduino. As usual you will get analog values represented digitally in 10 bits. That is to say, the analog values on the input vary between 0 and 1023 (2^10). Really like any type of analog sensor being read to a micro controller.
To get a smooth looking graph you should sample the sensor data at about 10,000Hz. That is ten-thousand times each second. This is easily done by adjusting the delay between each analogRead function in your arduino sketch. To get 10,000Hz you should use this delay: delayMicroseconds(100);
If you transfet the sensor data over the serial connection, use a baudrate of 115200.
Out of the box the bitalino kit comes pre-loaded with firmware to broadcast the sensors information over bluetooth. This means you can use this kit as plug and play, so no coding unless you would like to! This is what I'm going to show you!
Step 3: Parts and Tools
- Bitalino Bio-Sensor kit (EU link)
- Bitalino (US link)
- The heart of the project! This is a sensor kit that actually comes with all the electronics you need to make this project!
- Bitalino (US link)
- Photoshop or Gimp
I used photoshop, but you can also use free photo editing software like Gimp. I've attached files that are compatible in most editing software!
- This is if you want to use my template or make your own poster of your heartbeat
- I recommend printing in color on a thick sheet of paper. This makes the final poster feel so much nicer!
- For you and the project. The coffee will be used to wash the poster, this gives it a brownish-yellow color you often see on old paper. It will definiately give some character to the paper
- This is used for trimming the poster. Makes for a much cleaner look when it finally hangs on the wall!
- Or a fancy one, perhaps you would like to add some writing in caligraphy. The poster template I included certainly has space for that!
Step 4: Software and Connectivity
We need a way to get the heartbeat signals to where we want them. And we want the signals on a computer so we can work with them and make them into a gift. We only need something simple for this porject, and that is for a program to snap up the bluetooth signals sent by the bitalino and saves them as a .txt file. Nothing fancy, just acquire and save signals!
OpenSignals is a free signal processing tool. This is made to receive the data sent by the arduino over bluetooth in the bitalino kit. If you use on of the three most common operating system you're in luck, as this software suite is supported on Windows, Mac OS X, and even Linux! Click here to download OpenSignals.
If you have an Android phone you could also check out BITadroid. I didn't find a specific app for iPhone, but all you need is an app to be able to connect to an arduino over bluetooth and save data sent over the serial connection.
Now turn on the bluetooth on the bitalino, it's as easy as connecting the battery and toggling the only switch you can find on the board. Turn on the bluetooth on your computer or phone and start searching for nearby devices. The sensor kit shows up as bitalino in the list of available devices. Choose this one and enter the password which is 1234, that should be easy enough to remember!
Now open up opensignals and see if it can find your device. When it does you can test out the bluetooth connection by going into the recording option on opensignals. Shake the bitalino board around. It has an accelerator connected on channel 4, so you should get a lot of spikes from the movement!
Now that we've got everything working on the software side we can start to play around with the ECG sensor!
Step 5: Connecting the ECG Sensor
Hookup the three bundled wires to the ECG sensor module on the bitalino board. Now grab three electrode pads and fasten them on the end of the three wires. To hook up the sensor, start by peeling of the protective backing before sticking it on your chest.
Now, there's several different ways to connect the sensor on your body to read your heart beat. I chose the way that was closest to my heart, because it seemed the sweetest and this is a valentines day project after all!
Take a look at the drawing I added to this step. I start by connecting the middle wire right above my heart. Now I take one of the two other wires, it doesn't matter which one, and connect it on the same spot, only mirrored to the other side of my chest. After this I go ahead and connect the last wire vertically down from the first wire.
I guess the pre-gelled electrodes are made to be sued one time and then thrown away, but deispair not! I have connected the same electrodes about 10 times to my chest while making and testing this project. The electrodes are starting to loose some of their glue now. But I think it's so much better to use the pads 10 times each instead of buying new sensor pads every time you want to try out the bio sensors!
You can of course buy new electrode pads, there are twotypes. If any of you find similar pads on ebay or somewhere else for cheaper, leave a comment or send me a message! I would love to find a cheaper source and will update this step if anyone of you can find something that works.
Step 6: DAQ - Data Acquistion
When you're all wired up turn on the bitlaino once more and connect it over bluetooth to your computer or another DAQ tool. Go into OpenSignals and make sure it finds your device. The ECG sensor is configured to broadcast on channel three, so you can uncheck all the other channels for this project.
Here are the other channel types you can choose from:
- Channel 1 = EMG - Electromyography
- Channel 2 = EDA - Electrodermal activity
- Channel 3 = ECG - electrocardiography
- Channel 4 = ACC - Accelerometer
- Channel 5 = LUX - Photodiode
- Channel 6 = Open for your own use
Now you're ready to go out and capture your heartbeat. Just press the record button and watch what happens! That’s amazing isn't it?
You might want to do something special when you're recording your heart. You can record your heartbeat while you give each other a kiss, or when you sit and think about your SO, or read a poem or do something nice. There's infinite possibilities. So just think about what your SO would like to hear, that the heartbeat they see is the heartbeat you had while looking at a nice picture of them, or something like that! I recorded my heart beat after seeing my girlfriend for the first time after a two week vacation.
What you do is completely up to you. Just remember that you should charge the battery before recording the signals you want, and save the signals as a .txt file when you're done! Now find the location where you save the .txt file because it's time to visualize your love!
Step 7: Visualize the Data!
This is where you can get really creative and make the project as personal as you want. What I did was to graph the data in excel and then make a poster in photoshop with an old school graph, some symbolism, and space to write a nice poem I knew she liked. That's just one way of visualizing, you choose what you think is the best way for you. To give you some examples:
At first I thought about 3D printing a phone case with the heartbeat, so my heartbeat would always be close by her. Then I considered 3D printing the heartbeat, and then use it as a stamp on any leather items like purses, keychains, or pencil cases.
If you're wondering how in the world to turn a picture into a 3D printable object, you can either export the graph from excel or screenshot the graph in opensignals. Then take a look at this instructable by snifikino on how to 3D print photos.
If you want to use the poster template I made, you can download it here in both .psd and .pdf format. This means you can open up and edit the template in most available photo editing software! I made the poster template in A3 size (11 x 17″ in the US), and with 600 dpi. This means it can be scaled quite big or as small as you want! Most schools and offices has printers that can print in A3 size or even bigger.
Heres how to graph the sensor data in excel. Open up the program and go into Data and then From text. Now locate the .txt file you saved with your heartbeat, choose Import. Change the value for Start import at row: to 4, this is where the sensor data starts. Now you can click Finish and select where excel should plot the data.
To select the heartbeat data go into the sixth column which is labeled F. Press on the F to select all the data in this column. Go to Insert and under recommended charts choose one of the 2D Charts. Thiswill give a pretty standard looking ECG plot.
Note that if the graph looks to messy you might have selected too much data. To remedy this, simply select less data from the F column before making a new plot. Remember that the bitalino sent 10,000 samples each second. Which means 10,000 rows in excel correspond to 1 second of your heartbeat.
To get the graph into photoshop/gimp, select the graph and click on File > Export > Create PDF/XPS. Save the pdf somewhere you remember and simply drag it into your editing software on top of the template you can download from this step.
I printed the graph on a textured and thick cardstock. This gives the final poster a much nicer feel. After printing the poster was cut and trimmed to a smaller size. I drew a 1cm (0.4 in) border around the printed border and used this as a cutting guide along with a ruler and a sharp hobby knife. While cutting thick paper and cardstock it's a good idea to do several passes with the knife along the cut, not force the knife through the paper all at once. Doing several of these light passes with the knife gives cleaner edge, and we want our hard work to look as nice as possible!
When the poster was cut I mixed up some coffe and tea in a cup and used this to wash over the paper. This makes the paper take on a brownish-yellow color you often see on old paper. I really like this looked. Now if you're going to write anything on your poster, make sure you do this after you've washed the paper and let it dry. If you write something with a pen or pencil before washing the paper, your nice handwriting will wash all over the page making it smudged and hard to read.
After the poster was finished I hung it on the wall with some regular blue tack. I really like how it came out, and I might have to frame this one!
Step 8: Final Thoughts
Congratulations! You've just transformed your loving heartbeat into a work of art, and the cutest gift your significant other has ever received!
As stated in the beginning of this project, this gift might seem complicated but it really is a pretty straight forward process. Now gift away your heart to the one you think deserves it. Just make sure its someone special you don't want to get into the same situation as that song from Wham!