In this easy Arduino Tutorial we are going to learn how to create a Menu on a Nokia 5110 LCD display. We are using an Arduino Uno today but you can use any Arduino you like. Let’s get started!
This is the project we are going to build. In the display a simple menu appears, and with the help of three buttons I can navigate up, or down and select a menu item. Let’s select the first option. As you can see a new a UI screen is displayed and by pressing the up and down buttons we can change the contrast of the display. If we press the middle button again, we go back to the main UI screen. If we now select the second menu item and press the middle button we can turn the backlight of the display on or off. Lastly if we navigate to the last menu item we can reset the settings for the display to the default values. Of course this is just a demonstration project, you can modify it to build your own more complex menus if you wish. Let’s now see how to build this project.
WHERE TO BUY
Arduino Uno: http://educ8s.tv/part/ArduinoUno
Nokia 5110 LCD: http://educ8s.tv/part/NOKIA5110
Small Breadboard: http://educ8s.tv/part/SmallBreadboard
Jumper Wires: http://educ8s.tv/part/JumperWires
Power Bank: http://educ8s.tv/part/Powerbank
Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!
Adafruit GFX: https://github.com/adafruit/Adafruit-GFX-Library
Nokia 5110: https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library
The code of the project is complex but I will do my best to explain it. You will get a basic understanding of how the code works but if you want to fully understand it you have to make your own menu and see exactly how it works. Let’s start.
In this project we use two libraries for the display from Adafruit. You can find links for both in the description of the video. At first we are going to take a look at the drawMenu function. This function is responsible for drawing the Menu on the display. This function is called every few miliseconds, so if there is a change on the menu this function is responsible for updating the menu on the screen. There are also two very important global variables, the variable page and the variable menuitem. The variable page remembers which UI screen is displayed on the screen. So, if the page variable is 1, we are in the main UI screen, and if the variable is 2 we are in the Contrast UI screen. The menu item remembers the selected menu item. So, if its value is 1, the first menu item is selected, so the drawMenu function must draw this menu item as black with white letters. If the menu item is 2 the second menu item is selected and so on.
CODE OF THE PROJECT
Quiz of Knowledge Android Game
You can download my latest Android Game which is called Quiz of Knowledge here:
Arduino Datalogger: https://www.youtube.com/watch?v=oei3Y6tOhVI
Arduino Weather Station Project: https://www.youtube.com/watch?v=9jN-3DtS1RI
Arduino Nokia 5110 LCD Display: https://www.youtube.com/watch?v=aDwrMeu4k9Y
Arduino OLED display tutorial: https://www.youtube.com/watch?v=A9EwJ7M7OsI
DIY Arduino: https://www.youtube.com/watch?v=npc3uzEVvc0
Educ8s.tv is a Youtube channel and website which is dedicated in developing high quality videos about DIY hardware and software projects. In this channel we develop projects with Arduino, Raspberry Pi, we build robots and simple electronic circuits. Check out our website as well for more information: http://www.educ8s.tv
SUBSCRIBE ON YOUTUBE
Never miss a video: https://www.youtube.com/subscription_center?add_user=educ8s