Giter Site home page Giter Site logo

jesuscapistran / circuitpython-hd44780 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bablokb/circuitpython-hd44780

0.0 0.0 0.0 201 KB

Library for the HD44780-LCD-display with an I2C-interface using the PCF8574T

License: GNU General Public License v3.0

Python 100.00%

circuitpython-hd44780's Introduction

Introduction

This is a simple library for small LCD-displays with 16x2 or 20x4 characters known as HD44780-displays. You can attach these displays directly to your MCU, but since this consumes 8 pins the display is usually attached to a serial multiplexer. This library supports the PCF8574T.

Adafruit supports the MCP230xx multiplexer with their own library (lib adafruit_character_lcd with class character_lcd_i2c), but chances are high that your cheap device from Amazon or Ebay has a PCF8574T instead.

Hardware-Mods

Note that the LCD is a 5V device and that the serial interface has two pullups for SDA/SCL to 5V (labelled R8 and R9). Although this library does not read from the bus it is best to remove the pullups and provide the i2c-pullups yourself (either configure the internal pullups of your MCU if available or add external pullups to 3.3V).

In this image

the R9 pullup is already removed and the R8 is about to be removed.

Installation

Just copy the file lib/hd44780.py to the lib-directory of your device.

You also need the busio-library from the CircuitPython library-bundle.

API

The API is very simple:

  • hd44780(i2c=None,address=0x27,trans_map={}): constructor
  • backlight(on): pass True to activate the backlight
  • clear(): clear the LCD and move to first line
  • write(string,line): write the given string to the given line

The translation-map in the constructor maps a character to the correct character of the LCD, e.g. on my display I use

trans_map = {"°":223}

to map the degrees-character to chr(223). Run

examples/show_charset.py $(seq 0 15)

to show all available chars of your display.

There are a number of simple examples in examples-directory.

circuitpython-hd44780's People

Contributors

bablokb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.