Pages: [1]   Go Down
Author Topic: Issue with an LM35 sensor and LCD backlight  (Read 1347 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I've recently bought an Arduino UNO, an LM35 temperature sensor, a back-lit black-on-green 20x4 LCD screen and an external 9v power supply to power everything up.
The issue is that the Arduino's analogRead function returns a value that is higher (66) than the intended value (56), it occurs when the LCD's back-light is connected to the Arduino's 5v pin, along with the sensor.

I'm using the following to calculate the temperature and view raw sensor data:
Code:
float CalculateTemperature(int sensorReading)
{
   Serial.print(sensorReading); Serial.print("\n");
   return ( 4.91 * sensorReading * 100.0) / 1024.0;
}
void loop() {
   lcd.clear();
   lcd.print(CalculateTemperature(analogRead(1)));
   delay(1000);
}

My LCD's back-light power requirements are missing from it's specification (it's an ADM2004D by AMOTEC).
How can I solve this issue?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


the backlight might draw too much current from your Arduino.
1) use a separate power supply for the backlight
2) connect it to Vin (with an additional resistor !! to be determined by a potmeter)

Where does this formula comes from ?

( 4.91 * sensorReading * 100.0) / 1024.0;

can be shortened.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't remember where I got the formula, but I think it's fairly correct.
What kind of potentiometer do I need if my power supply is 9V, and how will I know what kind of resistor to get based on it?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Try a 10K potmeter and turn it until backlight is appropiate. Use a digital Multimeter to determine the value of the potmeter. Then look for a matching resistor, eg if the pot = 5K you could use a 4K7 resistor.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help!
I managed to get the backlight working by plugging pin 15 (LED+) to Vin and by using a 22 ohm resistor between pin 16 (LED-) and the 9v input's ground (second ground pin).
The voltage required turned out to be 1.9v and the current is 430mA.

I did notice a problem though: the resistor gets quite hot after a long time.
Is there anything I can do to make it run cooler, or should I get a better resistor (if there is one)?
It's color coding is Red-Red-Black-Gold.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's a ton of current, are you sure that's the right number for the backlight?  That's enough power to run like 20 regular LEDs.  You're putting over 4 watts of power into that resistor, if you're using a typical 1/4 watt resistor that's way under speced.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I use a 470 ohm series resistor to drive my lcd backlight from 9V. The backlight drops about 4V so it works out at about 10mA, which for me was a good compromise between light intensity and battery life. If you want a brighter backlight, try 220 ohms.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: