{"id":10968,"date":"2016-01-10T15:32:51","date_gmt":"2016-01-10T20:32:51","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=10968"},"modified":"2016-11-09T10:59:02","modified_gmt":"2016-11-09T15:59:02","slug":"chipkit-nokia-5110-lcd-example","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/chipkit-nokia-5110-lcd-example\/","title":{"rendered":"chipKIT Tutorial 7: Using Nokia 5110 LCD"},"content":{"rendered":"<p>In <strong><a href=\"http:\/\/embedded-lab.com\/blog\/chipkit-tutorial-4-interfacing-a-character-lcd\/\" target=\"_blank\">Tutorial 4<\/a><\/strong>, we learnt interfacing\u00a0an HD44780-based LCD to\u00a0a chipKIT board for displaying alphanumeric output. Today, we will see how to connect a NOKIA 5110 graphical LCD (used in\u00a0Nokia 5110 cell phones), which is\u00a0a\u00a084&#215;48 pixel monochrome display of about 1.5&#8243; diagonal in size. The display can be used for graphics, text, and bitmaps.<\/p>\n<div id=\"attachment_10972\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Title.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10972\" class=\"wp-image-10972 size-medium\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Title-580x447.jpg\" alt=\"T7_Title\" width=\"580\" height=\"447\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Title-580x447.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Title.jpg 585w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10972\" class=\"wp-caption-text\">chipKIT Nokia 5110 LCD interfacing<\/p><\/div>\n<h4>Theory<\/h4>\n<p>Nokia 5110 LCD was used in Nokia&#8217;s popular 5110 and 3310 model cell phones. It is a 48&#215;84 pixels matrix LCD driven by the\u00a0low-power <a href=\"https:\/\/www.sparkfun.com\/datasheets\/LCD\/Monochrome\/Nokia5110.pdf\" target=\"_blank\">PCD8544 controller<\/a> chip. It is powered by 3.3V and includes on-chip generation of LCD supply and bias voltages, thus requiring minimum\u00a0external components for its operation.\u00a0The PCD8544 receives display data and commands from a microcontroller through a serial bus interface. There are multiple Nokia 5110 LCD modules in the market; they all come pre-mounted on a PCB and look similar but the pin arrangements might be different in some modules. This is a very popular display among the Arduino community because of its low cost (~$3 on eBay) and simplicity to use with easily available open-source libraries. The LCD requires 5 I\/O pins for full control.\u00a0The pins available in almost every Nokia 5110 LCD modules are listed below:<!--more--><\/p>\n<ol>\n<li>RST: Display reset input<\/li>\n<li>CE: Chip enable input<\/li>\n<li>DC: Data or Command select signal<\/li>\n<li>DIN: Serial data input<\/li>\n<li>CLK: Clock input<\/li>\n<li>VCC: 3.3V power supply<\/li>\n<li>BL: Backlight LED anode (connect to 3.3V)<\/li>\n<li>GND: Power supply ground<\/li>\n<\/ol>\n<div id=\"attachment_10981\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/5110LCD.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10981\" class=\"size-medium wp-image-10981\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/5110LCD-580x326.jpg\" alt=\"Nokia 5510 LCD module\" width=\"580\" height=\"326\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/5110LCD-580x326.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/5110LCD.jpg 585w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10981\" class=\"wp-caption-text\">Nokia 5510 LCD module<\/p><\/div>\n<h4>Circuit Setup<\/h4>\n<p>For this experiment, we are using chipKIT Uno32 pins 8 through 12 to drive the data and signal lines of the Nokia 5110 LCD module. The connections are made as follows:<\/p>\n<div id=\"attachment_12505\" style=\"width: 519px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/PinConnections1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-12505\" class=\"size-full wp-image-12505\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/PinConnections1.jpg\" alt=\"Pin connections between Nokia 5110 LCD and chipKIT Uno32\" width=\"509\" height=\"222\" \/><\/a><p id=\"caption-attachment-12505\" class=\"wp-caption-text\">Pin connections between Nokia 5110 LCD and chipKIT Uno32<\/p><\/div>\n<p>We will also connect\u00a0a DHT22 temperature and humidity sensor to the chipKIT Uno32 to add more fun to our experiment. DHT22 is a low-cost temperature and humidity sensor that provides calibrated digital outputs through a single wire digital interface. The following figure shows the pin diagrams of the DHT22 sensor.<\/p>\n<div id=\"attachment_10988\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/DHT22pins.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10988\" class=\"size-medium wp-image-10988\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/DHT22pins-580x350.jpg\" alt=\"DHT22 pin diagram\" width=\"580\" height=\"350\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/DHT22pins-580x350.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/DHT22pins.jpg 590w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10988\" class=\"wp-caption-text\">DHT22 pin diagram<\/p><\/div>\n<p>A pull-up resistor (usually 4.7K) must be connected between the Data and VCC pins. In our experiment, the sensor data pin is connected to pin 7 of chipKIT Uno32, while the sensor is powered through the 3.3V supply pin on the chipKIT Uno32 board. The complete setup of this experiment is shown below.<\/p>\n<div id=\"attachment_10971\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Setup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10971\" class=\"wp-image-10971 size-medium\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Setup-580x444.jpg\" alt=\"T7_Setup\" width=\"580\" height=\"444\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Setup-580x444.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_Setup.jpg 585w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10971\" class=\"wp-caption-text\">chipKIT Uno32, Nokia LCD, and DHT22 setup<\/p><\/div>\n<h4>Writing sketch<\/h4>\n<p>We will need to install two libraries for developing the firmware for this experiment. The first library required is the standard <em>Arduino DHT22 library<\/em>, which is modified by <a href=\"http:\/\/electronics.trev.id.au\/wp-content\/uploads\/2013\/07\/DHT22.zip\" target=\"_blank\">Trevor van der Linden <\/a>to make it work with chipKIT platform. The second one is <strong><a href=\"http:\/\/www.rinkydinkelectronics.com\/library.php\" target=\"_blank\">Nokia 5110 LCD library<\/a><\/strong> for chipKIT from <a href=\"http:\/\/www.rinkydinkelectronics.com\/\" target=\"_blank\">Rinky-Dink Electronics<\/a>. There are two versions of the LCD libraries: <strong><a href=\"http:\/\/www.rinkydinkelectronics.com\/download.php?f=LCD5110_Basic.zip\" target=\"_blank\">LCD5110_Basic<\/a><\/strong>, which supports texts, and <strong><a href=\"http:\/\/www.rinkydinkelectronics.com\/download.php?f=LCD5110_Graph.zip\" target=\"_blank\">LCD5110_Graph<\/a><\/strong>, which supports text, graph, and bitmaps. Download and install these libraries to your mpide\/libraries\/ folder using the following download links.<\/p>\n<p><strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/DHT22.zip\">Download DHT22 Library<\/a><\/strong><\/p>\n<p><strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/LCD5110_Basic.zip\">Download LCD5110_Basic<\/a> <\/strong><\/p>\n<p><strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/LCD5110_Graph.zip\">Download LCD5110_Graph<\/a><\/strong><\/p>\n<p>The chipKIT program for this experiment can be downloaded from the following link:<\/p>\n<p><strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T10_Nokia5110LCD.zip\">Download chipKIT Sketch<\/a><\/strong><\/p>\n<h4>Output<\/h4>\n<p>After uploading the chipKIT firmware, the temperature and humidity measurements are displayed on the LCD screen as shown below. The values are refreshed every 5 seconds.<\/p>\n<div id=\"attachment_10970\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_OP2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10970\" class=\"wp-image-10970 size-medium\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_OP2-580x381.jpg\" alt=\"T7_OP2\" width=\"580\" height=\"381\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_OP2-580x381.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/T7_OP2.jpg 585w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10970\" class=\"wp-caption-text\">Temperature and humidity measurements on Nokia 5110 LCD<\/p><\/div>\n<p>The <a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/LCD5110_Graph.zip\" target=\"_blank\">LCD5110_Graph<\/a> library\u00a0comes\u00a0with some examples of graphical and bitmap displays, which can be found inside the examples sub-folder and accessed easily through MPIDE\u00a0environment from <strong>File-&gt;Examples<\/strong> navigation menu as shown below:<\/p>\n<div id=\"attachment_10998\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/Examples.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10998\" class=\"size-medium wp-image-10998\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/Examples-580x452.jpg\" alt=\"Accessing examples from MPIDE\" width=\"580\" height=\"452\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/Examples-580x452.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/Examples.jpg 770w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-10998\" class=\"wp-caption-text\">Accessing examples from MPIDE<\/p><\/div>\n<p>I would highly recommend to test and run these examples to get more familiar with the LCD5110 libraries. Simply upload these examples one by one to the Uno32 board without making any changes to the current circuit setup and see the action on the LCD screen.<\/p>\n<div id=\"attachment_10999\" style=\"width: 564px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/OtherExamples.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10999\" class=\"size-full wp-image-10999\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/01\/OtherExamples.jpg\" alt=\"Running sine wave, chipKIT logo, and Pacman examples\" width=\"554\" height=\"203\" \/><\/a><p id=\"caption-attachment-10999\" class=\"wp-caption-text\">Running sine wave, chipKIT logo, and Pacman examples<\/p><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Tutorial 4, we learnt interfacing\u00a0an HD44780-based LCD to\u00a0a chipKIT board for displaying alphanumeric output. Today, we will see how to connect a NOKIA 5110 graphical LCD (used in\u00a0Nokia 5110 cell phones), which is\u00a0a\u00a084&#215;48 pixel monochrome display of about 1.5&#8243; diagonal in size. The display can be used for graphics, text, and bitmaps. Theory Nokia 5110 LCD was used in Nokia&#8217;s popular 5110 and 3310 model cell phones. It is a 48&#215;84 pixels matrix LCD driven by the\u00a0low-power PCD8544 controller chip. It is powered by 3.3V and includes on-chip generation of LCD supply and bias voltages, thus requiring minimum\u00a0external components<\/p>\n","protected":false},"author":1,"featured_media":10969,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[401],"tags":[1342,1343,425],"class_list":["post-10968","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chipkit","tag-chipkit-and-lcd","tag-chipkit-nokia-5110-lcd","tag-chipkit-tutorial"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/10968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=10968"}],"version-history":[{"count":20,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/10968\/revisions"}],"predecessor-version":[{"id":12506,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/10968\/revisions\/12506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/10969"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=10968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=10968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=10968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}