NOTE: 2016-11-15For those that would like to do backlight control, you can use my hd44780 LCD library package (available in the IDE library manager) that supports backlight control and will auto detect this issue and work around the issue in s/w for shields that have the issue.See this thread post for more information:https://forum.arduino.cc/index.php?topic=96747.msg2998589#msg2998589

See the reference schematic (look closely at the transistor that controls the backlight)[attached below]

The idea was that the backlight would be on by default and then pin D10 could control it.The 4.7k pullup turns on the transistor if D10 is an input and the transistor turns off whenD10 is low. It was supposed to also turn the backlight on when D10 is HIGH.

In those backlight circuit designs, the problem is that the Arduino pin is shorting to ground through thetransistor when the pin is high. Yes the backlight is on and it "appears" to be working but it is massivelyoverloading the Arduino pin which may eventually cause problems and perhapseven burn out the pin.I'm amazed that it even works at all.

The real solution is a different backlight circuit design.It is also possible to alter the circuit on the shield; however,the issue I had on my emartee shield is that the pullup and the transistorare under the LCD which is soldered to the shield/board, which really limited what couldbe done without de-soldering the LCD.

The answer is to add a diode between D10 and the base so that D10 canpull the base low but not short out when D10 is HIGH.It turns out that this can actually be done on the emartee board without desolderingthe LCD. The trace to D10 goes around the header than drops through the board.The trace can be cut and a diode dead bugged to the board.

Another issue is that you can't use a typical silicon signal diode like a 1n4148 as the voltagedrop is too high and the backlight will not go all the way off. I used a germanium diode 1n34a - which worked perfectly and the AVR no longer gets warmunder heavy LCD activity with the backlight on.

As an alternative a 1/8th watt ~510 ohm resistor could be used.Not as power efficient as the diode when d10 is high (wastes about 8ma) but works ok.(backlight will also not be 100% off but so dim that you won't see it)

There is also a software alternative which is to set the pin to input mode to turn the backlighton and to output and low to turn the LED off. This will work fine for on/off control.If this method is used, avoid using PWM.

If you don't want/need backlight control and are ok with having the backlight on all the time, cutting the D10 header pin from the lcd/keypad shield might be the easiest solution.Once you cut that header pin, there will be no issues and D10 is available for other uses like other shields underneath the LCD/keypad shield.

I attached photos of the emartee board and my diode mod, to allow safe backlight control.

--- bill

Note:updated to include SainSmart lcd keypad.2014-01-20 updated to include osepp lcd keypad

NOTE: 2014-02-16 I have attached a zip image which contains a text file that details some s/w only workarounds.(I used a zip image because the forum messes with line endings on text files andI wanted the file to have DOS line endings to support the users still using Windows)

NOTE:2014-04-16updated 2nd photo to show back side of header.The diode attaches to a trace that goes behind the header and wrapsaround to Arduino pin D10. It does not connect to Arduino pin D8.

For those wanting to test their shield for this problem, there is an easy test.2017-11-04 Update:The test below can cause damage to the lcd shield.It is no longer recommend.Use the test sketch, or the hd44780 library and its test sketch to test for the issue.Refer back to the original post for details.

Remove the shield from the arduino.

Attach a wire to the D10 pin on the shield.Hook up ground and 5v to the corresponding shield pins.

When power is turned on, the backlight should light.

Ground the wire going to D10, the backlight should go off.

Now for a simple test.

Briefly (and I mean just a brief touch) connect the wire from D10 to Vcc.If the backlight, blinks when you touch the D10 wire to VCC, the shieldhas this issue.

Do not set D10 to HIGH or use PWM on this shield unless you modify it.You can still control the backlight .First set D10 to LOW. (only need to that once)

Then set the D10 to OUTPUT for off and INPUT for on.

UPDATE: (2014-07-03)It is possible that there is still an issue even if the backlight doesn't "blink" duringthe above test. This could happen if the excess current draw isn't large enough to causea power issue for the backlight when doing the above test.It is possible that the current demand is still way beyond whatan AVR pin can safely supply.If this is the case, it might work a while but could end up frying the AVR over time.

The best way to test for an issue is to actually measure the current on the D10 pin when it is being driven high.To do this, wire up the shield as described above but then measure the current between the D10 pin and VCC.Set your meter for current with + probe going to VCC and - probe going to the D10 pin on the shield.If you measure more than about 30ma, the backlight circuit has the issue.

The dfRobot backlight circuit was attempting to provide a circuit that allowed backlight controlbut turned it on by default. This can be important when using the supplied LiquidCrystallibrary which has no backlight control, since the reverse style LCDs (white on blue etc...)would look "dead" until you turn the backlight on.I'm sure many novice Arduino users would stumble on this.

While it does turn on the backlight by default, which allows reverse style LCDs tobe visible using the IDE supplied LiquidCrystal hd44780 library,and allow the backlight to be turned off by setting D10 to LOW,it shorts the AVR pin when the user later attempts to turn on the backlight back on by setting D10 to HIGHor when PWM is used.

Before I modified the shield, when D10 was HIGH, I measured the current on the AVR pin at over 100ma!

I sent notes directly to both dfRobot and emartee on 2012-03-14 and so far no response.

--- bill

Update:I notified RobotShop this morning of the flaw and they responded in less than 45 minutesthat they will be contacting the manufacturer about the issue.

Quote

We thank you for pointing this issue out.We were not aware of this problem and will contact the manufacturer in order to work out a solution.We will also add a note on the current product in order to prevent people from burning their boards.

Thanks Bill. That's right. It's unfair to compare my back pack with their shield. My back pack has an ATMEGA328 so it starts up and recalls back light amount from EEPROM but their shield has no such mechanism. But what about using a depletion mode MOSFET? if the D10 is input on reset, the MOSFET conducts, unless you turn it off by a 5V. Will that solve this shield problem?

Thanks Bill. That's right. It's unfair to compare my back pack with their shield. My back pack has an ATMEGA328 so it starts up and recalls back light amount from EEPROM but their shield has no such mechanism. But what about using a depletion mode MOSFET? if the D10 is input on reset, the MOSFET conducts, unless you turn it off by a 5V. Will that solve this shield problem?

There are many ways to redesign the circuit solve the problem.The final design can potentially be influenced by cost.mosfets are great, but a mosfet solution will cost more than a simple NPN transistor design.But then I'm very sensitive to costs as I came from an environment of building products in the 100k/month range.With that volume, pennies mattered.

SolarPanels,You should be able to use either the diode or the resistor.They prevent a "short" in different ways.If you don't ever set D10 high there is no issue to worry about.See reply #3 for how you can still do backlight control with this design.

The problem is that if you return it, there is no guarantee thata shield you get from somebody else won't have the same issue.I've seen several that all seem to have copied the same circuit.

The simplest would be to just keep it and either not use backlight controlor use it as described in reply #3.

I've successfully fixed the DFR-007 backlight cct error using a 1N5819 Schottky diode (a 1N5817 or 1N5818 even better) inserted between the base of Q1 and the pin 10 post (diode cathode to pin 10). The trick was to note the PCB track between these two points is situated on the top surface of the board running out from under the LCD board, through the gap between the J1 and J2 connector strips (referenced to the DFR-007 cct http://www.robotshop.com/content/PDF/dfrobot-lcd-keypad-shield-schematic.pdf and towards the outside edge around to the pin 10 post.

This program will test the LCD panel and the buttons ofthe DFRobot LCD Keypad Shield for ArduinoProduct code : RB-Dfr-07http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino-1.html

Note cct error identified by Arduino forum discussion at:http://arduino.cc/forum/index.php/topic,96747.0.htmlwhich advises insertion of a Germanium 1n34a or a Schotky 1N5819diode between pin 10 and the base of Q1 (K to pin 10).

sample code originally by Mark Bramwell, July 2010modifications by Dion Weston, March 2012

// read the buttonsint read_LCD_buttons(){ adc_key_in = analogRead(0); // read the value from the sensor // my [Mark Bramwell's] buttons when read are centered at these valies: 0, 144, 329, 504, 741 // we add approx 50 to those values and check to see if we are close if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result if (adc_key_in < 50) return btnRIGHT; if (adc_key_in < 195) return btnUP; if (adc_key_in < 380) return btnDOWN; if (adc_key_in < 555) return btnLEFT; if (adc_key_in < 790) return btnSELECT; return btnNONE; // when all others fail, return this...}

A 1N5711 or a REAL Germanium (1N34 - 1N60) would be somewhat easier to mount. Any small signal germanium or schottky diode would work as well. If one pulls the base of the 'switch' transistor below about.5 volts, the transistor is in cut off, non conducting. There is however an easier method that doesn't require cutting traces and 'hanging parts on the display... and that is to replace Q1 (9013) with a BS170 or a VN2222, VNK10 or any other n channel small signal enhancement type Mosfet. The circuit looks like it was designed for a Mosfet and someone 'goofed' and put a bi-polar device in it's place.

IMO and direct experience.

Doc

--> WA7EMS "The solution of every problem is another problem." -Johann Wolfgang von GoetheI do answer technical questions PM'd to me with whatever is in my clipboard

A 1N5711 or a REAL Germanium (1N34 - 1N60) would be somewhat easier to mount. Any small signal germanium or schottky diode would work as well. If one pulls the base of the 'switch' transistor below about.5 volts, the transistor is in cut off, non conducting. There is however an easier method that doesn't require cutting traces and 'hanging parts on the display... and that is to replace Q1 (9013) with a BS170 or a VN2222, VNK10 or any other n channel small signal enhancement type Mosfet. The circuit looks like it was designed for a Mosfet and someone 'goofed' and put a bi-polar device in it's place.

IMO and direct experience.

Doc

On my shield it isn't easier to replace the transistor.This is originally what I wanted to do.The problem is that the transistor is on the shield but it is under the LCD moduleso it requires removing the LCD module to get to it.Since the lcd module is soldered to the shield it requires de-soldering all 16 pins on the lcd module header.I decided it would be easier to simply do a quick cutand solder in the diode which is completely hidden when the shield is installed.Plus since I didn't have any surface mount FETs and my though hole FETs wouldn't fitunder the LCD module when it was soldered back in place, it was my only option.

But if PWM backlight dimming is not needed, then the software work around is by far easier thanany hardware mode.

I DO Apologize for that BLUNDER, I only looked at it from an engineering (electrical not mechanical) standpoint and the Mosfet is far and away the easiest fix, for that matter good engineering where the Bi-Polar device is just CHEAP when surplus parts are chosen (as they frequently are). I do however stand by my choice of parts, there are any number of small signal schottky diodes that would be a better choice The 1N5711-2 or a now discontinued but available as surplus HP "Hot Carrier" diode HP 5082-0023??? is one and certainly a REAL Ge. diode would work as well.

Doc

--> WA7EMS "The solution of every problem is another problem." -Johann Wolfgang von GoetheI do answer technical questions PM'd to me with whatever is in my clipboard