Introduction: Room Temperature Prediction Via LM35 Sensor and Machine Learning

  1. 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

  1. Female/Female Jumper Wires×(As per need)
  2. Breadboard (generic)×1
  3. LM35 sensor×1
  4. Bolt IoT Bolt WiFi Module×1

Software apps and online services

  1. Bolt IoT Bolt CloudBolt
  2. IoT Android App

Step 1: 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.

Step 2: 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 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.







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.


Step 3: Final Prediction Looks Like This

Step 4: Further Suggestion Are Welcome

Sensors Contest

Participated in the
Sensors Contest