If you just got a Bolt IoT Platform starter kit then this project will help you build your own temperature monitoring system using Bolt.
- Bolt IoT Bolt WiFi Module
- LM35 IC
- Jumper wires (generic)
- Bolt IoT Bolt Cloud
In today’s modern world, most of the products that we produce have a very crucial factor affecting it i.e. temperature. Starting from the traditional crops to the artificial ones in food industries, from drugs to chemicals manufactured in the pharmaceutical industries, all of them need the right amount of temperature to be maintained for manufacture which is why the monitoring of temperature constantly is an indispensable part of these sectors.
Our homes too have thermostat installed which monitor and regulate the temperature. Maintaining the right temperature is required for having a healthy growth of plants. If the right temperature is not maintained, the plants will die.
Using this project, you will be able to build such a monitoring system where you will be able to monitor the temperature of the environment in the form of visual graphs. This project can then be extended to predict the future sensor values via Machine Learning over the Bolt Cloud.
Here is what you need for the project. All of these components are included in the Bolt Starter Kit.
- Bolt WiFi Module
Bolt WiFi Module
- LM35 IC (Temperature sensor)
Before you move to the Step 1, make sure that your Bolt WiFi Module is connected to Bolt Cloud and the green LED on Bolt Module is Glowing. If not then follow the steps in this project to setup the device: Setting Up the Bolt WiFi Module
Follow the connections as mentioned below. It as easy as saying 1,2,3. You can refer the pin out of the LM35 sensor as shown below,
Make sure you have not powered on your Bolt Module white connecting the circuit. This will ensure that in case we make any mistake, it will not short circuit your device. Switch off the power if it is connected.
Connect the VCC pin of LM35 to 5V pin of the Bolt device.
Connect the GND pin of LM35 to GND pin of the Bolt device.
Connect the analog output pin of LM35 to A0 (analog input) pin of the Bolt device.
Connecting LM35 to jumper wires
Connecting jumper wires to Bolt
LM35 connection to Bolt
NOTE: Make sure connections are made properly. Ensure that there is no short-circuit in the connections. Use jumper wires for ease in making connections.
Congratulations, we are done with the hardware. See how simple it was. Let's move on to the next step.
Skip this step, if you already know how to connect your Bolt device to the Bolt Cloud. To check if it is connected to cloud, have a look at the Green coloured Cloud LED on the Bolt WiFi Module. It should be glowing.
Follow the steps in this project to setup the device and to connect your Bolt device to the Bolt Cloud.: Setting Up the Bolt WiFi Module
Yes. I am aware that we have repeated this step. But we realised that many users tend to miss out on this step so wanted to be double sure about it. Now that our Bolt is active, we are just a step away from completing the system.
Now we need to visualise the temperature data on the Bolt cloud. For this create a FREE account on cloud.boltiot.com if you have not already.
Just follow these simple steps:
- Login into https://cloud.boltiot.com and click on the 'Product' tab.
Go to Product tab
- Create a new product for your temperature monitoring system. Products are created once and can be used for multiple Bolt devices. This ensures scalability for your IoT products you build on Bolt.
Note: Product names can only have alphabets, numbers, and underscore ( _ ) as a special character. Spaces are not allowed.
- Click on Configure this product to configure the product. This will open a popup where you can configure your products hardware setting and write the software code.
- Click on the "A0" pin of the Bolt and give it a name in the right side naming section. Finally, click on the "Save" icon to save your change and wait for the page to reload.
- Click on the Code Section then click on the "Import Code example" icon as shown below. This will open a pop-up menu where you can choose the variable. In this code since we have connected only one sensor, you could simply choose the only variable in the dropdown and press OK.
- Now you will be presented with a variety of graphs to choose from. Choose the "Line Graph" and then click on the "Import" button.
Now let me explain each line of the code so that you could make suitable changes as you wish.
setChartTitle function sets the Title of the Chart/Graph. Give a suitable name for your graph here which will be shown in the heading of the page. This is different from the name of the code file.
setChartType function is where you choose which type of chart you want i.e. Line Graph, Bar Graph etc.
setAxisName will set the name for the X Axis and Y Axis
plotChart is where you choose which variable you want to choose in your chart.
- Next, we will need to convert the raw sensor value received to degrees. For this, we will need to multiply the raw sensor value with 0.0977. An explanation for this is given towards the end of the project.
For multiplication, we use the 'mul' function. Just enter the line mul(0.0977) before the plotChart function. This will multiply the sensor value received with the multiplication factor.
Converting Temperature reading to Fahrenheit
The formula for converting temperature from Celcius to Fahrenheit is,
F = 1.8*C + 32
So, to show the reading in Fahrenheit, we will need to multiply the sensor reading by 1.8 and add 32 to it.
NOTE: There is a minor issue in our graph library which causes an error in calculation. Hence we have made some modifications to the conversion formula to handle the error offset in the code below.
Hence the code for this, will look similar to,
setChartTitle('Your Graph Title');
- Now write the file name for your code and choose the file extension as "js".
Finally, click on the "Save" icon to save the changes to the product.
- Now, our product configuration is ready, but we need to "link" a bolt device to the product so that the Bolt can actually start sending temperature data.
Click on the link tab
Choose the Bolt
- Now, we need to deploy the code to the Bolt device. Deploying will transfer the code and configuration to the Bolt device. Its similar to programming an hardware device like an Arduino. Except here the programming happens over the internet.
- That's great you say. Now how do I see the temperature? For this, you will need to click on the "Computer Monitor" icon on your Bolt device.
View the plot
This will open up a new page which will have a graph. Every 5 minutes, the Bolt will send a temperature reading to the Bolt Cloud.
If you see a blank graph, wait for a few minutes for the device to send the sensor reading to the cloud. If you don't want to wait then you could press the push configuration button again. Every time you click on that button it sends the current sensor value to the graph. It's a manual method that can be used for testing
As the cloud collects more data, the graph gets plotted and you will be able to see the temperature variations across the day.
The working principle of the system is quite easy. Let understand it.
Here in our system, LM35 is the sensor that senses the temperature of its environment and based on it's value it generates an analog output voltage. This analog voltage produced by the LM35 is then given as input to the Bolt A0 pin. The Bolt then converts the analog value into a 10 bit digital value that varies from 0-1023. This digital data is sent to the cloud via Bolt device.
Hence, while plotting the temperature, it is required to convert the raw sensor values into the actual temperature value, which is done using the given formula:
temp = (analog_value100)/1023*
The converted digital data is then plotted for visual representation.