Feeds:
Posts
Comments

Archive for the ‘Netduino’ Category

I have been prototyping several projects with a Netduino, an open source electronics platform using the .NET Micro Framework. In this post I’ll detail how to wire a Nokia 5110 Graphic monochrome LCD to a Netdiuno/Netduino Plus to provide a display for your micro applications. Most of this project is based the information from this wiki: Nokia 5110 LCD

Parts List:

  • Netduino / Netduino Plus
  • Graphic LCD 84×48 – Nokia 5110
  • Solder / Male Headers / 24 gauge wire / Soldering iron
  • Breadboard

Step 1 – Prepare the LCD display

The LCD display comes raw, with no pins or cables or connectors pre-installed, so the first step is to solder the connections to the LCD board. In my case I decided to use Male Headers so that I could attach the display to a breadboard for easy prototyping.

nokia_5110_lcd

To solder the pins it is best to insert them into the breadboard and overlay the circuit on top of the pins, applying solder on the small head of the header that protrudes past the circuit board. This way (a) you guarantee that the pins will be straight and aligned; (b) you do not need to be doing acrobatics with the circuit, pliers holding the pin, soldering iron and solder, and (c) all pins are the same length.

Step 2 – Wiring

Once you have the LCD soldered, then it is time to lay it on the breadboard (if not there already), and wire the cables between the Netduino and the LCD. I followed the exact layout found on the Nokia 5110 LCD wiki:

LCD Pin Description Netduino
1 – VCC Power 3.3V
2 – GND Ground Gnd
3 – SCE Chipselect; any GPIO pin of the Netduino Digital 10
4 – RST Reset; any GPIO pin of the Netduino Digital 7
5 – D/C Data/Command switch; any GPIO pin of the Netduino Digital 8
6 – DN(MOSI) Digital pin 11
7 – SCLK Digital pin 13
8 – LED LED: Backlight; any PWM pin of the Netduino Digital 9

Step 3 – Code

Assuming that you already have the .NET Micro SDK, Netudino SDK, and you know how to create a Netduino Project (if not, follow this tutorial: ), grab the code from the Netduino Nokia 5110 LCD wiki and you should be up and running.

Step 4 – Adjustments

At least for me, the code straight from the Wiki did not produce the expected results. The contrast on the LCD was off, and the screen was too dark. SO I had to do a bit of digging into the specs for the LCD and found out that the contrast can be controlled by adjusting the Vop, that is the second byte of the initialization sequence. Here is the initialization sequence code, with comments:

private void Initialize()
        {
            reset.Write(false);
            reset.Write(true);
            dataMode.Write(false);
            spi.Write(new byte[]
              { 0x21, // LCD Extended Commands.
                0xB1, // Set LCD Vop (Contrast). //0xB0 for 5V, 0XB1 for 3.3v, 0XBF if screen too dark
                0x04, // Set Temp coefficient. //0x04
                0x14, // LCD bias mode 1:48. //0x13 or 0X14
                0x0C, // LCD in normal mode. 0x0d for inverse
                0x20, // We must send 0x20 before modifying the display control mode
                0x0C // Set display control, normal mode. 0x0D for inverse, 0x0C for normal
            });
            dataMode.Write(true);
            Clear();
            Refresh();
        }

Step 5 – DIY

Once you reach this step, you now have a working LCD display with your Netduino, now it is up to you to figure out what is that you will display in it.

Resources

Nokia 5110 LCD wiki – http://wiki.netduino.com/Nokia-5110-LCD.ashx?NoRedirect=1

SparkFun Product page – http://www.sparkfun.com/products/10168

LCD datasheet – http://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf

Netduino Forum info – http://forums.netduino.com/index.php?/topic/4621-nokia-5100-lcd-controlling-contrast/

Read Full Post »