[Interaction 1] Prototype: Heartbeat Sensor

Initial Experiment [Stage 1]

Based on the initial experiment, the heartbeat sensor is affected by outside factors and pressure which cause the LED to blink randomly even though there's no heartbeat. Thus, I start to look for code sources that measure a more accurate detection of heartbeat & BPM.

I have experimented with 3 different codes from 3 different sources. However, the number of BPM values is not stable as it will jump from 0 to 300 randomly. Another problem is that when I place my finger on the sensor, it should detect my BPM which ranges between 60- 78, however, the BPM value doesn't change as well when I monitored through the serial monitor.

Source 1:



Darrah, K. (2013) HowTo: Heart Beat Monitoring! Arduino/Processing. Youtube. Aug 24. Available at: LINK

I try to implement the code and modify based on my heartbeat condition. The results seem doesn't work in my case. The BPM will jump randomly and the LEDs blink randomly even though the heartbeat is not in ranged. I also find it hard to understand the code here, so I'm not going to further amend the code. 


Result





Source 2:




Based on this code, I understand the code is to get the heart rate first and only convert it to BPM. The calculation to get the heartrate is to get the current data (millis) and deduct the older ones then compare it with a normal heart rate interval. However, the weird thing about this code is that when I try on the detection, my BPM turns 0 and no heartbeat is calculated at the same time.

Result





Source 3 (Reliable):





Yury & Joel (2018) Pulse Sensor Amped. Available at: LINK

Challenges

I'm more familiar with this source as it has a very detailed explanation from Yury and Joel (2018). The code utilizes interrupt() to replace the data once new data has been detected. I understand better on this as my previous project had worked on something which is related to receiving coming data and replacing it using the interrupt. However, there are some problem is that the BPM value is not stable when the code is running. I tried to debug it but it's very weird that the BPM value keeps jumping randomly as there is nothing wrong with the code. 

Problem Solved

Initially, I thought the problem is due to the code or the function of the heartbeat sensor. The problem ended up was due to the wiring and stable placement of Arduino Uno and the heartbeat sensor. I have sticked the heartbeat sensor and Arduino Uno on the table with tape and changed all the wires that connect the Arduino and heartbeat sensor. In the end, the code works fine after testing it out with my own modification.

Result


In the video, the code detects a stable BPM from the user. When the user's heartbeat rate ranged between 60 -120, it will trigger the LEDs to blink based on pulses. Thus, the code is ready when I start to work on the motors and LEDs strips in the future.

Problem [Stage 2]

The heartbeat sensor not working with the code from 3 different sources.

Main Challenge 

The main challenge of this interaction is the stability of the heartbeat sensor. Unfortunately, what I have done previously is wasted as the heartbeat sensor does not work as the counting of bpm will only be counted when higher pressure is exerted on. Thus, I recode for the heartbeat sensor from scratch as the code from open source are unreliable at this moment. In terms of hardware, the connection should connect a 100micro Ampere capacitor and 220 ohm resistor for noise reduction. Without the capacitor and resistor, the heartbeat sensor could not detect low pressure as there are too many noise. Here are the code for reference: 




Hardware


Component needed: 
Heartbeat sensor 
220 ohm resistor
100 Micro Ampere

** Remember to connect ground to ground wire**

Problem Solved

The problem is 70% solved. The main issue for the detection right now is that the interaction will be delayed for 17 seconds for data collection of the heart rate. Besides, there will be noises sometimes during the detection but it only happens sometimes due to the environmental pressure. However, it is working most of the time.

Conclusion

The technical part for the detection is finally 70% done after weeks of debugging. Thus, the next plan is to connect everything between master and slave Arduino for the setup.

Comments

Popular posts from this blog

[Interaction 1] Flower-Blooming Mechanism Development Challenges

Final Prototype: Night-Blooming Flowers Physical Light Installation