<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Piezo Stethoscope
In this module we will be creating a sthethoscope to monitor our heartbeats via a piezosensor and learn how log and read data. The idea is that if you tape a contact microphone directly to your skin, it will pick up on your pulse and generate a voltage every time your heart beats. We can then view this voltage-plot in real time as well as logging the data to a SD card so it can be analysed later. Using a piezoelectric sensor has been trialed in real clinical settings to as an inexpensive method to monitor heart rate, respiration rate, and other vital functions of the body. 
Materials Needed
Raspberry Pi
HAT Board //insert actual name here
Contact microphones
One SD card
Steps Outline
Connect the HAT Board with the Raspberry Pi and insert the SD card
Insert the contact microphones into the inputs of the board (up to four)
Set up any code necessary to view the plots in real time
Run the sensor display and wait until all the channels produce a steady signal
Start the data logger and wait about one minute
Stop the logging and remove the SD card
Analyse the data to find out the heart rates of the connected students 
Write code to detect peaks and automatically calculate the heart rates
Set up the device as indicated in the outline above. Have the students whose heart rate will be monitored tape the piezosensors onto the pad of their thumbs. Do not tape it too softly, or else it won't correctly pick up the pulese. Do not tape it too tightly as to break or crack the sensor either.
In this section we will set up the code to view the voltage in real time and learn how to use the sensor display library. Firstly, we have to import the library (SensDisLib) and create a new instance of it. Do this below.
Step1:  Now we have to add to our display the channels that are connected. We can do this by the add_sensor_X("Name") method. For example, if we wanted to view channel four and call it "My Heartbeat", we would call .add_sensor_one("My Heartbeat"). The variable we call in the constructor ("My Heartbeat") will be name of the graph that is displayed. Write the code to view the sensors that you want to use below.
Step2:  Now run the it via the runPlot() method.
Step3:  You may notice that you don't see a very strong signal and the line is flat when you are sitting still. This is because the default voltage (y- axis) range is zoomed out to (0, 4096). However, we can modify this with the setYRange_sensor_x(low, high) method. For example, I wanted to zoom in on the voltage range (500, 700) on channel two, I would call setYRange_sensor_two(500, 700). Look at the plot and estimate a reasonable range to zoom on onto (about ±150 volts of the steady voltage) and set this for the necessary plots. Make sure you write this code before you call runPlot(), or comment it out above and write it again.
<ASSISTANT_TASK:>
Python Code:
import SensDisLib as s
plot = s.SensorDisplay()
Explanation: Piezo Stethoscope
In this module we will be creating a sthethoscope to monitor our heartbeats via a piezosensor and learn how log and read data. The idea is that if you tape a contact microphone directly to your skin, it will pick up on your pulse and generate a voltage every time your heart beats. We can then view this voltage-plot in real time as well as logging the data to a SD card so it can be analysed later. Using a piezoelectric sensor has been trialed in real clinical settings to as an inexpensive method to monitor heart rate, respiration rate, and other vital functions of the body. 
Materials Needed
Raspberry Pi
HAT Board //insert actual name here
Contact microphones
One SD card
Steps Outline
Connect the HAT Board with the Raspberry Pi and insert the SD card
Insert the contact microphones into the inputs of the board (up to four)
Set up any code necessary to view the plots in real time
Run the sensor display and wait until all the channels produce a steady signal
Start the data logger and wait about one minute
Stop the logging and remove the SD card
Analyse the data to find out the heart rates of the connected students 
Write code to detect peaks and automatically calculate the heart rates
Set up the device as indicated in the outline above. Have the students whose heart rate will be monitored tape the piezosensors onto the pad of their thumbs. Do not tape it too softly, or else it won't correctly pick up the pulese. Do not tape it too tightly as to break or crack the sensor either.
In this section we will set up the code to view the voltage in real time and learn how to use the sensor display library. Firstly, we have to import the library (SensDisLib) and create a new instance of it. Do this below.
End of explanation
plot.add_sensor_one("Person one")
plot.add_sensor_two("Person two")
plot.add_sensor_three("Person three")
plot.add_sensor_four("Person four")
Explanation: Now we have to add to our display the channels that are connected. We can do this by the add_sensor_X("Name") method. For example, if we wanted to view channel four and call it "My Heartbeat", we would call .add_sensor_one("My Heartbeat"). The variable we call in the constructor ("My Heartbeat") will be name of the graph that is displayed. Write the code to view the sensors that you want to use below.
End of explanation
#plot.runPlot()
Explanation: Now run the it via the runPlot() method.
End of explanation
plot.setYRange_sensor_one(1800, 2100);
plot.setYRange_sensor_two(1800, 2100);
plot.setYRange_sensor_three(1800, 2100);
plot.setYRange_sensor_four(1800, 2100);
plot.runPlot()
Explanation: You may notice that you don't see a very strong signal and the line is flat when you are sitting still. This is because the default voltage (y- axis) range is zoomed out to (0, 4096). However, we can modify this with the setYRange_sensor_x(low, high) method. For example, I wanted to zoom in on the voltage range (500, 700) on channel two, I would call setYRange_sensor_two(500, 700). Look at the plot and estimate a reasonable range to zoom on onto (about ±150 volts of the steady voltage) and set this for the necessary plots. Make sure you write this code before you call runPlot(), or comment it out above and write it again.
End of explanation
<END_TASK>