{"id":1408,"date":"2013-11-06T23:10:54","date_gmt":"2013-11-06T22:10:54","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=1408"},"modified":"2014-01-09T20:58:43","modified_gmt":"2014-01-09T19:58:43","slug":"raspberry-pi-connecting-a-hd44780-display-with-i2c-bus","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/raspberry-pi-connecting-a-hd44780-display-with-i2c-bus\/","title":{"rendered":"Raspberry PI: Connecting a HD44780 Display over I2C Bus"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_1408 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_1408')){$('.twoclick_social_bookmarks_post_1408').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Raspberry%20PI%3A%20Connecting%20a%20HD44780%20Display%20over%20I2C%20Bus\",\"the_excerpt\":\"Hi%20everybody%2C%0D%0A%0D%0Asome%20application%2C%20i.e.%20XBMC%20can%20show%20informations%20on%20a%20display%20by%20using%20LCDproc%20as%20driver.%0D%0A%0D%0AThis%20post%20describes%20a%20way%20to%20connect%20a%20HD44780%20display%20to%20a%20Raspberry%20PI%C2%A0%20by%20i2c%20bus.%0D%0A%0D%0ALet%27s%20start%20with%20the%20physical%20layer.%20This%20is%20the%20overview%20schematic%20on%20how%20to%20connect%20the%20display%20to%20a%20Raspberry%20PI.%0D%0A%0D%0A%0D%0A%0D%0ABased%20on%20these%20I%20developed%20small%20board%20with%20a%206%20Pin%20header%20which%20is%20Pin%20%20...\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/raspberry-pi-connecting-a-hd44780-display-with-i2c-bus\\\/\",\"post_id\":1408,\"post_title_referrer_track\":\"Raspberry+PI%3A+Connecting+a+HD44780+Display+over+I2C+Bus\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi everybody,<\/p>\n<p>some application, i.e. XBMC can show informations on a display by using LCDproc as driver.<\/p>\n<p>This post describes a way to connect a HD44780 display to a Raspberry PI\u00a0 by i2c bus.<\/p>\n<p>Let&#8217;s start with the physical layer. This is the overview schematic on how to connect the display to a Raspberry PI.<\/p>\n<figure id=\"attachment_1410\" aria-describedby=\"caption-attachment-1410\" style=\"width: 600px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_overview.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-1410  \" alt=\"Connecting a hd44780 Display with Raspberry PI  \" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_overview.png\" width=\"600\" height=\"322\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_overview.png 3679w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_overview-300x161.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_overview-1024x550.png 1024w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-1410\" class=\"wp-caption-text\">Connecting a hd44780 Display with Raspberry PI<\/figcaption><\/figure>\n<p>Based on these I developed small board with a 6 Pin header which is Pin compatible to the Raspberry PI. So a simple 6 pole ribbon cable can be used to connect the HD44780 Display to the fruit.<br \/>\nHere is my PCB. First the schematic.<\/p>\n<figure id=\"attachment_1412\" aria-describedby=\"caption-attachment-1412\" style=\"width: 600px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_schematic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-1412\" alt=\"Board schematic\" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_schematic-1024x713.png\" width=\"600\" height=\"417\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_schematic-1024x713.png 1024w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_schematic-300x209.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-1412\" class=\"wp-caption-text\">Board schematic<\/figcaption><\/figure>\n<p>and my board layout. Unfortunately there are a lot HD44780 models available and the location and the direction of the pins are different, so you have to adapt the layout to the specification of your display.<br \/>\n<!--more--><\/p>\n<figure id=\"attachment_1411\" aria-describedby=\"caption-attachment-1411\" style=\"width: 600px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_layout.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-1411\" alt=\"Sample Board Layout\" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_layout-1024x492.png\" width=\"600\" height=\"288\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_layout-1024x492.png 1024w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_layout-300x144.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780board_layout.png 2022w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-1411\" class=\"wp-caption-text\">Sample Board Layout<\/figcaption><\/figure>\n<p>A short description of the PCB.<br \/>\nThe header pins in detail:<\/p>\n<ul>\n<li>Pin1\u00a0 is the 3.3V Power Supply for the I2C Busextenter PCF8574A<\/li>\n<li>Pin 2 is the 5V Power Supply for the display<\/li>\n<li>Pin 3 I2C SDL<\/li>\n<li>Pin 5 I2C SCL<\/li>\n<li>Pin 6 GND<\/li>\n<\/ul>\n<p>All PCF8574 I2C hardwareaddress\u00a0 pins are connected to GND, therefore the I2C Address is only defined by the used variant of PCF8574:<br \/>\nPCF8574 = 0x20<br \/>\nPCF8574A = <strong>0x38<\/strong> (I use this one)<\/p>\n<p>The PCF8574 runs at 3.3V because all GPIO pins of the raspberry are\u00a0 designed to handle a maximum of 3.3v. Voltages greater than 3.3V can damage the I\/O controller.<\/p>\n<figure id=\"attachment_1456\" aria-describedby=\"caption-attachment-1456\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_board_pic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1456\" alt=\"HD44780 Board\" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_board_pic-300x227.png\" width=\"300\" height=\"227\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_board_pic-300x227.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_board_pic.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1456\" class=\"wp-caption-text\">HD44780 Board<\/figcaption><\/figure>\n<p><!--Ads1--><\/p>\n<p>I have installed the raspbmc mediacenter on my Raspberry pi. <a title=\"Raspbmc\" href=\"http:\/\/www.raspbmc.com\/\" target=\"_blank\">raspbmc <\/a>is a minimal debian based linux distribution for multimedia purposes.<\/p>\n<p>To get the display running, lcdproc must be installed and configured. Login the your raspberry by ssh and get a root shell<\/p>\n<p><code>pi@raspbmc: &gt; sudo su -<\/code><\/p>\n<p>install LCDproc, i2c tools and other stuff<\/p>\n<p><code>root@raspbmc: # apt-get install lcdproc lcdproc-extra-drivers procmeter3 i2c-tools unzip<\/code><\/p>\n<p>Check if the i2c device drivers is loaded at boot time.<\/p>\n<p><code>lsmod|grep i2c<\/code><br \/>\n<code>i2c_bcm2708 2952 0<\/code><\/p>\n<p>If the module is loaded properly, two devices should exist.<\/p>\n<p><code>ls -l \/dev\/i2c*<br \/>\n<code> \/dev\/i2c-0<\/code><br \/>\n\/dev\/i2c-1<\/code><\/p>\n<p>Note: When devices does not exist. At older versions there is also the kernel module <strong>i2c-dev<\/strong> necessary. Try to load it<br \/>\n<code>modprobe i2c-dev<\/code><br \/>\nand to load at boot time, append the module name i2c-dev to \/etc\/modules<br \/>\n<code>echo i2c-dev &gt;&gt; \/etc\/modules<\/code><\/p>\n<p>To access the I2C Bus select the correct device depending on your Raspberry. For Raspberry PI version A use<code> \/dev\/<code><code>i2c-0<\/code><\/code><\/code> and for version B <code>\/dev\/<code>i2c-1<\/code><br \/>\n<\/code><\/p>\n<p>Connect the LCD board an check if it is recognized. The parameter -y specifies the i2c bus device 0=\/dev\/i2c-0, 1=\/dev\/i2c-1. At my Raspberry PI model B:<br \/>\n<code>root@raspbmc:\/home\/pi# i2cdetect -y 1<br \/>\n0\u00a0 1\u00a0 2\u00a0 3\u00a0 4\u00a0 5\u00a0 6\u00a0 7\u00a0 8\u00a0 9\u00a0 a\u00a0 b\u00a0 c\u00a0 d\u00a0 e\u00a0 f<br \/>\n00:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --<br \/>\n40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br \/>\n70: -- -- -- -- -- -- -- --<\/code><\/p>\n<p>Next step is to define a lcdproc config file.\u00a0 Create \/etc\/LCDd.conf<\/p>\n<p><code>[server]<br \/>\nDriverPath=\/usr\/lib\/lcdproc\/<br \/>\nDriver=hd44780<br \/>\nBind=127.0.0.1<br \/>\nPort=13666<br \/>\nUser=nobody<br \/>\nHello=\"Raspbmc is starting\"<br \/>\nWaitTime=5<br \/>\nServerScreen=no<br \/>\nToggleRotateKey=Enter<br \/>\nPrevScreenKey=Left<br \/>\nNextScreenKey=Right<br \/>\n[menu]<br \/>\nMenuKey=Escape<br \/>\nEnterKey=Enter<br \/>\nUpKey=Up<br \/>\nDownKey=Down<br \/>\n[hd44780]<br \/>\nConnectionType=i2c<br \/>\nDevice=\/dev\/i2c-1<br \/>\nPort=0x38<br \/>\nBacklight=yes<br \/>\nSize=20x4<br \/>\nDelayBus=false<br \/>\nDelayMult=1<br \/>\nKeypad=no<br \/>\nKeyMatrix_4_1=Enter<br \/>\nKeyMatrix_4_2=Up<br \/>\nKeyMatrix_4_3=Down<br \/>\nKeyMatrix_4_4=Escape<\/code><\/p>\n<p>Adjust the <strong>Port<\/strong> parameter to the address of your PCF8574, the <strong>Device <\/strong>parameter to the correct i2c device depending on your Raspberry PI model and the character <strong>size<\/strong> of your display .<\/p>\n<p>Its time to test LCDproc. Start LCDproc at the console in foreground<\/p>\n<p><code>\/usr\/sbin\/LCDd <code>-f -r 2<\/code> -c \/etc\/LCDd.conf <\/code><br \/>\nThe &#8220;hello&#8221; message defined in \/etc\/LCDd.conf should appear at the display.<\/p>\n<figure id=\"attachment_1459\" aria-describedby=\"caption-attachment-1459\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_lcdproc_start.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1459\" alt=\"LCDproc start\" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_lcdproc_start-300x188.png\" width=\"300\" height=\"188\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_lcdproc_start-300x188.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_lcdproc_start.png 600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1459\" class=\"wp-caption-text\">LCDproc start<\/figcaption><\/figure>\n<p>If the test passed successfully start LCDd as daemon.<br \/>\n<code>\/usr\/sbin\/LCDd -c \/etc\/LCDd.conf<\/code><br \/>\nlast test is to start a LCDd client to display some system information, enter<br \/>\n<code>lcdproc -f C P G L M S D I B T O U K N A <\/code><\/p>\n<figure id=\"attachment_1457\" aria-describedby=\"caption-attachment-1457\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_load.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1457\" alt=\"Display System load\" src=\"http:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_load-300x240.png\" width=\"300\" height=\"240\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_load-300x240.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2013\/11\/hd44780_load.png 600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1457\" class=\"wp-caption-text\">Display System load<\/figcaption><\/figure>\n<p>Whats left is a startup script to start LCDd at boot time. raspbmc uses upstart init system.<br \/>\nCreate a new file \/etc\/init\/LCDd.conf<br \/>\n<code>###################################################################################<br \/>\n# LCDd - start the LCD daemon<br \/>\ndescription \"LCD daemon\"<br \/>\nauthor \"Michael Albert\"<\/code><\/p>\n<p><code>start on (filesystem or resume)<br \/>\nstop on (suspend or runlevel [!2345])<\/code><\/p>\n<p><code>expect fork<br \/>\nnormal exit 0<\/code><\/p>\n<p><code>script<br \/>\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin<br \/>\nDAEMON=\/usr\/sbin\/LCDd<br \/>\nDAEMON_OPTS=\"-c \/etc\/LCDd.conf\"<\/code><\/p>\n<p><code>exec $DAEMON $DAEMON_OPTS<br \/>\nend script<br \/>\n#######################################################################<\/code><\/p>\n<p>Reload configuration and check the state of the daemon<\/p>\n<p><code>initctl reload-configuration<br \/>\ninitctl status LCDd<br \/>\ninitctl start LCDd<\/code><\/p>\n<p>If you want to use lcdproc to display some information from XBMC,\u00a0 install the <a title=\"XBMC lcdproc add-on\" href=\"https:\/\/github.com\/herrnst\/script.xbmc.lcdproc\" target=\"_blank\">XBMC LCDproc add-on<\/a>.<\/p>\n<p>Board schematic and layout as Eagle files, as well as the LCDd sample config file and start script and are available for download in the attached zip package.<\/p>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everybody, some application, i.e. XBMC can show informations on a display by using LCDproc as driver. This post describes a way to connect a HD44780 display to a Raspberry PI\u00a0 by i2c bus. Let&#8217;s start with the physical layer. This is the overview schematic on how to connect the display to a Raspberry PI. &hellip; <a href=\"https:\/\/michlstechblog.info\/blog\/raspberry-pi-connecting-a-hd44780-display-with-i2c-bus\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Raspberry PI: Connecting a HD44780 Display over I2C Bus<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,330],"tags":[376,377,383,374,378,382,375,380,379,863,381],"class_list":["post-1408","post","type-post","status-publish","format-standard","hentry","category-linux","category-raspberry-pi","tag-connecting","tag-display","tag-gpio","tag-hd44780","tag-i2c","tag-layout","tag-lcdproc","tag-pcb","tag-pcf8574","tag-raspberry-pi","tag-schematic"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=1408"}],"version-history":[{"count":44,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1408\/revisions"}],"predecessor-version":[{"id":1607,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1408\/revisions\/1607"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=1408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=1408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=1408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}