Images representing different hobbies

If you find this website useful, check out my books or visit my Amazon Author page.

Across the internet there are plenty of threads discussing the poor circuitry for the DFrobot LCD Keypad Shield. This is an interface board that plugs into laregr Arduino boards to provide a 16x2 LCD and a set of control buttons.

The problem is that the backlight is controlled by a transistor and switched on by default by a resistor to +5v. The transistor's base is also connected directly to the D10 pin of the hosting Arduino.

This all works fine until you use the Arduino to try and control the brightness of the backlight. By default the pin is an input and so the resistor switches on the transistor and the display.

Make D10 and output and when it is LOW it over-rides the pull-up resistor and switches the backlight off.

If you make D10 high, the backlight comes on, but because the base of the transistor is now saturated it will take pretty much as much current from d10 as the pin can supply, overheating and potentially damaging the AVR microcontroller chip which is the heart of the Arduino. Not good.

Various solutions have been suggested but the easiest to get right and one that is totally effective is to put a 470R resistor between the D10 pin and the base of the transistor. This limits the current from D10 to about 10mA, which is still high for a control signal (enough to light an LED) but well within the chip's capabilities. Note that a 1K resistor won't be enough to switch off the backlight (it forms a potential divider with the existing pull up resistor).

The problem is knowing exactly where to fit this resistor, and what type to use. I used an 0603 surface mount resistor, but an 0804 which is a bit bigger and easier to handle with tweezers will fit (I just didn't have a 470R 0804 resistor).

This photo shows where the resistor fits, you have to cut the trace directly under it:

DF robot Backlight Fix

I use the tip of a scalpel blade to scratch off the lacquer on the trace from the D10 pin, then cut a tiny a gap in the copper (use a multimeter to check the gap is real!) With a small soldering iron tip I carefully tinned the trace either side of the gap then placed the resistor with precision tweezers. I am fortunate to have a proper rework station so I used a hot air gun (with minimum airflow) to reflow the solder and fix the resistor in place. If you have only a soldering iron, hold the resistor down with the end of the tweezers and hold the soldering iron tip against it until the solder flows. It can be done, I have made up whole SMT boards this way!

Check the resistor is properly connected and not shorted using a multimeter.

To control the backlight, you can incorporate this simple code snippit :

//Set up the brightness control:

#define backlight 10    //Pin D10

int brightness = 100; //Brightness can be anywhere from 0 to 255

pinMode(backlight,OUTPUT); //Sets the D10 pin as output - only do this after the resistor mod.

//To change brightness, alter its value as required then send it using this line:

analogWrite(backlight,brightness);

In practice this give really good results from full brightness to a completely dark display, and no overheating!