Pages: 1 2 3 [4] 5 6 ... 8   Go Down
Author Topic: Warning to users of some vendors LCD keypad shields.  (Read 78332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Heads up to anyone else!!
First- THANK YOU Bill!!
Just bought a Button-LCD shield by SainSmart- was looking for example code and found this thread- LUCKY ME!!
April 2013 and STILL the same problem- except on this board there is a 1K resistor where there is a 4.7k on the schematic!!
(took the LCD off the shield to look)
Trying your test caused the Arduino to disconnect from usb so it definitely shorted!!
Logged

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

Hey

I'm really new to all this.

Please could you help me with the display. I've tried to enter the code as is displayed, when I press "right" right is displayed. Pressing "left" displays select. "up" displays down. "down" displays left. And "select" displays nothing at all. I have tried adjusting the numerical values and have got it working except for the "select" button which I cant get to show anything at all. Any ideas why or how to rectify this?

Thanks

Dan
Logged

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

I am happy I came across this post. I have a Robot LCD keypad shield that the backlight flashes when I tryto use it I thought it was ready for the bin. Will try the mod and see what happens:)

Adrian
Logged

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

Hy DanBeno! Have you tried the following configurations?

Code:
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

int read_LCD_buttons()
{
  x = analogRead(0);      // read the value from the sensor
  delay(5); //switch debounce delay. Increase this delay if incorrect switch selections are returned.
  int k = (analogRead(0) - x); //gives the button a slight range to allow for a little contact resistance noise
  if (5 < abs(k)) return btnNONE;  // double checks the keypress. If the two readings are not equal +/-k value after debounce delay, it tries again.
  // my buttons when read are centered at these values: 0, 144, 329, 504, 741
  // we add approx 50 to those values and check to see if we are close
  if (x > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
  if (x < 50)   return btnRIGHT; 
  if (x < 195)  return btnUP;
  if (x < 380)  return btnDOWN;
  if (x < 555)  return btnLEFT;
  if (x < 790)  return btnSELECT;   
  return btnNONE;  // when all others fail, return this…
}

lcd_key = read_LCD_buttons();
    checkBtns = false;
    switch(lcd_key){
    case btnRIGHT:
        Serial.println("btnRight");
        break;
      case btnLEFT:
        Serial.println("btnLeft");
        break;
    case btnUP:
        Serial.println("btnUp");
        increment = 1;
        break;
    case btnDOWN:
        Serial.println("btnDown");
        increment = -1;
        break;
    case btnSELECT:
        Serial.println("btnSelect");
        data_item++;
        break;
    default:
        break;
    }
Logged

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

I Made the Diode Repair proposed by dweston and the keypad is perfect now!
The background led is dimming perfectly! I was lucky finding the diode 1N5817 in an old ethernet pci board!
Later I could measure the consumption through pins Vin and ground and the multimeter in amperes in series and 9v power source.
It can be measured also from the keypad itself. Then I uploaded the thest sketch on page 1, to test the dimming of backlight.

Only the arduino consumes 46 mA, with the Lcd Shield modified by the diode around 67mA and adding a jumper to it (original circuit) it consumes 150mA! I wonder all the lcd shields being sold will end up burning port 10 on the arduinos!
I received my arduino for less than a week and I´m loving it! I assume it is safe to let it plugged directly on the usb port since it is consuming far less than 500mA.

I Installed the IDE interface on Mageia Linux 3 and it worked without effort, http://forum.arduino.cc/index.php?topic=172877.0

Celso Ferrarini
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2732
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Only the arduino consumes 46 mA, with the Lcd Shield modified by the diode around 67mA and adding a jumper to it (original circuit) it consumes 150mA! I wonder all the lcd shields being sold will end up burning port 10 on the arduinos!

Probably not, since I'm guessing that most users are not even aware that their shield "supports dimming"
and even then they are using the stock LiquidCrystal library which does not support dimming.
And as long as they don't mess with the pin that is connected to the transistor, not bad happens and the backlight
is on


I received my arduino for less than a week and I´m loving it! I assume it is safe to let it plugged directly on the usb port since it is consuming far less than 500mA.

I use the USB port directly. Excess USB power shouldn't be an issue, but not everyone does things properly.
However, the small little USB extern USB passport type drives pull up to 1 amp as they start up and most
USB ports can run them, so under 500ma will be fine.


I Installed the IDE interface on Mageia Linux 3 and it worked without effort, http://forum.arduino.cc/index.php?topic=172877.0

Celso Ferrarini

BTW, if you switch to fm's LiquidCrystal library, it is faster and has backlight support
including dimming:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
Logged

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

This problem is real and my LCD branded Deekbot off eBay has same issue.

I think replacing bipolar transistor with FET is the cleanest solution, but I don't have suitable FET around and I'm not looking to procure it.

I hate to take LCD out of the shield to reach transistor or resistor and my hands too shaky to cut trace and solder diode, and I hate to look for additional parts like shottky ot germanium diode, but I can do two other things that do not require additional parts:

1. Pluck pull-up resistor from underneath LCD and run backlight control D10 as INPUT only. If you really up to it you may put  100K resistor from D10 to ground to prevent base from floating, but I don't think it's necessary.

2. Pluck transistor out from underneath LCD and connect D10 directly to LCDs pin 16. Resistor is irrelevant. D10must be an output, but control will be inverted - full bright will be 0 and dim 255. Outputs are plenty strong to drive LED directly.

These are two separate options, not two steps for same one!

Use something like small watch screwdriver to pluck part of your choice. If trace start delaminating - just cut it with same screwdriver.

I think these fixes are easier than others.

I just did second option - works as expected. Took 20 seconds + iron heating time. See attached pictures. Second picture is half -plucked transistor standing on it's hind (BE) legs before final termination.
 
Cheers y'all!



* DSC03292.JPG (69.12 KB, 400x315 - viewed 225 times.)

* DSC03290.JPG (49.64 KB, 400x276 - viewed 223 times.)
« Last Edit: September 05, 2013, 09:14:50 pm by SuperLAVA » Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2732
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This problem is real and my LCD branded Deekbot off eBay has same issue.
Sure it is, which is why I created the thread.

I think replacing bipolar transistor with FET is the cleanest solution, but I don't have suitable FET around and I'm not looking to procure it.

I hate to take LCD out of the shield to reach transistor or resistor and my hands too shaky to cut trace and solder diode, and I hate to look for additional parts like shottky ot germanium diode, but I can do two other things that do not require additional parts:
Removing the LCD is quite difficult. I tried it. Getting all the pins cleanly de-soldered is a real pain
even with a de-soldering tool. The mod for the diode was actually much less work.


1. Pluck pull-up resistor from underneath LCD and run backlight control D10 as INPUT only. If you really up to it you may put  100K resistor from D10 to ground to prevent base from floating, but I don't think it's necessary.
Are you saying leave D10 connected to the transistor base? And then set D10 to INPUT to
turn on the backlight?
If so, that doesn't solve the problem since if you set D10 to HIGH you still have the "short".
The problem isn't the resistor between d10 and VCC it is that there is no resistor
between D10 and the base.
If using this "INPUT only" option, there is no need to remove the resistor.
since if you don't mess with D10, D10 will default to input and the resistor
will turn on the transistor so the backlight is on.
The problem is only if D10 is ever set to HIGH which also happens during PWM.
With the resistor removed, there may also be an issue with the transistor
turning on enough to fully light the backlight since the internal pullup on the AVR
(assuming it is enabled) won't provide much current to feed into the base.

There is a s/w approach mentioned at the bottom of response #3:
http://forum.arduino.cc/index.php?topic=96747.msg739042#msg739042
which didn't remove the resistor.
The limitation is that you can't do PWM to dim the backlight
and this method doesn't work with libraries like fm's library that assume
you set the output to HIGH or LOW  or can use PWM to control the backlight.



2. Pluck transistor out from underneath LCD and connect D10 directly to LCDs pin 16. Resistor is irrelevant. D10must be an output, but control will be inverted - full bright will be 0 and dim 255. Outputs are plenty strong to drive LED directly.
Disconnecting D10 from the transistor and driving the backlight directly might work.
I haven't measured the current on these backlights but many of the 16x2 backlights only
use a few milliamps.
Libraries like fm's allow configuring the polarity of the backlight control and will take care
of inverting the signals including with PWM.


These are two separate options, not two steps for same one!
Use something like small watch screwdriver to pluck part of your choice. If trace start delaminating - just cut it with same screwdriver.

I think these fixes are easier than others.

Cheers y'all!
Logged

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

This problem is real and my LCD branded Deekbot off eBay has same issue.
Sure it is, which is why I created the thread.

I think replacing bipolar transistor with FET is the cleanest solution, but I don't have suitable FET around and I'm not looking to procure it.

I hate to take LCD out of the shield to reach transistor or resistor and my hands too shaky to cut trace and solder diode, and I hate to look for additional parts like shottky ot germanium diode, but I can do two other things that do not require additional parts:
Removing the LCD is quite difficult. I tried it. Getting all the pins cleanly de-soldered is a real pain
even with a de-soldering tool. The mod for the diode was actually much less work.


1. Pluck pull-up resistor from underneath LCD and run backlight control D10 as INPUT only. If you really up to it you may put  100K resistor from D10 to ground to prevent base from floating, but I don't think it's necessary.
Are you saying leave D10 connected to the transistor base? And then set D10 to INPUT to
turn on the backlight?
If so, that doesn't solve the problem since if you set D10 to HIGH you still have the "short".
No, you don't. If set as INPUT then High will be driven with 20K to VCC. See http://arduino.cc/en/Reference/digitalWrite
When writing Low to input it will be left floating. Leaving original transistor pull-up will prevent it from going low, this is why it have to be removed

The problem isn't the resistor between d10 and VCC it is that there is no resistor
between D10 and the base.Only if driven with high current. Setting D10 as Input will drive base through 20K internal pullup only, not through output mode PUSH wich can blow transistor or micro's output.
If using this "INPUT only" option, there is no need to remove the resistor.Wrong. With resistor present it would never go LOW. Removing it or even adding weak pull down will assure low potential on base and closing of transistor.
since if you don't mess with D10, D10 will default to input and the resistor
will turn on the transistor so the backlight is on.Correct, but you can't drive it low without setting as output. Unless, once again, you remove resistor.
The problem is only if D10 is ever set to HIGH which also happens during PWM.
With the resistor removed, there may also be an issue with the transistor
turning on enough to fully light the backlight since the internal pullup on the AVR
(assuming it is enabled) won't provide much current to feed into the base.20K pullup is plenty to drive this transistor.

There is a s/w approach mentioned at the bottom of response #3:
http://forum.arduino.cc/index.php?topic=96747.msg739042#msg739042
which didn't remove the resistor.
The limitation is that you can't do PWM to dim the backlightYep, same as here, but for different reason.
and this method doesn't work with libraries like fm's library that assume
you set the output to HIGH or LOW  or can use PWM to control the backlight.
Analog write will automatically make pin output (I think so), so yes, you can't do dimming with it, but you still can control on/off. Depending on your application (library reuse?) some might prefer it. Just another available option.


2. Pluck transistor out from underneath LCD and connect D10 directly to LCDs pin 16. Resistor is irrelevant. D10must be an output, but control will be inverted - full bright will be 0 and dim 255. Outputs are plenty strong to drive LED directly.
Disconnecting D10 from the transistor and driving the backlight directly might work.
I haven't measured the current on these backlights but many of the 16x2 backlights only
use a few milliamps.Correct. As I.ve mentioned I already did it and it works. Definitely less stress for chip than driving straight base-emitter junction.
Libraries like fm's allow configuring the polarity of the backlight control and will take care
of inverting the signals including with PWM.
I just did conversion in my code : 255-backlight

These are two separate options, not two steps for same one!
Use something like small watch screwdriver to pluck part of your choice. If trace start delaminating - just cut it with same screwdriver.

I think these fixes are easier than others.

Cheers y'all!

GOOD TALK!
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2732
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We are in general agreement and I think both of us
misunderstood each other.
We have two different approaches for avoiding the D10 output HIGH
issue when offering backlight on/off control.
One method involves a hardware mod and s/w while the other is s/w only.

Your first explanation was not clear enough to me to be able to tell how you were intending
to use the output pin since you didn't fully describe it.
From your first description it appeared that you were just setting the pin to INPUT
and nothing else.
I now see that you intended to control the backlight on/off.


However, this approach and the s/w only approach from response #3 both
have the same issue of a "short" when D10 is an output and driven HIGH.
The reason is exactly the same whether the resistor is present or not.
(No current limiting from D10 into the base).

i.e. if s/w is loaded into the board that programs D10 as output and drives it high
BOOM... There is a problem - regardless of whether the resistor is removed.

So while either method can offer on/off backlight control,
neither protects the hardware from damage and
neither can support PWM because the first thing analogWrite() does is
make the pin an output as it turns on PWM which will
be driving the pin high.

The difference between the two
is that one requires a hardware mod AND special/odd s/w
and the other is only special/odd s/w.


The h/w and s/w method:

- cut/remove resistor under LCD
- possibly add weak pulldown resistor to D10

- set D10 to INPUT
- turn on pullup to turn on backlight
(AVR m328 spec says 20k to 50k, worst case of 50k is that enough to turn on the transistor for backlight? .1ma ?)
- turn off pullup to turn off backlight.

Alternatively with IDE 1.0.1 and beyond the s/w part reduces to be:
(with no initial setting of D10 to any state or level)
Code:
pinMode(D10, INPUT); // turn off backlight
pinMode(D10, INPUT_PULLUP); //turn on backlight



The s/w only method:
- set D10 to LOW (only once)
- set D10 to OUTPUT for backlight off
- set D10 to INPUT for backlight on

Alternatively, with any version of IDE this reduces to:
(with no initial setting of D10 to any state or level)
Code:
pinMode(D10, OUTPUT); // turn off backlight
pinMode(D10, INPUT); // turn on backlight

This works because OUTPUT sets the output of the pin to LOW as well
which will pull the transistor base down which will turn off the backlight.
Since the pullup still in place on the LCD shield, there is no need
to turn on the D10 pullup, just setting it to INPUT mode will allow the shield pullup to drive
the transistor to turn on the backlight.


Given both methods have the same limitations
and they both reduce down to very similar s/w operations to control the backlight,
my preference would be for a s/w only solution.

I had talked to fm just after I started this thread
about adding support for this s/w only method to the lcd library
as an option but we came the conclusion that there is no guarantee that the user will
provide the correct information to the constructor.
And since you really can't tell things are broken, because it seems to work,
when you are shorting out the D10 pin by driving it HIGH, we opted not to provide it.
(Its also a  strange and very narrow usage case as well)


--- bill






« Last Edit: September 06, 2013, 12:09:14 am by bperrybap » Logged

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

We are in general agreement and I think both of us
misunderstood each other.
We have two different approaches for avoiding the D10 output HIGH
issue when offering backlight on/off control.
One method involves a hardware mod and s/w while the other is s/w only.

Your first explanation was not clear enough to me to be able to tell how you were intending
to use the output pin since you didn't fully describe it.
From your first description it appeared that you were just setting the pin to INPUT
and nothing else.
I now see that you intended to control the backlight on/off.


However, this approach and the s/w only approach from response #3 both
have the same issue of a "short" when D10 is an output and driven HIGH.
The reason is exactly the same whether the resistor is present or not.
(No current limiting from D10 into the base).

i.e. if s/w is loaded into the board that programs D10 as output and drives it high
BOOM... There is a problem - regardless of whether the resistor is removed.

So while either method can offer on/off backlight control,
neither protects the hardware from damage and
neither can support PWM because the first thing analogWrite() does is
make the pin an output as it turns on PWM which will
be driving the pin high.

The difference between the two
is that one requires a hardware mod AND special/odd s/w
and the other is only special/odd s/w.


The h/w and s/w method:

- cut/remove resistor under LCD
- possibly add weak pulldown resistor to D10

- set D10 to INPUT
- turn on pullup to turn on backlight
(AVR m328 spec says 20k to 50k, worst case of 50k is that enough to turn on the transistor for backlight? .1ma ?)So average LED run at 20mA, 10 typical. You need gain of 200+. Most of these small transistors have current gain of 200-500 on average. I think it is sufficient.
- turn off pullup to turn off backlight.

Alternatively with IDE 1.0.1 and beyond the s/w part reduces to be:
(with no initial setting of D10 to any state or level)
Code:
pinMode(D10, INPUT); // turn off backlight
pinMode(D10, INPUT_PULLUP); //turn on backlight

Correct. Or after initial setup as input just do regular digital write (but not PWM!).




The s/w only method:
- set D10 to LOW (only once)
- set D10 to OUTPUT for backlight off
- set D10 to INPUT for backlight on

Alternatively, with any version of IDE this reduces to:
(with no initial setting of D10 to any state or level)
Code:
pinMode(D10, OUTPUT); // turn off backlight
pinMode(D10, INPUT); // turn on backlight
Correct. But you have to be careful and assure not to set output High.

This works because OUTPUT sets the output of the pin to LOW as well
which will pull the transistor base down which will turn off the backlight.
Since the pullup still in place on the LCD shield, there is no need
to turn on the D10 pullup, just setting it to INPUT mode will allow the shield pullup to drive
the transistor to turn on the backlight.


Given both methods have the same limitations
and they both reduce down to very similar s/w operations to control the backlight,
my preference would be for a s/w only solution.

I had talked to fm just after I started this thread
about adding support for this s/w only method to the lcd library
as an option but we came the conclusion that there is no guarantee that the user will
provide the correct information to the constructor.
And since you really can't tell things are broken, because it seems to work,
when you are shorting out the D10 pin by driving it HIGH, we opted not to provide it.
(Its also a  strange and very narrow usage case as well)


--- bill



Bill,

Good points, no other arguments. It is good drill for crowd to understand all options. And yes, software only fix is better, or rather more convenient but it is still short of full functionality and compatibility. I believe, and this is why I did  implement my option 2 - removing transistor. It is safe, no additional parts required, full functionality preserved, tho some software adaptations of existing code might be necessary.

Best regards!

Sal

Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 91
Posts: 3646
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As I came to this thread, I was most concerned because I had been running a shield for some weeks, just to see how high the seconds counter would go.  In the event, the thunderstorm came first (and we had more today).

I was not quite sure how to determine whether this was a faulty or "fixed" board, so to test it I used the "Diode Test" range on the meter to test between D10 and ground on the shield - sure enough, it read 0.7V.

OK, I'm not happy.  My solution?  Well, I note that the holes on the LCD panel itself are unusually big, and it is relatively easy to suck out the solder on the top side (partially as it turns out that there is only solder on the top side anyway, it has not fully filled the holes).  Where pins were still "tacked" to the sides of the holes after a second suck (it is often useful to put more solder on the connection for a second suck, so that it is all liquefied by adequate contact with the iron), they could generally be released by warping or twisting the pin with tweezers (that is a pair of epilation tweezers in the photo!).

Now revealed is R7 and the transistor.  I don't know about the original, but R7 on this specimen (note all the spelling mistakes) is not 10k, it is actually 1k!  What I did was to shave out the track between R7 and the transistor and move it over this gap - the pads already suited the purpose.

Many other alterations are possible but I did not fancy finding my SMD stocks, so now D10 connects to the transistor via 1k and nothing else.

Next I mounted the shield and plugged in power.  Nothing appeared.  Until at least, I looked closer.  In fact, the test sketch was running as before, but no light.  No voltage (at all!) on D10 either, unless I put the multimeter on low volts between D10 and Vcc, when I saw some light.

Had I fried a pin on a Mega2560?  Well, no.  The sketch is Mark Bramwell's July 2010 LCD panel test which uses the six-argument LiquidCrystal lcd constructor which makes no reference to port 10, thus it remains an input.  Adding the lines
Quote
pinMode(10, OUTPUT);
 digitalWrite(10, HIGH);        // set the LED on
brings up the LED illumination and in fact, commenting out the first so that port 10 remains an input, makes virtually no difference though the voltage on D10 is only about 0.8V rather than near Vcc.

So I have a shield which is (now) safe, but expects D10 to be activated, if only using the internal pull-up.

A thought - if the digitalRead() call actually reads the pin state, then it would be possible to set it high as an output, then immediately test it to see if it is actually high, and if not, deem it to be shorted and alter the sketch behaviour accordingly.


* RIMG1701a.jpg (98.4 KB, 640x480 - viewed 269 times.)

* RIMG1701b.jpg (41.83 KB, 320x240 - viewed 241 times.)
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2732
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul_B,
I really like the idea of testing/reading the D10 pin state after setting the pin HIGH.
Luckily the digitalRead() code reads the PINx register vs the PORTx register so this is possible.
What I'm not sure of is how much the output pin droops. If it droops enough
to be read as a LOW (which I'm assuming that it does given the "short"), then it
could be used to make a great little test sketch to tell people if their
shield has this issue.


On an actual "fix"
A better alternative  to moving the resistor would be to replace the transistor
with an FET like a 2n7000.
That way you can still leve the pullup resistor in place to ensure the backlight
is on by default and there is no issue of shorting out D10  like with a NPN transistor
since the FET gate doesn't draw/sink current like the NPN base does.


--- bill
Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 91
Posts: 3646
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What I'm not sure of is how much the output pin droops. If it droops enough to be read as a LOW (which I'm assuming that it does given the "short")
With the base-emitter junction of a transistor pulling it down, it will droop, make no mistake!  The technique would not be so useful to detect for example, being connected to the backlight LED with no series resistor.

A better alternative  to moving the resistor would be to replace the transistor with a FET like a 2n7000.
Presupposing you have a drawer full of surface-mount FETs.  I do not, and being late at night, I did not feel like exhuming my SMD resistor stock from the garage either.  smiley-lol



I asked Nick to make this a "sticky" as the matter is to my mind, just so important (with the clear risk of damage to MCU boards).
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2732
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The backlight pin output does seem to droop low enough on an unmodified shield
when attempting to turn on the backlight.
I created a sketch that will automatically detect if the shield
has a backlight circuit issue.
It will display results on the LCD.
See the sketch for full details.
It is attached.

--- bill

* LCDKeypadCheck.pde.zip (2.22 KB - downloaded 751 times.)
Logged

Pages: 1 2 3 [4] 5 6 ... 8   Go Up
Jump to: