In this article we will setup a Particle Photon module to monitor temperature throught the SI7020-A20 temperature/humidity mini module sensor. Based on readings from this sensor we will turn on a buzzer alarm to warn the user of a high or low temperature. This Library is intended to be used in conjunction with the Control Anything article Temperature_Alarm. The intention of this library is to make use of the SI7020-A20 Temperature/Humidity Sensor and PCA9536_I2CBZ I²C Mini Modules with Particle development web IDE as simple as possible for users.
How to use this library
This is a fully implemented Library and is intended to be used as is. Users may modify and use the library in any way they see fit. The intended use is to search Community Libraries under Particle's WEB IDE for Temperature_Alarm. Once found make sure the application tab is selected, then click Use This Example button on the left. Then flash the firmware into your Particle Module. For more information see Particle's documentation.
What it does
This library does two things. It monitors the temperature using the SI7020-A20 temperature sensor. Secondly it turns a buzzer on to indicate an alarm situation. The alarm can trip when a temperature gets too high or too low. The firmware publishes a function called AlarmLimit which takes a string argument. This argument sets the alarm limit to turn the buzzer on. The formwat for the alarm is for example: high;200.00 low;32.00 The first part of the argument indicates whether the alarm should trip when the temperature is above a limit or below a limit. If high is passed as the first part the alarm will turn on when the temperature gets too high. If low is passed as the first part the alarm will turn off when the temperature gets too low. The second part of the argument is the temperature limit. This should be a decimal formatted temperature such as 75.00 The first and second part of the arguments should always be seperated by a semi-colon as shown in the examples above. This firmware also publishes the current temperature as a variable on Particle's server.
Step 1: What You Need
For this setup you will need 4 components:
A Particle Photon Module: https://store.particle.io/collections/photon
Temperature Sensor Mini Module(SI7020_A20): https://www.controleverything.com/content/Humidity...
I2C Buzzer Mini Module: https://www.controleverything.com/content/Digital-...
Particle I2C Interface Board: https://www.controleverything.com/content/I2C-Mast...
Step 2: Setup Your Particle Photon and Account
Using I2C cables connect the two mini modules to the I2C interface board and insert the Particle Photon module into the I2C Interface board. Then connect the Particle Photon module to a USB power source such as your computer.
Follow instructions from docs.particle.io to setup your Particle Photon module for your WiFi network and associate it with your Particle Account so we can interface with it and flash in firmware.
Step 3: Flash the Firmware
Go to build.particle.io/build
Click the Target Icon on the left and make sure your Particle Photon module is connected and selected here.
Click on the Libraries Icon on the left, then search Community Libraries for Temperature Alarm. Make sure the application.ino tab is selected, then click the Use this Example button.
Click the Flash button on the left to flash the firmware into your controller.
Step 4: Set Your Temperature Limit
Go to mobicle.io and sign in with your Particle Credentials.
Click on the controller from the Device List.
Click the AlarmLimit function from the Function List and enter your alarm limit as the argument. If you want an alarm when the temperature gets above 200.00 F then enter high;200.00 Alternatively if you want an alarm when the temperature gets below 32.00 F then enter low;32.00 Then just click the Send button and your alarm limit is set. Always make sure to put that semi colon in-between the high/low and your temperature in F.
Step 5: Test It Out
For testing I set the alarm limit to just above the shown temperature in the Mobicle.io temperature variable and then I placed my thumb or finger over the temperature sensor and the buzzer triggered.
Congratulations, you are done!