# Nokia 5110 backlight

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;
while(1){
PORTB |= 0b00000001;
_delay_ms(2000);
PORTB &= ~(0b00000001);
_delay_ms(500);
}
}


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?

# EDIT:

Here's the board I'm using:

Ebay

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

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.

• 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? – Tyler Feb 17 '16 at 22:40
• @Tyler No. Input mode is a High Impedance mode. The correct way is Output Low/High. – Passerby Feb 17 '16 at 22:51
• Thanks. I didn't know what high impedance meant. Knowing that term to search for was very helpful! – Tyler Feb 18 '16 at 0:31
• @tyler High Impedance, high resistance input of 100k~1m Ω. The output low actually connects to ground. – Passerby Feb 18 '16 at 0:34