Introduction: Heart Monitor
This project will give a reading of temperature and pulse. The Bluetooth module will show the physical data that is going into the Atmegas to produce result. The results will be shown in binary and the numbers should match with bluetooth data.
The user will hold the pulse sensor, put their finger on the IR sensor, and temperature sensor. Then there will be a slight wait time and data will be read then displayed. The parts will work together to give a reading.
Step 1: Buy Parts
You will need to have these parts accessible to you in order to complete the project. All parts can be bought from the internet:
The basic parts are:
1 Power supply
1 jumper wire set
Pack of LEDS
LED network bar
2 103 capacitors
Pack of resistors: 330ohms is enough
1 IR Reflective sensor
2 Atmega1284 (microprocessor)
1 pulse sensor
2 LM35DZ temperature sensors
Step 2: Understanding Parts: BreadBoard
A breadboard has the regular pins that are connected horizontally so do not connect components horizontally, make sure they are connected to the board in a vertical manner. The power pins are connected vertically. Placement on a breadboard so pay close attention on how you connect parts and power supply.
Use the Jumper wires to connect pins to other pins. The jumper wires are called jumper wires because they jump the power and connection from one pin to another.
If further assistance is needed please review website.
Step 3: Atmega1284: Microprocessor
You will need two of these, one for receiving data and the other sending and outputting data.
This is what you will be programming in order to make your project. So when you use code, you will program that code onto this device and see the results. The reason you will need two is because we will be using a communication between the two atmegas called USART or known as Universal Synchronous/Asynchronous Receiver/Transmitter. Please look at the picture for reference for pinouts.
Before starting a project, please make yourself knowledgeable with the components and how they are wired.
Here is an in depth guide for an Atmega1284
Step 4: Programmer: AVR
You will need to download software in order to write code and program this properly.
For the code to work you will need headerfiles that you will add to library. How to do this. download the files into a folder, then go to properties and then directories and add.
Follow this link for headerfiles:
For the sake of this project, you will input the code, go to press build and then go to tools -->device programming and then program the code onto the Atmega1284 that is on the board. Make sure to check wiring and position of hardware when programming.
The software is Atmel Studio 7.0
then click Atmel Studio 7.0 (build 1931) web installer (recommended)
Your download will be processed. Once you have application then you will go to projects and executable C language.
Here is a tutorial video of how to use Amtel studio
Step 5: Power Supply
Power supply is important, make sure to check the board has power going throughout the board. Then place power supply on board correctly. If you are unsure, please take a moment to check positive and ground are where they need to be.
Once board is all connected and ready to go turn on power. If there seems to be a problem check wiring. Then check to see that the power supply is not broken.
Step 6: Pulse Sensor
The pulse sensor is the sensor that will read in the data of a heartbeat. You can simply plug in ground and power to see if the pulse sensor works properly by see if power is being run through it. This is how you test if your component is still good.
Wiring this component is not difficult at all. It has the output and then power and ground. You would hook up the wire of out to the pin on your Atmega that your code would read the sensor.
In the case of the code that will be given, I used pin A0 of my Atmega 1.
If you need more guidance or are looking to do a completely different project using this sensor here is a helpful link:
Step 7: HC-05 Bluetooth
This is a more difficult part to use.
How to wire to board:
There are 6 pins on the module, you will be using only 4 of them. Ignore STATE and EN. There is a VCC and GND wire those to their proper places. The RXD and TXD will be wired to the ATMEGA1284 2. It will be wired to PORTD- RXD---> D03 and TXD--->D02 the reason it is wired to those ports in particular is because the D03 is TX and D02 is RX. Which means the communication of transmitting and receiving are being communicated between the bluetooth and the Atmega.
Download the app "serial bluetooth"
Then once everything is powered and connected, search for HC05 on your app. Then it will say pair. There will be a need for a password its either 0000 or 1234. This shows if your bluetooth is working. You will also see a red light beeping fast if it is not connected and beep slower once it is.
The bluetooth will be used as a communication to physically see what the data is being input into your atmegas to produce an output. It also serves as way to check your number to see if they are correct with the output on the LEDS.
Step 8: IR Reflective Sensor
Just like the pulse sensor, the wiring is simple.
VCC, GND, OUT
You will connect the out to the pin you will be using to have the data read. In the case of the project I used pinB0 on the Atmega 1.
The reason for this component is that it will make your results more accurate by telling when your skin is in contact with the pulse sensor and will help to not give false readings.
You can test if this is a working component by plugging in the power and gnd to see a green light. if it is not on. your part may be broken.
Step 9: Temperature Sensors
You will needs two of these because one will not give appropriate readings.
The wiring is simple. VCC, GND, OUT.
In this project, the wiring is pin A1 and pinA2 for the temperature sensors. These will take the temperature data in and then be displayed on the bluetooth application and LEDs.
Step 10: LEDS
LEDS are simple to wire up they have power and gnd. They will need resistors. 330ohms is fine which is shown in the picture.
The LEDS are hooked up to the port you will be using as output and show results. In the case of this project, PORTA and PORTC of Atmega 2 are used. The yellow strip in the picture you see is a resistor network which is the same as using mulitple resistors but in a compact sense.
The shorter leg of the LED should be going towards the GND and with the LED bar, the side with no writing will be the GND side.
These components will show the average temperature and heart beat in binary. In the case of this project, the LEDS are showing pulse while the LED bar is showing temperature. You can check if the number in binary is correct by looking at the data the bluetooth module is receiving.
Step 11: Code: Atmega 1
Use this code for your Atmega 1 which is your transmitting Atmega which will then send the data over to Atmega2 using USART.
Don't forget headers. Check wiring. An above diagram is shown.
Feel free to modify the Code if you are advanced enough, see what happens :D
Step 12: Code: Atmega2
Use this code for you Atmega2 which is the receiver that will output the DATA.
Don't forget headers. Check Wiring
Feel free to modify the Code if you are advanced enough, see what happens :D
Step 13: Debugging
Make sure your board is wired correctly. Use pictures above.
Take apart entire board and start over with wiring
Make sure your components works, easiest way is to plug in VCC and GND to see if the light to the component lights up. For the components with no light, plug in an LED to make sure component can light the LED up.
Check to make sure your headerfiles are correct.
Build your program, fix any errors in program before trying to program onto the Atmegas1284
Sometimes take a step away for a little bit and come back.
Step 14: Complete
Now that you have your codes and your wiring correct you have a basic heart monitor!
Since this is basic, you can learn to do more projects using these devices. You may even look to use different processors or even make this project more complicated by adding in features.