Nokia 5110 Display Connection To Arduino Nano
Remember the days when mobile phones were “oak”Did they have a separate button keyboard and a small monochrome LCD?
Now this market belongs to every iPhone, Galaxy, etc., but displays are finding new uses for themselves: DIY projects!
The black-and-white display of 84×48 pixels, which we will consider, was used in Nokia 3310 phones. Their main advantage. ease in management. Such a display will fit perfectly into your project for interactive exchange of information with the user.
In this article, we will look at controlling this graphic display with the Arduino. All connection features, display specifications and a program for Arduino are considered.
- Arduino or her clone.
- Circuit board.
Nokia 5110 display specifications
Before connecting the display and programming the Arduino, let’s look at general information about it.
To connect and transmit data on the display, two parallel rows of 8 connectors are used. On the back of the display there are symbols for each pin.
As already mentioned, the pins are connected in parallel with each other. The purpose of each connector is given below.
You have already noticed that the 5110 LCD has two power connectors. First. the most important. power logic display. The datasheet indicates that it should be selected in the range 2.7. 3.3 V. In normal operation, the display will consume 6 to 7 mA.
The second power connector is designed to illuminate the display. If you remove the display itself from the board (this is not necessary, you can just look at the figure below), you will see that the backlight is implemented very simply: four white LEDs that are located at the corners of the board. Please note that there are no current limiting resistors.
So with food you need to be careful. You can use a current-limiting resistor when connecting the ‘LED’ pin or use a maximum supply voltage of 3.3 V. Do not forget that LEDs can absorb large currents! Without limitation, they will pull about 100 mA at a supply voltage of 3.3 V.
The controller is integrated in the display: Philips PCD8544, which converts the massive parallel interface into a more convenient serial interface. The PCD8544 is controlled using a synchronous serial protocol, which is similar to SPI. Note that there are time counter pins (SCLK) and serial data input (DN), as well as active-low chip selection (SCE).
Above the serial connectors considered, another connector is installed. D / C, which receives information on whether the data that can be transmitted can be displayed.
For a list of commands, see the “Instructions” section of the PCD8544 datasheet (page 11). There are commands that clear the display, invert pixels, turn off the power, etc.
Assembling and connecting the 5110 display
Before downloading the sketch and transferring data to the display, you need to deal with the connection. To do this, you need to solve the issue of its assembly and connection to Arduino.
For “assembly” Display connectors may come in handy. 8 pieces will be enough. You can use straight legs or located at 90 degrees. Depends on future use. If you plan to use a mounting plate, straight rail connectors are likely to be the best choice.
Nokia 5110 LCD display mounted on the mini-circuit board:
You can directly solder the adapters to the display.
Connecting 5110 Display to Arduino
In this example, we will connect the LCD display to the Arduino. A similar technique can be easily adapted to other boards and microcontrollers. To connect data pins. SCLK and DN (MOSI). we use the Arduino SPI pins, which provide fast data transfer. Chip selection (SCE), reboot (RST), and data / control (D / C) pin can be connected to any digital pin. The output from the LED is connected to a pin on the Arduino, which supports PWM modulation. Thanks to this, a flexible adjustment of the backlight brightness is possible.
Unfortunately, the maximum supply voltage of the 5110 display can reach 3.6 volts, so you can’t connect directly to the standard 5 V output on the Arduino. The voltage must be adjusted. Accordingly, there are several connection options.
Direct connection to Arduino
The easiest way to connect to Arduino directly. In this case, use Arduino Pro 3.3V / 8MHz or 3.3V Arduino Pro Mini boards. The option suggested below works with Arduino 5V boards. This is a working option, but the life of the display may be slightly reduced.
The pins are connected as follows:
A good and inexpensive option for extra protection. installation of resistors between the pins of the data transfer pins from the Arduino to the LCD 5110. If you are using an Arduino Uno (or a similar 5-volt board), you can use resistors with a nominal value of 10 kOhm and 1 kOhm. The connection diagram of the display using resistors is shown in the figure below:
The connection is the same as in the first example, but a resistor is installed in each signal circuit. 10 kΩ resistors are installed between the SCLK, DN, D / C and RST pins. 1 kΩ resistor between the SCE pins and pin 7. Well, 330 ohms remain between pin 9 and the pin with the LED. and pin 7.
The third connection option. using level converters to switch between 5 and 3.3 V. For these purposes, you can use the Bi-Directional Logic Level Converter or TXB0104 modules.
Unfortunately, the display has five inputs for a 3.3 V signal, and on level converters. four. You can leave the RTS output in a high state (by connecting it using a 10 kΩ resistor). As a result, you lose control over the display reload, but all other functions will be available.
First sketch example for Arduino: LCD Demo
After a successful connection, you can proceed to downloading the sketch and displaying the data on the display!
Program for Arduino
Below is a link where you can download a sketch for LCD control. Copy the code into the Arduino IDE and download to the board:
The comments in the code above should help you understand the program. Most actions occur within the lcdFunTime () function.
Sketch in action
After uploading to Arduino, the sketch will begin to work out and launch a demo. a set of standard animations and refinement of graphic functions. First, display a few pixels. After that, we will go on to display lines, rectangles and circles, load a bitmap image, etc.
After working out the sketch, the monitor will switch to data transfer mode using the serial protocol. Open the serial monitor (at 9600 bps). What you print on the serial monitor will be displayed on the LCD monitor.
If you are interested in the ability to display bitmap images, read on. We’ll look at how you can import your own 84×48 bitmap and display it on the screen.
Second sketch example for Arduino: loading and displaying bitmaps
In this example, we will create a new 84×48 bitmap, integrate it into the Arduino code and send it to the LCD monitor.
Find / Create / Change the bitmap
To get started, find the image that you want to display on the 5110 LCD screen. It will not work hard to turn around 84×48 pixels, but you can still. Here are some examples:
After selecting an image, you need to correct it: make it monochrome (2-bit color); withstand the size of 84×48 pixels. You can use most image editors for this. Including Paint, if you have Windows. Save the resulting image.
Convert a raster image to an array
The next step is to convert this file to a 504-byte character array. You can use various programs for this. For example, LCD Assistant.
To upload an image to the LCD Assistant, go to the File menu Load image. A window with a preview image should open. Make sure the picture is the correct size. 84 pixels wide, 48 pixels high, and the Byte orientation setting is set to Vertical, Size endianness in Little. The rest of the default settings should be set correctly (8 pixels / byte)
After that, go to the File tab Save output to generate a temporary text file. Open this text file to view your new wonderful array. Change the type of the array to char (not unsigned and not const). Also make sure that the array is correctly named (without a dash, does not start with a number, etc.).
Import into sketch and draw!
Copy the created array to the sketch for Arduino. You can use the sketch from the first example. Insert your array anywhere. Now, to display your drawing, replace setup () and loop () in the sketch with the lines shown below (while the rest of the functions and variables remain unchanged):
//. variables, constants and array of bitmap defined above
lcdBegin (); // Set up pins and initialize the LCD
setContrast (60); // Adjust contrast (preferred range is from 40 to 60)
setBitmap (flameBitmap); // flameBitmap must be replaced with the name of your array
updateDisplay (); // Update display to display array
// Functions for control and graphics on the LCD are defined below.
True, it turned out cool? Among other things, you can import multiple images and create small animations! Try it, I’m sure you will like it!
Links for downloading additional programs, libraries and datasheets
LCD datasheets and drivers
Arduino Libraries and Sketches
Leave your comments, questions and share personal experiences below. New ideas and projects are often born in discussions!