Homework F5: Microcontrollers
Project Setup
I was inspired to connect my interest in the heart to my circuits knowledge. Although btoh are very diverse topics, theres’s a lot of overlap between the two fields. A heart is powered by blood pumping through veins. Similarly, a circuit is able to operate through electrical current flowing through the wires in a circuit. I was inspired by Pulse Sensor to bridge the conneciton of heart beat pulse to my arduino and bread boards.

To start, I connected the pulse sensor to the Arduino and integrated it with a breadboard. Using the pre-existing PulseSensor library simplified coding, enabling me to program the LED to flash in time with the detected pulse. I also utilized this guide to help me further understand what materials I needed and where I should arrange them (wires, resistor, LED light, battery) on the boards.

The pulse sensor was connected to an Arduino, which powered the breadboard, enabling the LED to flash in sync with the pulse. For setup clarity, I connected the black (ground) wire to the breadboard’s ground rail and the red wire to the positive rail.
I also revisited LED polarity: the longer pin (anode) is positive, and connecting it correctly ensures proper current flow. I learned that without the right resistance, the LED could burn out due to excessive current. Calculating the proper resistance is important: too little could damage components, while too much might limit brightness. Typically 220-ohm resistor is used for the LED, ensuring durability. Although other values are optimal, I used the higher resistance as a precaution, since only 100-ohm and 220-ohm resistors were available.
After assembling the circuit, I observed that the pulse sensor’s green light indicated functionality and the LED illuminated, confirming current flow. Adjusting the Arduino code allowed the LED to flash in sync with each detected heartbeat, which was my initial goal.
Troubleshooting and Adjustments
To assist with programming the microcontroller in Arduino, I added the pulse sensor library available in the system. This type of error can occur due to mismatched baud rates, incompatible data types, or unhandled sensor output. Adjusting these parameters and ensuring the data is processed correctly should resolve the issue and display the pulse data accurately.

Initially, the code produced unreadable output, showing question marks and unusual symbols, which likely pointed to an issue with communication settings or data formatting. The baud rate is the speed at which data is sent and received in serial communication, measured in bits per second. It ensures both the microcontroller and computer interpret data accurately by sharing the same transmission speed. When devices don’t match their baud rates, the data can appear scrambled, so setting the correct baud rate is essential for clear, readable data exchange. In the first few runs, I had set the baud rate too low to handle the sensor’s data rate.

Adjusting it from 4800 baud to 9600 baud resolved this and provided a smooth, readable output. Once the output was stable, I noticed that the LED stayed on even when I wasn’t touching the sensor. I analyzed the sensor’s idle output range and modified my code’s conditional statements, setting a threshold so that the LED only flashed when a pulse was detected. Experimenting with this threshold through repeated testing helped me fine-tune the setup to flash in sync with actual pulses.

After successfully getting numerical output from the pulse sensor, I noticed that the LED stayed on even when my finger wasn’t on the sensor. This signaled the need to adjust the threshold value that activates the LED. To fine-tune this, I analyzed the pulse values over several test runs, noting that around 515 bpm corresponded to a heartbeat. When my finger was off the pulse sensor, the values skyrocketed so I correlated this due to the lack of heart beat. This could be due to noise from environmental factors or electrical interference, as the sensor may be detecting random fluctuations instead of actual pulse data. Without contact from skin there’s a less stable signaling source which could’ve lead to the erratic readings. By setting an appropriate threshold based on these readings and comparison value, I ensured the LED would only activate in response to actual pulse data. This improved the accuracy of the feedback system.

Data Stability/Accuracy & Future Enhancements
To improve the stability and accuracy of pulse readings, the sensor should be more tightly fitted to the finger. A tighter fit enhances contact, allowing for a clearer detection of the pulse signal and reducing noise from movement or external light interference. This adjustment will ensure more reliable and consistent pulse readings. secured to the finger to allr tightly to my finger, like adding a glue layer or using a Velcro strap, ensuring consistent pressure for more accurate readings. A valuable insight from this was managing continuous data output. Implementing a pause function could help make the data easier to interpret, and testing the sensor on different body parts, such as the earlobe or wrist, might yield varying pulse readings. Additionally, plotting these heart values to find a mena value for the pulse threshold woud have allowed for a more accurate LED light signaling.
The current output values, which were much higher than a standard BPM, do not directly correlate to actual heart rates. I plan to calibrate the output to convert it into BPM in future iterations.
I’d like to integrate different LED colors to indicate if someone’s heart rate is too high or too low. When testing the sensor on myself and another person, I observed distinct flashing patterns, demonstrating how individual heart rates affect the output.
Additionally, I aim to add a digital display to show the BPM directly. This would improve accessibility, allowing users to see their heart rate at a glance without needing to check software output. Integrating a display would provide real-time feedback, useful in situations where continuous heart rate monitoring is essential.
In future iterations, I’d like to integrate a digital display so users can see BPM without software, enhancing usability by providing immediate feedback.
With further optimizations, this microcontroller could allow for users to monitor their health at home and better understand their body, and see if their heart rate is within a healthy range or not. This application allows real-time data collection and automation, giving the user more power for their biometrics. Additionally, this feature has the power to increase the safety and well-being of individuals.
Recent Comments