I'm learning how to run a Nokia 5110 LCD (similar to this) using an atmega328p chip. I don't understand how the backlight works. If I power the LED/backlight from one of the chip pins, it turns on when I set the pin LOW, rather than HIGH. For example, with the LCD backlight connected to PB0, and using the following code:

#include <avr/io.h>
#include <util/delay.h>

int main(void){
    DDRB |= 0b00000001;
        PORTB |= 0b00000001;
        PORTB &= ~(0b00000001);

The backlight is off for two seconds and on for 0.5 seconds each time through the loop. I checked the voltage to confirm, and when PB0 is high (3.3V), the backlight is off, and PB0 is low (0V) when the backlight is on. If I connect the backlight directly to ground, it stays on.

The tutorials I've been reading (e.g. SparkFun and Adafruit, and yes they're for Arduino but I'm just using the atmega328p chip) clearly show the backlight being connected to a voltage supply, not ground.

My question is: is this normal, or have I got an oddball Nokia screen with the backlight wiring reversed? How should I be wiring/controlling the backlight?


Here's the board I'm using:


I notice now that it lists a 'backlight control terminal', rather than a backlight VCC as in the tutorials I'm using.


1 Answer 1


This just means that the leds on your board (they are not integrated into the lcd itself), have their anodes connected to V+, likely though a resistor. And you control their anodes. Alternatively there is a PNP high side control transistor.

It's not uncommon to have common anode led setups. Logic is inverted, that's all.

Without knowing the specific board you have we can't confirm. The linked auction provides no schematic or usage info at all, and the LCD blocks the traces on the top side making it hard to trace as well. It doesn't seem to use a transistor. (Assuming you got the exact one pictured. Bay shops sometime substitute similar parts.)

You could unclip the lcd and take good pictures of both sides to see.

A similar version on this blog post shows that it also has an active low light control, connected directly to ground (always on). Another with active low to a gpio. So basically its just a variation on the board layout/schematic. Doesn't really change anything in the end other than the on/off logic.

  • \$\begingroup\$ I see. I've linked to the board itself, which is a no-name ebay version. I assume then that the backlights must draw current from the main power supplied to the board. Does it make sense for me to control the backlights with a pin configured for output (as in my example code), or should I be setting the pin to input mode? \$\endgroup\$
    – Tyler
    Feb 17, 2016 at 22:40
  • 1
    \$\begingroup\$ @Tyler No. Input mode is a High Impedance mode. The correct way is Output Low/High. \$\endgroup\$
    – Passerby
    Feb 17, 2016 at 22:51
  • \$\begingroup\$ Thanks. I didn't know what high impedance meant. Knowing that term to search for was very helpful! \$\endgroup\$
    – Tyler
    Feb 18, 2016 at 0:31
  • \$\begingroup\$ @tyler High Impedance, high resistance input of 100k~1m Ω. The output low actually connects to ground. \$\endgroup\$
    – Passerby
    Feb 18, 2016 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.