1. Understand how the temperature sensor works and how to use the StartSwitch node correctly.
2. Learn how to connect temperature sensor and buzzer in order to make a temperature alarm.
3. Learn how to set up the nodes.
Whether it is a hot summer day or a dry winter night, fires are a common disaster that few can anticipate. We plan to put our temperature alarm in appropriate places, alerting people that there could be a potential fire nearby. It can help lessen the chance of a fire spreading and can even save lives!
Picture 1: Temperature Alarm
The key goal of the temperature alarm is to obtain the environment's temperature. Once the data is higher than a certain set figure, the buzzer will sound. If a certain temperature is not reached, the buzzer doesn't engage. This requires the temperature sensor to receive continuous temperature data. The entire project analysis is shown in Figure 1.
Figure 1 : Project Analysis- Temperature Alarm
Obtain the temperature and trigger the buzzer once it is higher than a pre-set value
Arduino/Genuino101, Extension Board, Temperature Sensor, Buzzer
A. Temperature sensor
We used the LM35D (Picture 2) to quantifiably detect the environment's temperature. The LM35D is a linear temperature sensor made by National Semiconductor of America. With rated features of -40 ℃ to 150 ℃ ranges, linear 10 mV/℃ scale factor etc., it is easy for the LM35D to reach the requirements together with the Arduino/Genuino101 extension board.
Picture 2: Temperature sensor
The digital buzzer (Picture 3) is a simple voice device of the Arduino/Genuino101 sensors. It is driven by the simple signals of low and high output. This type of buzzer is essential in all warning and alarm systems.
Picture 3: Buzzer
Once we have all the equipment prepared, we can connect the Infrared Tempature Sensor, the buzzer, the Arduino/Genuino101, and the extension board, as display in Picture 4. Here we connect the tempature sensor to the analog pin A0, and the buzzer to digital pin 8, also shown in Picture 4.
Picture 4: Connection of temperature alarm
To make the tempature alarm, we need to judge the real-time temperature. Once it's over a certain value, the buzzer will sound.
Picture 5: Programming behind the temperature alarm
C. Set up
We need to add a StartSwitch node to obtain the temperature of the surrounding environment. Once the SCM is energized, the temperature sensor will turn on. Double-click the StartSwitch node, and a pop-up window (Picture 6) will appear. Set it as Picture 6 shows.
Picture 6: Setting up the StartSwitch node
The DFTemperature node is used to set the parameters of the temperature sensor. Set the analog pin to A0 and the time interval to 1000ms. As shown in Picture 7.
Picture 7: Setting up the DFTemperature node
Double-click the switch node to set the critical value. Also displayed in Picture 8, click the "+rule" button at the botton, choose"<" and fill in "30" to create point 1, then add another rule: choose ">" and fill in "30" to create point 2". To make the program more readable, we may also name the node as we'd like.
Picture 8: Setting up the Switch node
Add a change node to trigger the next node once the light outside is lower than a certain value. Double-click the change node and set it like Picture 9 suggests. It will control the buzzer to work.
Picture 9: Setting up the Change node
We use Buzzer node to set the DFBuzzer module’s digital pin as picture 10 suggests.
We use the DFBuzzer node to set the buzzer's digital pin as Picture 10 suggests. As a result, when temperature reached a certain value, the buzzer will start beeping.
Picture 10: Setting up the DFBuzzer node
Click "Deploy". You can try change the temperature around the sensor in order to test if the temperature alarm is working as expected. If not, ask your friends or simply post your question on our forums!
Last but not least, don't forget to share your work and learning process with your friends and colleagues!
The programming behind the temperature alarm seems a bit complex at first, but it's quite simple once you understand the logic behind it. Considering the working time of the temperature sensor, do you think we can chang ethe StarSwitch node to the Button node? Tell us what you think!