Room Temperature Prediction Via LM35 Sensor and Machine Learning
by mani2474695 in Circuits > Sensors
3343 Views, 7 Favorites, 0 Comments
Room Temperature Prediction Via LM35 Sensor and Machine Learning
- Introduction
Today we are focused on building a machine learning project that predicts temperature via polynomial regression.
Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.
Machine learning focuses on the development of computer programs that can access data and use it learn for themselves.
Polynomial Regression:-polynomial regression is a form of regression analysis in which the relationship between the independent variable x and the dependent variable y is modelled as an nth degree polynomial in x.
Prediction:-Machine learning is a way of identifying patterns in data and using them to automatically make predictions or decisions. ... For regression, you will learn how to measure the correlation between two variables and compute a best-fit line for making predictions when the underlying relationship is linear.
2. Things used in this project
Hardware components
- Female/Female Jumper Wires×(As per need)
- Breadboard (generic)×1
- LM35 sensor×1
- Bolt IoT Bolt WiFi Module×1
Software apps and online services
- Bolt IoT Bolt CloudBolt
- IoT Android App
Connecting the LM35 Sensor to the Bolt
Step 1: Hold the sensor in a manner such that you can read LM35 written on it.
Step 2: In this position, identify the pins of the sensor as VCC, Output and Gnd from your left to right.
In the Hardware image, VCC is connected to the red wire, Output is connected to the orange wire and Gnd is connected to the brown wire.
Step 3: Using male to female wire connect the 3 pins of the LM35 to the Bolt Wifi Module as follows:
- VCC pin of the LM35 connects to 5v of the Bolt Wifi module.
- Output pin of the LM35 connects to A0 (Analog input pin) of the Bolt Wifi module.
- Gnd pin of the LM35 connects to the Gnd.
Predicting the Temperature
Step 1: Make the same connections as 'Hardware connections for temperature monitor' screen, in the 'Interfacing sensor over VPS' topic of the 'Cloud, API and Alerts' module.
Step 2: Power up the circuit and let it connect to the Bolt Cloud. (The Green LED of the Bolt should be on)
Step 3: Go to cloud.boltiot.com and create a new product. While creating the product, choose product type as Output Device and interface type as GPIO. After creating the product, select the recently created product and then click on configure icon.
Step 4: In the hardware tab, select the radio button next to the A0 pin. Give the pin the name 'temp' and save the configuration using the 'Save' icon.
Step 5: Move to the code tab, give the product code the name 'predict', and select the code type as js.
Step 6: Write the following code to plot the temperature data and run the polynomial regression algorithm on the data, and save the product configurations.
setChartLibrary('google-chart');
setChartTitle('PolynomialRegression');
setChartType('predictionGraph');
setAxisName('time_stamp','temp');
mul(0.0977);
plotChart('time_stamp','temp');
Step 7: In the products tab, select the product created and then click on the link icon. Select your Bolt device in the popup and then click the 'Done' button.
Step 8: Click on 'deploy configuration' button and then the 'view this device' icon to view the page that you have designed. Below is the screenshot of the final output.
Step 9: Wait for about 2 hours for the device to upload enough data point to the Cloud. You can then click on the predict button to view the prediction graph based on polynomial regression algorithm.