LM35 to Arduino malfunctioning after connecting GSM

Thread Starter

Chetan_Jadhav

Joined Mar 2, 2017
52
Hi,
I am building a temperature monitoring system using lm35, GSM Sim900a and Arduino.
LM35 was working good when connected with Arduino and readings were as expected. (without connecting GSM)
But as I connected GSM Module to the same circuit, Temperature readings started fluctuating in a wide range (24>>38>>31>>50>>etc.)
I am using USB Power for Arduino,separate 12v adapter for GSM and simple male to female connecting wires for other connections.
Please help me with the solution.
thanks.
 

djsfantasi

Joined Apr 11, 2010
7,867
Is the GSM module a shield or separate module?

What pin is the LM35 connected?

Are there any pin conflicts between the two peripherals?

If the GSM module is a shield, it may be using the same pin you’ve assigned to the LM35. The library for the GSM should document the required pins. In this case, the easiest solution would be to reassign the pin(s) for the LM35.

I built a system with several shields... SD card, MP3 player, amplifier, RTC and LCD backpack. I ran into several pin conflicts and had to reassign several pins to get everything to work.
 

Thread Starter

Chetan_Jadhav

Joined Mar 2, 2017
52
Hi,
no shield. I am using separate module SIM900a with tx,rx,gnd to 9,10,gnd pin of arduino uno respectively. LM35 to A0 of arduino.
Thanks
 

Thread Starter

Chetan_Jadhav

Joined Mar 2, 2017
52
hi,
Have you tried a simple R/C filter on the input to the ADC pin.?
Say a 470R in series with the input and a 10n or 47n to 0V from the input pin.
E
Not yet,
But I will surely try now.
With all respect sir, May i please know the reason of using RC filter and what is the reason behind these malfunctioning?
Because I might find it's need in other areas.
ShowThanks
 
Last edited by a moderator:

djsfantasi

Joined Apr 11, 2010
7,867
Arduino Uno.

Software implementation on pins 9,10(PWM enabled)
pls find the code attached below
thanks
Thanks for supplying your code.

You do know that you need to initialize analog reads by performing a read and throwing away the first result?

The Arduino ADC needs to initialize it’s internal capacitor and hence the first read is not reliable. And if you’re using multiple analog pins (you’re not, but I’m mentioning this for future designs), you need to perform this sacrificial read every time when switching between Arduino analog pins. In your design, I would put a call to analogRead() in the setup() routine.
 

Thread Starter

Chetan_Jadhav

Joined Mar 2, 2017
52
Thanks for supplying your code.

You do know that you need to initialize analog reads by performing a read and throwing away the first result?

The Arduino ADC needs to initialize it’s internal capacitor and hence the first read is not reliable. And if you’re using multiple analog pins (you’re not, but I’m mentioning this for future designs), you need to perform this sacrificial read every time when switching between Arduino analog pins. In your design, I would put a call to analogRead() in the setup() routine.
I just tried it.
But now working, There were still variations in readings.
when i simply disconnected the power to GSM module and the readings were quit stable.
Without GSM powered on the code runs fine. It's all after GSM connection. Please have a look at results.
without GSM.png with gsm.png
 

Phil-S

Joined Dec 4, 2015
222
Hard to get an LM35 wrong, but a good read of the datasheet and application notes will give plenty of information on driving the output down difficult lines. It might be worth buffering the output of the LM35 at source.
 

SProg

Joined Nov 10, 2018
12
GSM modules require about 2A during Transmission or Network registration, your problem is the noise and its hardware/design related.
 

Picbuster

Joined Dec 2, 2013
1,027
Hi,
I am building a temperature monitoring system using lm35, GSM Sim900a and Arduino.
LM35 was working good when connected with Arduino and readings were as expected. (without connecting GSM)
But as I connected GSM Module to the same circuit, Temperature readings started fluctuating in a wide range (24>>38>>31>>50>>etc.)
I am using USB Power for Arduino,separate 12v adapter for GSM and simple male to female connecting wires for other connections.
Please help me with the solution.
thanks.
Please show us the complete layout. (ground plane, current flow GSM, pwr, position of sensor & mpu ( cabling).
I do get the impression that the sensor is affected by the GSM current ( small track's ? the sim 900 is able to draw a few amps.
No other devices should share the GSM power lines or ground planes.)

Use a scope and measure the pwr at the sensor.

Picbuster
 

atferrari

Joined Jan 6, 2004
4,443
In my very first project using a micro (temperature collector & display for a green house) I recall using LM35s with excellent results, driving them with a constant current of around 0,5 mA, IIRC.
 

SProg

Joined Nov 10, 2018
12
High current loops caused by the GSM part, affecting the analog reading. This is a hardware/design issue.

Could you post a picture of the wirings?
 
Top