{"id":16389548,"url":"https://github.com/mnishiguchi/lcd_display","last_synced_at":"2025-03-23T04:31:37.884Z","repository":{"id":57515378,"uuid":"321155675","full_name":"mnishiguchi/lcd_display","owner":"mnishiguchi","description":"Use character liquid crystal display (LCD) in Elixir","archived":false,"fork":false,"pushed_at":"2023-03-31T13:15:37.000Z","size":152,"stargazers_count":9,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T21:39:04.516Z","etag":null,"topics":["74hc595-lcd","elixir","gpio","hd44780","i2c","iot","lcd","lcd-display","mcp23008","mcp23017","nerves","pcf8574"],"latest_commit_sha":null,"homepage":"https://dev.to/mnishiguchi/elixir-nerves-character-lcd-with-serial-interface-i2c-5b44","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnishiguchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-13T20:39:58.000Z","updated_at":"2023-05-10T11:38:17.000Z","dependencies_parsed_at":"2024-10-11T04:43:40.604Z","dependency_job_id":null,"html_url":"https://github.com/mnishiguchi/lcd_display","commit_stats":{"total_commits":79,"total_committers":1,"mean_commits":79.0,"dds":0.0,"last_synced_commit":"41ec73eb554d97c02d7ff16489fa4bec88618f3e"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Flcd_display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Flcd_display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Flcd_display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Flcd_display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnishiguchi","download_url":"https://codeload.github.com/mnishiguchi/lcd_display/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["74hc595-lcd","elixir","gpio","hd44780","i2c","iot","lcd","lcd-display","mcp23008","mcp23017","nerves","pcf8574"],"created_at":"2024-10-11T04:33:32.516Z","updated_at":"2025-03-23T04:31:37.575Z","avatar_url":"https://github.com/mnishiguchi.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LcdDisplay\n\n[![Hex.pm](https://img.shields.io/hexpm/v/lcd_display.svg)](https://hex.pm/packages/lcd_display)\n[![API docs](https://img.shields.io/hexpm/v/lcd_display.svg?label=docs)](https://hexdocs.pm/lcd_display/LcdDisplay.html)\n![CI](https://github.com/mnishiguchi/lcd_display/workflows/CI/badge.svg)\n\n`LcdDisplay` allows you to control a [Hitachi HD44780](https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller)-compatible\n[Liquid-crystal display (LCD)](https://en.wikipedia.org/wiki/Liquid-crystal_display) in [Elixir](https://elixir-lang.org/).\n\nFor the specification of the HD44780 LCD, please refer to the [HD44780 data sheet](https://cdn-shop.adafruit.com/datasheets/HD44780.pdf).\n\n![nerves_hello_lcd_20201213_185620](https://user-images.githubusercontent.com/7563926/102028171-ba8a6780-3d76-11eb-94f4-f82272fc3063.gif)\n\n## Installation\n\nYou can install `LcdDisplay` by adding `lcd_display` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:lcd_display, \"~\u003e 0.2.0\"}\n  ]\nend\n```\n\n## Usage\n\nAs an example, if you want to control a [Hitachi HD44780](https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller) type display through\nthe 8-bit I/O expander [PCF8574](https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf),\nyou can use `LcdDisplay.HD44780.PCF8574` module as a display driver.\n\n### Start an LCD driver and get a PID\n\n```elixir\ndriver_config = %{\n  driver_module: LcdDisplay.HD44780.PCF8574,\n  i2c_bus: \"i2c-1\",          # I2C bus name\n  i2c_address: 0x27,         # 7-bit address\n  rows: 2,                   # the number of display rows\n  cols: 16,                  # the number of display columns\n  font_size: \"5x8\"           # \"5x10\" or \"5x8\"\n}\n\n{:ok, pid} = LcdDisplay.start_link(driver_config)\n```\n\nMany configuration values are optional, falling back to default values. Please refer to each display module documentation.\n\n### Run commands\n\nPlease refer to the `LcdDisplay.HD44780.Driver` documentation for supported display commands.\n\n```elixir\n# Print text\nLcdDisplay.execute(pid, {:print, \"Hello world\"})\n\n# Clear the display\nLcdDisplay.execute(pid, :clear)\n\n# Print a character at a time\nLcdDisplay.execute(pid, {:print, 0b00110001})\nLcdDisplay.execute(pid, {:print, 0b00110000})\nLcdDisplay.execute(pid, {:print, 0b00100101})\n```\n\n### Driver modules\n\nDifferent products out there use different I/O expanders, so please be aware of which I/O expander you are using if you use something like an I2C backpack.\nAlso the pin assignment between the LCD and the I/O expander is important since this library assumes certain pin assignment based on popular products out there.\n\n#### for parallel I/O\n\nWhen you connect an LCD standalone directly to the GPIO pins on your target device, the `LcdDisplay.HD44780.GPIO` driver module is useful.\n\nHere are some relevant products:\n\n- [Adafruit Assembled Standard LCD 16x2 - White on Blue](https://www.adafruit.com/product/1447)\n- [Adafruit Standard LCD 16x2 - white on blue](https://www.adafruit.com/product/181)\n- [Adafruit Standard LCD 20x4 - white on blue](https://www.adafruit.com/product/198)\n- [Adafruit RGB backlight LCD 16x2 - black on RGB](https://www.adafruit.com/product/398)\n- [Adafruit RGB backlight LCD 16x2 - RGB on black](https://www.adafruit.com/product/399)\n\n#### for PCF8574-based I2C modules\n\n[Many inexpensive I2C modules on Amazon.com](https://www.amazon.com/s?k=i2c+16x2+lcd+module) uses [PCF8574](https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf). A pre-assembled 16x2 LCD with I2C module is typically less than US$10. [Handson Technology I2C Serial Interface 1602 LCD Module User Guide](http://www.handsontec.com/dataspecs/module/I2C_1602_LCD.pdf) summarizes the typical specifications of the PCF8574-based I2C module.\n\n#### for Adafruit I2C / SPI character LCD backpack\n\nThe [Adafruit i2c / SPI character LCD backpack](https://www.adafruit.com/product/292) supports both I2C and SPI interfaces. It uses [MCP23008](https://ww1.microchip.com/downloads/en/DeviceDoc/MCP23008-MCP23S08-Data-Sheet-20001919F.pdf) for I2C and [SN74HC595](https://www.ti.com/lit/ds/scls041i/scls041i.pdf) for SPI as of writing.\n\n#### for other I/O expanders\n\nIt is easy to make your own driver modules in case you want a custom pin assignment, a different I/O expander or some custom features.\n\n## Thanks\n\n- [`ExLCD`](https://github.com/cthree/ex_lcd) for inspiration\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Flcd_display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnishiguchi%2Flcd_display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Flcd_display/lists"}