{"id":32,"date":"2015-04-02T15:59:52","date_gmt":"2015-04-02T11:59:52","guid":{"rendered":"http:\/\/elmeranta.fi\/blog\/?p=32"},"modified":"2016-03-08T15:35:28","modified_gmt":"2016-03-08T11:35:28","slug":"1602-16x2-i2c-lcd-display","status":"publish","type":"post","link":"https:\/\/elmeranta.fi\/blog\/2015\/04\/1602-16x2-i2c-lcd-display\/","title":{"rendered":"1602 I2C LCD display on the Raspberry Pi"},"content":{"rendered":"<div id=\"attachment_33\" style=\"width: 810px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/IMG_18122-e1427975611836.jpg\"><img aria-describedby=\"caption-attachment-33\" loading=\"lazy\" class=\"size-full wp-image-33\" src=\"http:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/IMG_18122-e1427975611836.jpg\" alt=\"1602 LCD\" width=\"800\" height=\"380\" \/><\/a><p id=\"caption-attachment-33\" class=\"wp-caption-text\">The 1602 LCD display with 2 rows, 16 characters each. Connected with a I2C backboard. Currently showing the (Python read) temp and humidity output from a DTH11 sensor.<\/p><\/div>\n<p>So you want some output from your RPi without an actual display attached?<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_34\" style=\"width: 310px\" class=\"wp-caption alignright\"><a href=\"http:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/i2cbackplate.png\"><img aria-describedby=\"caption-attachment-34\" loading=\"lazy\" class=\"wp-image-34 size-medium\" src=\"http:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/i2cbackplate-300x142.png\" alt=\"I2C backplate\" width=\"300\" height=\"142\" srcset=\"https:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/i2cbackplate-300x142.png 300w, https:\/\/elmeranta.fi\/blog\/wp-content\/uploads\/2015\/04\/i2cbackplate.png 500w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-34\" class=\"wp-caption-text\">The I2C connector that has 4 pins for the RPi connection. The potentiometer is for LCD contrast and it has a power on LED on the right, above the jumper.<\/p><\/div>\n<p>One of the cheapest solutions is to get a 16&#215;2 or a 20&#215;4 (ie 1602 or 2004) LCD display. You can get versions that have a I2C backplate or just the actual display with 16 connectors.<\/p>\n<p>If you&#8217;re a newbie like me, your best bet is to get one with the connector already attached since it will not cost you much more; displays with connectors go from 3 to 8 eur and the connector separately for around 1,3 eur. Also, less wires and NO soldering required.<\/p>\n<p>The connector uses only 4 pins on the RPi; 5V, ground and two data busses, the SDA and SCL.<\/p>\n<p>Since the connection type is serial, you could theoretically attach multiple displays as long as they all use a different address. The problem is that 99,9% of them use the same address; ie. address 27.<\/p>\n<p>By default Raspian, which I&#8217;ll use in my examples, has the I2C disabled &#8211; so make sure the first thing you do is enable it either by running the raspi-config or <a href=\"http:\/\/www.raspberry-projects.com\/pi\/pi-operating-systems\/raspbian\/io-pins-raspbian\/i2c-pins\">editing the config files<\/a>. Don&#8217;t forget to install python-smbus and i2c-tools either.<\/p>\n<p>Now, the most &#8220;working&#8221; combination of Pyton code and libraries I&#8217;ve found, since most of the actual 1602 stuff is written for Arduino, was <a href=\"https:\/\/gist.github.com\/DenisFromHR\/cc863375a6e19dce359d\">here<\/a>.<\/p>\n<p>(Maybe I&#8217;ll post the actual code I&#8217;m running to read my hard dive space and the temp\/humidity later&#8230;)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you want some output from your RPi without an actual display attached? &nbsp; One of the cheapest solutions is to get a 16&#215;2 or a 20&#215;4 (ie 1602 or 2004) LCD display. You can get versions that have a I2C backplate or just the actual display with 16 connectors. If you&#8217;re a newbie like [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":33,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[11,12,10,9],"_links":{"self":[{"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/posts\/32"}],"collection":[{"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":8,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions\/80"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/media\/33"}],"wp:attachment":[{"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elmeranta.fi\/blog\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}