I'll Show You My Heart!

by andrei.erdei in Circuits > Sensors

2536 Views, 13 Favorites, 0 Comments

I'll Show You My Heart!

main.jpg

The phrase from the beginning of the announcement for this year's Heart Contest gave me the idea of this project, to try to show my heart the way it is, and those around us will show their hearts as well.. And no one will be able to hide their feelings again! 😍

What can be more beautiful than expressing our deepest feelings!

You can show everyone how big and beautiful your heart is!

It is not difficult at all if you use a heart rate sensor, an ATtiny85 microcontroller, a string of micro leds, some decorative elements and other small parts.

It's so easy 😊

Components, Materials

sensor1.jpg
sensor.jpg
controller+socket.jpg
proto.jpg
leds.jpg
hearts.jpg
switch.jpg
resistors.jpg
badge_clip.jpg

The components and Materials I used:

- Heart rate sensor - I don't know if this sensor (bought by me) is an original one but it works well :)

- Atmel ATtiny85, 8 Dip socket, prototyping board - any type is OK because it is used with 8 MHz internal clock;

- Decorative micro Led string - mine has 20 leds and 2xAA battery holder with some electronics inside. I used this last Christmas 😊

- 100mm decorative acrylic fillable heart;

- Panel mount slide switch;

- 2x47Ξ© resistors;

- Badge holder clip and some keychain rings;

- Wires, heat shrink tubes;

That's it!

The Heart Rate Sensor

This is the main component, for this project I decided to use the cheapest sensor option, namely the one from pulsesensor.com.

There are many videos on YouTube, articles on the net about using this sensor, here on the instructables you can find very good articles: Pulse Sensor With Arduino Tutorial and Talking Arduino Heart Rate Monitor for example. What struck me, however, is that very few things are said about the fact that there are problems as many counterfeit sensors are sold. Although they are sold at the same very low price, some sensors work without any problems at all.

I had the same problem.

I bought 10 sensors from three online electronics stores and tried them as I received them. For these tests I used the library from pulsesensor.com that you find on github. I installed this library in Arduino IDE and uploaded the "GettingStartedProject" to an Arduino UNO. Here's what I got when I ran the view in the serial plotter:


Notice that it can be detected only a kind of rhythmicity in the signal. A very noisy rhythmicity.

I tried then the "PulseSensor_BPM_Alternative" example of the library but it can be seen in the output that the results were inconclusive as the measured values are way to wrong.

I received the last four pieces of sensor a few days later and I could not wait to try them. As you can see the (good) sensor looks a little different from the previous (bad) ones.

To my delight the results were very different, very good right from the start, and the pulse rate is very well measured.

I tried to find explanations for this fact and found some on the net, if you are interested in why some sensors are ok and others are not, you can read the articles below.

Reel Crime: The Pulse Sensor Counterfeit LEDs Story

Problems using heart beat pulse sensors

Heart Rate Sensor

I also tried sensors from the MAX3010x series with the sparkfun_max3010x library, the results are more stable but with these modules I had other problems, they are more expensive and they use two pins of ATtiny85 (because the communication is done on I2C) and so the program is much bigger and the consumed RAM memory is higher. Maybe I will use them in another project.

Meanwhile I stuck with the PulseSensor module (those that work well ?)

Electronics and Software

schematic.png
test.jpg

The schematic is in the picture above.

As you can see the electronic scheme is extremely simple. The microcontroller receives the signals of the heart rate sensor and at two digital outputs several LEDs are connected in parallel. The entire assembly is powered by two AA batteries. In the next step you will see that I reused the battery pack of the decorative LED string and I divided the LEDs into two groups of 10.
Regarding the software, after checking the proper functioning of the pulse sensor on an Arduino UNO (see the previous step) I went to test all with an ATtiny85 and the 3V power supply. You can see the test assembly is in the picture above. In order to use Serial Plotter from Arduino IDE I used the code below:

#include <SoftwareSerial.h>
// Variables
int PulseSensorSignalPin = A1; // Pulse Sensor S connected to ANALOG PIN 1 (physical pin 7)
int Signal;             // holds the incoming raw data. Signal value can range from 0-1024
const int TX_PIN = 3;   // Using software serial 
const int RX_PIN = 4;
//
SoftwareSerial pulseUART(TX_PIN,RX_PIN);
//
// The SetUp Function:
void setup() {
	pulseUART.begin(115200);
}
// The Main Loop Function
void loop() {
	Signal = analogRead(PulseSensorSignalPin);  // Read the PulseSensor's value.                   
	pulseUART.println(Signal);                    // Send the Signal value to Serial Plotter.
	delay(10);
}

After programming the controller with this code, I got the results below (for programming the ATtiny85 microcontroller check my article "ATtiny85 Programming With a Programmer Board and USBasp").

You can see that at 3V the sensor works very well, the shape and the rhythm of the signal are very good and the threshold value of 550 is ok. So I loaded the final program which is nothing but the "PulseSensor_ATtiny85_Serial" example from the PulseSensorPlayground library (don't forget to install it in Arduino IDE) I only commented out the pulseSensor.outputSample() line.

This way I could see the BeatsPerMinute (B) and InterBeatIntervalMs (Q) values read by the sensor and I obtained the values as in the picture below.

Nothing else needs to be added to the program, the PulseSensorPlayground library takes care that when the output pins are defined for the blinkOnPulse() and fadeOnPulse() functions, then the respective outputs can be used to light up some LEDs.

Only one observation related to this fact. The two groups of LEDs are connected according to the schematic to the pins defined as the "blink" and "fade" pins. Thus 10 LEDs wil have a short blink effect and the other 10 will have a fade effect at each heartbeat. But they can be tied together, all 20 LEDs either to the "blink" or the "fade" output. Consumption on 10 LEDs, at 3V with a 47 ohm resistor is 9mA, so the output can carry without problem this double current consumption (the maximum is 40 mA). I tried all three possibilities and finally I tied all 20 LEDs to the "fade" pin. Seems to be prettier ?

Construction

battery_holder_1.jpg
battery_holder_2.jpg
switch.jpg
board.jpg
battery_holder_3.jpg
battery_holder_4.jpg
leds.jpg
assembly.jpg
assembly_1.jpg

In the photos above you can see step by step how I made this project. Mostly these were the stages:

- I removed the electronic circuit and cleaned the remaining place of plastic parts to make room for my circuit;

- I cut a small rectangle on the side of the box so I can mount the switch;

- I made the electronic circuit and made the connections;

- I programmed the micro-controller and put it in the socket and I put the batteries in place too;

- I cut the LED string in two (10 LED's), to the anodes (the digital outputs of the micro-controller) I soldered the two resistors of 47 ohms and I tied together the cathodes;

- I drilled the plastic heart in the lower part, I inserted the three wires (red-arteries, blue-veins, green-nerves 😊) and I made the connections inside the decorative plastic heart;

- I connected the pulse sensor, I put a piece of heat shrinkable tube on it, I heated it to tighten a little, so the sensor will be protected from dust, moisture and direct contact of the fingers;

- I glued the sensor to the box with a hot glue gun;

- I attached the key rings to the plastic heart's hanger and mounted the badge clip on them.

Done!

Conclusion

I uploaded a video to my channel on YouTube where you can see how the device works.

Please note how emotional and loving I am and how calculated and calm my wife is 😊. I suppose you want to see how your loved one feels tooπŸ™‚.. Then it only remains to build my project.

If you have any questions I'll be here to answer them.

Please bear in mind that this device cannot under any circumstances be considered a medical device.

And because I published this project today on the International Women's Day I dedicate this project to all women and I wish them only good things, the fulfillment of all desires and to only have part of people with a sincere (transparent πŸ™‚) heart.

I hope you like my idea and I hope you will support me in the Heart Contest.

Thanks a lot!