Hi everyone!
Anyway, after receiving the initial order of parts, I quickly got to work by attaching the ECG shield to the Arduino board. I looked through the shield's manual, loaded the manufacturer's sample code onto the Arduino, and ran their PC software to analyze the output from the shield with the probes attached to myself (documentation, sample code, and ElectricGuru software can all be found at https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/).
With the Arduino connected to my computer, I was able to identify a regular heartbeat. This indicated that the shield and probes were functioning properly.
I then decided it was time to connect the LCD screen to the Arduino board. This was to be done using the breadboard and the wires included with it. I quickly realized, however, that the LCD did not have pins attached to it. This resulted in a trip to the local RadioShack, where I obtained soldering tools. I soldered the 16 leads of the LCD to the pins it came with, and then wired it to the Arduino with the assistance of an online tutorial (http://arduino.cc/en/Tutorial/LiquidCrystal). Deviating slightly from the guide, I decided to forego using a potentiometer (which allows for control of the display's contrast) and wired two additional pins to allow for the screen's backlight to be powered. I soon was able to write a "hello world" program (as demonstrated in the tutorial), and show my own output on the display.
At this point, I decided that I needed to understand how the shield outputted data. Searching the internet, I found a very useful post on the shield manufacturer's forums (https://www.olimex.com/forum/index.php?topic=572.0#msg2180). The user Stan12, providing sample code, demonstrated usage of the analogRead() function. Using this, I was able to have the Arduino output a value of 0-1023 (based on electrical signal) over the serial port. I then had the Arduino software's serial monitor receive this data, and exported it to Microsoft Excel to create a graph.
This graph resembles a normal heartbeat, like the one obtained using the ElectricGuru software earlier. This indicates that the numeric output reflects the user's heartbeat.
Now, for debugging purposes, I used the analogRead() function along with the print() function to create a live output of the numeric value outputted by the ECG shield onto the LCD. Of course, the rate at which the shield outputs numbers is much faster than the refresh rate of the LCD, so the number on the screen updates very rapidly - faster than one can read it. However, by lowering the sampling frequency within the code, the number on the LCD becomes human-readable (although making the ECG's outputted data less accurate).
Playing around a bit more with the LCD, I also coded a loading/splash screen that displays while the device is starting up.
Playing around a bit more with the LCD, I also coded a loading/splash screen that displays while the device is starting up.
Finally, since our finished monitor will feature, in addition to Android device communication (a time permitting feature), both audio and visual notification of irregular heartbeat, we needed a way for it to create sound. Enter: the speaker. I connected the speaker we had ordered on Amazon to the Arduino board, and attempted to use the tone() function to create a beep sound. Initial attempts at this failed, and the speaker produced no sound no matter how I changed the code or wiring. I began to suspect a defective speaker, and took another walk to RadioShack to purchase another. Lo and behold, after attaching the new speaker to the breadboard and running my code, there was sound!
I decided to play around with the tone() function a bit, and got the device to play a familiar sound.
Anyway, that's it for now. Next up from me will be discussion about code for detecting an irregular heartbeat, starting to write the Android application, and Bluetooth communication between the devices.
I decided to play around with the tone() function a bit, and got the device to play a familiar sound.
Anyway, that's it for now. Next up from me will be discussion about code for detecting an irregular heartbeat, starting to write the Android application, and Bluetooth communication between the devices.
thanks for this useful article,I,ll recommand it to my friends and I,ll be back again and again,Visit Our blog for more info.
ReplyDeleteVery nice post, impressive. its quite different from other posts. Thanks for sharing.
ReplyDeleteTOSHIBA PVM-375AT