Wrong current to LCD?

Hi guys,

I started with arduino since last week, and its very fun so far!

I followed some tutorials, and now i found a tutorial that is using the LCD display on the Arduino.

I followed this tutorial, and used first a arduino sim so i dont damage my arduino if im doing something wrong.

I connected all components as described in the tutorial, but when i simulate it , the current is not good. See screenshot and code:

/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

What do you mean by "the current is not good"? I don't see a screenshot, by the way.

sterretje:
What do you mean by "the current is not good"? I don't see a screenshot, by the way.

Im sorry that i wasn't that specific, but here is a screenshot with the current message:

You need a current limiting resistor for the backlight LED. The "backlight LED" phrase in the message should have gave a hint.

codlink:
You need a current limiting resistor for the backlight LED. The "backlight LED" phrase in the message should have gave a hint.

Thanks, wich one? How to calculate?

Enter the LED info from the datasheet into this, http://ledcalculator.net/

FYI, you don't need 20mA to light up an LED, usually in the range of 10mA would suffice. You could also use a pot so you can adjust it like you did with contrast.

codlink:
Enter the LED info from the datasheet into this, http://ledcalculator.net/

FYI, you don't need 20mA to light up an LED, usually in the range of 10mA would suffice. You could also use a pot so you can adjust it like you did with contrast.

Thanks!, i tried with a 220 ohm resistor and its working.

codlink:
You need a current limiting resistor for the backlight LED. The "backlight LED" phrase in the message should have gave a hint.

Actually, that is a complete Furphy. :roll_eyes:

It is rare that you would need to add a resistor, particularly with those displays sold in quantity on eBay and other places. It would only be some oddball "surplus" items that are the exception.

This can be verified by locating resistor R8 on the board (or possibly R9), marked "101" or 100 Ohm. If this is present, no other resistor is required unless you wish to dim the display.

As to the spurious message in the simulation - well, that is a risk of simulation. The estimate of 23.7 mA is actually quite plausible (though the ".7" is obviously ridiculous) given that the simulator knows the 100 Ohm resistor is in fact included on the board and would be about right taking into account the voltage drop (to about 4.5 V) of an Arduino I/O pin loaded to this degree.

But you did not connect the display backlight to an I/O pin! And it would be much more than 23.7 mA if the 100 Ohm resistor was not on the LCD board. And 20 mA is merely the maximum current for which an Arduino output pin is characterised - it is quite reasonable to have one or two pins driving up to 25 mA, but you do not want to approach the absolute maximum rating of 40 mA.

It is perfectly safe to draw 23.7 mA - or indeed much more than that - from the Arduino 5 V rail. The warning is total and utter nonsense - the simulator is broken!

Paul__B:
The estimate of 23.7 mA is actually quite plausible

... except it says kA

JimboZA:
... except it says kA

Yep, that's the fist thing I noticed when he posted that image. My eyes lit up when I read kA!

Actually, that is a complete Furphy.

Learn something new everday. I will do my best to use "Furphy" today.

It is rare that you would need to add a resistor

I have several different LCDs that came from different places and that have different configurations, but all of them needed a resistor for the backlight.

JimboZA:
... except it says kA

And just for a moment, a very brief moment, the Sun rose over the horizon.

That's actually a pretty good catch for the simulator. I'm impressed. Now if you could get a real part number and buy that part from a vendor and it didn't have the current limiting resistor onboard, then that would be a really good result.

Why would the LCD have a resistor anyway? They don't know what voltage your backlight power supply is going to be.

Right, many LCDs have about 100 ohm resistor in series with the back light LED, but, the LCD is usually too bright without additional resistor. The back light is for reading in the dark, which is very minimal light necessary. It's not to make your display glow!

OP,

What simulation program are you running?

MorganS:
Why would the LCD have a resistor anyway? They don't know what voltage your backlight power supply is going to be.

Because according to the datasheets, many of which have been posted here and can be found with a little searching, they are specified for 5 V. As I said, I am referring to those commonly sold as new stock, not random disposals.

Didn't notice the "kA". So the simulator actually has an emulation of the LCD LED as a voltage drop of 2.3 V with an ESR of one milliohm! I still find that somewhat dubious.