Issue with an LM35 sensor and LCD backlight

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:

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?

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.

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?

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.

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.

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.

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.