Issue with the LM35 interfaced with Arduino

Hai Guys!

Currently i am doing a project upon the monitoring system. Now i am facing the new kind of issue regarding the Temperature sensor(LM35). I need the values in degrees. So, i had multiplied the analog factor using mul(0.0977).Let me explain the three scenario to explain my issue i am facing.

  1. Bolt iot device connected with lm35 at A0 pin and used the code as follows:

setChartLibrary(‘google-chart’);
setChartTitle(‘Temperature Monitoring and Prediction’);
setChartType(‘tableGraph’);
mul(0.0977);
plotChart(‘time_stamp’,‘yoo’);

Out put for this:

Value:49.

  1. Bolt connected with the arduino and used LM35 at A1 pin of arduino and not used mul(0.0977) here.

Code for this:

var lineGraph = new boltGraph();
lineGraph.setChartType(“lineGraph”);
lineGraph.setAxisName(‘Time’,‘Light’);
lineGraph.plotChart(‘time_stamp’,‘var1’);
var barGraph = new boltGraph();
barGraph.setChartType(“tableGraph”);
barGraph.setAxisName(‘Time’,‘Temperature’);
barGraph.plotChart(‘time_stamp’,‘var2’);
var lineGraph = new boltGraph();
lineGraph.setChartType(“lineGraph”);
lineGraph.setAxisName(‘Time’,‘Soil_Moisture’);
lineGraph.plotChart(‘time_stamp’,‘var3’);

Pin Config:

Output:

value:39

  1. Bolt connected with the arduino and used LM35 at A1 of arduino with mul(0.0977) used at code.

Code for this:

setChartTitle(‘bolt interfaced with arduino(a1 pin) with mul(0.097) for degree’);
var lineGraph = new boltGraph();
lineGraph.setChartType(“lineGraph”);
lineGraph.setAxisName(‘Time’,‘Light’);
lineGraph.plotChart(‘time_stamp’,‘var1’);
var lineGr = new boltGraph();
lineGr.setChartType(“lineGraph”);
lineGr.setAxisName(‘Time’,‘Soil_Moisture’);
lineGr.plotChart(‘time_stamp’,‘var3’);
var barGraph = new boltGraph();
barGraph.setChartType(“tableGraph”);
barGraph.setAxisName(‘Time’,‘Temperature’);
mul(0.097);
barGraph.plotChart(‘time_stamp’,‘var2’);

Pin Config as same as 2:

Output:

The value:42.

Now, My query is as from the above samples the first one shows correct when it is connected to A0 pin of bolt itself and used mul(0.0977) for degree value. Then for Second one connected with the arduino A1 pin and not used mul(0.0977) gives same result as The third one similarly which is having Mul(0.0977) to convert them to degree as said.

1.Why the value gets differs from first and both the second,third?
2.Why both the second one and third one shows the same value even when the second one is not having Mul() in it?
3.I need to use the Arduino since more sensors will be connected. But the raw data it self shows the value just like degree celsius in both second and third one. Which one is correct in 2(without mul) and 3(with mul)? if so then why it is not accurate as first one?

4.How to get the correct temperature values while the arduino analog pins were used for interfacing?Do i need to use the mul(0.0977) in the code to convert them to degree Celsius or not? I need the exact degree values… to manipulate.

I use arduino for interfacing the multiple sensors. The code uploaded in the arduino were This!

So kindly help me to solve the issue to calibrate them. I am not getting the same values in three of the cases. even i had monitored them each case for < 1 hour.

Hope the team will resolve it. @vinayak.joshi,@shoeb.ahmed

Hi @arjunraj,

The mul and add functions which are available on the Bolt Cloud are only meant for single graphs.

You have to use the functions scaleData and translateData as per the following blog.

Here is a docs link for these functions.

Thank you for the response! @vinayak.joshi

But I would like to know why we use the ‘1’ in the scale function mentioned above.?
Celsius_display.scaleData(1,0.0977);

In my case, I used three sensors along with the LM35. So do I need to change the value instead of ‘1’? If so what I need to do? I had mentioned above the exact code what i did in the product configuration. So by seeing that you could guide me.

Hi @arjunraj,

The multi-graph api, can plot more than one data series on the given graph type.

Also, you can plot the data in a table as well, with multiple columns.

The 1 in the scaleData and 0 in the translate data get applied to the x axis. In our case this is the time series (‘time_stamp’ in plot chart). But there is also the possibility that you plot one data series against the other. (Example Celsius_display.plotChart(‘temp’, ‘temp’)

In the current case when you use time_stamp, this value is not used, so it does not matter what number you use here, but just to ensure that there is no issue in the future, we have kept the values as 1 for scaling and 0 for translating.

Thank you for the response! @vinayak.joshi

But still, there is an issue to look forward. I connected first the sensors like ldr,lm35,soil moisture sensor in A0,A1,A2 pins accordingly with the Arduino and interfaced it with the Bolt for graph representation and as you had mentioned i followed the scaling factor as you mentioned above.
The following were the result i got.

Got temperature reading as 5.57 only!
The following were the configuration done on my bolt.
Hardware config:

software config:

setChartTitle('Monitoring system');
var lig = new boltGraph();
lig.setChartType("lineGraph");
lig.setAxisName('Time','Light_Intensity');
lig.plotChart('time_stamp','light');
var tem = new boltGraph();
tem.setChartType("lineGraph");
tem.setAxisName('Time','Temperature');
tem.scaleData(1, 0.0977);// mentioned as you said!
tem.plotChart('time_stamp','temp');
var soi = new boltGraph();
soi.setChartType("lineGraph");
soi.setAxisName('Time','Soil_moisture');
soi.plotChart('time_stamp','soil');

But the same thing when i get connected individually with bolt module A0 pin. I get the output as below:

I got the value as 56.3 degree celsius.

Hardware config:

Graph Config:

setChartLibrary('google-chart');
setChartTitle('Temp_chart');
setChartType('lineGraph');
setAxisName('time_stamp','temp');
mul(0.0977);// here also i did the multiplication.
plotChart('time_stamp','temp');

Now, tell me why it gets these much huge difference while I connect the same sensor in Arduino Analog pins as well as with the Bolt A0 pin. Even I made them run up to 30 minutes in each case. is there any problem with the scale()? Since,At Arduino interface the value got were 5.57 but while the same one connected with the bolt it shows the nominal value of 56.3. So, kindly help me in solving the issue. What I must do now to get the correct readings. Even in the Arduino interfacing, the raw data shown were around 57.8 without any scale function. Please help me in getting the correct value for temperature.

Hi @arjunraj,

The Bolt Analog pin converts the input voltage in the range of 0 to 1v to a digital value of 0 to 1023, where as the Arduino/Boltduino converts an input voltage of 0 to 5v to a digital value of 0 to 1023.

So when you are using the Arduino, to get the temperature, you will need a multiplication factor of 0.0977 * 5 which is 0.4885.

This explains only half of the issue though, as you should have got a reading of about 25 to 29 degrees.

I am not entirely certain why you are getting such a large variation. Please test it again for the scaling factor of 0.04885, for LM35 data that you get from the Arduino, and a scaling factor of 0.0977 for the data that you get from the Botl WiFi module.

Also, the function mul does not apply to objects created using the " new boltGraph();" function. So if you create a graph object with this function, it will not matter if you use the mul function or do not use the mul function. It will not apply to this graph.

So, if you use the function “new boltGraph()” to display your graph, you have to use the function “scaleData” to scale the graph. If you do not use the function “new boltGraph()” to display the graph, then you have to use the “mul” function to scale the graph.

Finally, if you use the wrong type of scaling function, or you do not use the scaling function (both mean the same thing for the display), then the raw readings that the Bolt Cloud gets from the Bolt WiFi module or the Arduino will be displayed.

For the Arduino data to show a reading of 5.57 with a scale factor of 0.0977, the raw value should have had to be 5.57/0.0977 ~= 57. This is why you got the value of 57 without any scale function for the data from the Arduino.

Thank you for the response! @vinayak.joshi
I had tried the scaling factor of 0.04885(Since, from Arduino to the Bolt ) to the LM35 data. It shows 61 as raw value and after the scaling factor multiplication. It shows the output as 3.27. But my room temperature here is at 26degree celsius. So, how it can show these differences from the existing temperature. Actually it should be 550 as raw data and the scaled data should be 26.89 right. how come it can show this much variation? I took the readings only after 30 mins. Even though it shows this much deviation. So, help me to resolve the issue soon, please.

Hi,

The scaling factor is 0.4885, not 0.04885(Note the number of 0s after the decimal point). Also for a raw value of 61, it would have shown a temperature of 29 degrees.

Are you plotting this data via 2 different products? or are you changing the code in the same product?

Try changing the code in the same product, and check for the data at the same time stamp, with and without the multiplication factor, at the same time point.

The error in temperature (about 2 to 5 degrees) is due to the inherent error in the LM35 sensor.