Code Monkey home page Code Monkey logo

python_lcd's Introduction

lcd and i2c_lcd

Python code for talking to character based LCDs.

The I2c_Lcd class allows for talking to i2c based LCDs. There are also variants of the code for MicroPython. All of the files which start with pyb were tested on the pyboard.

Files

File Description
lcd.py Core logic
i2c_lcd.pyb Linux I2C HAL
pyb_gpio_lcd.py Pyboard GPIO HAL
pyb_gpio_lcd_test8.py Pyboard test using 8-bit GPIO
pyb_gpio_lcd_test.py Pyboard test using 4-bit GPIO
pyb_i2c_adafruit_lcd.py Pyboard I2C HAL for Adafruit backpack
pyb_i2c_adafruit_lcd_test.py Test for Adafruit backpack
pyb_i2c_lcd.py Pyboard I2C HAL for PCF8574 backpack
pyb_i2c_lcd_test.py Test for PCF8574 backpack

The files which end in _test.py are examples which show how the corresponding file is used.

i2c_lcd.py was tested on a BeagleBone Black using a 2 x 16 LCD with an i2c module similar to this one.

This code was adapted from some C code that I had written previously for the AVR.

To install on your BBB:

git clone https://github.com/dhylands/python_lcd.git
cd python_lcd
sudo pip install -e .

And to test:

sudo lcd/i2c_lcd.py

Since my LCD was a 5v device, I used a level converter to convert from BBB's 3.3v to the LCD's 5v.

I put together some [photos here] (https://picasaweb.google.com/115853040635737241756/PythonI2CLCD?authkey=Gv1sRgCLyZoJ3_uPjiXA)

Coming from the BeagleBone Black the wire colors are:

Color  Pin   Name
------ ----- ------
Black  P9-1  GND
Red    P9-3  3.3v
Orange P9-7  SYS_5V
Yellow P9-19 SCL
White  P9-20 SDA

The photo shows Orange connected to P9-5. I discovered that P9-7 is controlled by the onboard voltage regulators, so when you do a "sudo poweroff" then SYS_5V drops to 0v when the BBB is powered off. P9-5 (VDD_5V) remains at 5v after the BBB is powered off.

And the colors going to the LCD are:

Color  Name
------ ----
Black  GND
Red    5v
White  SDA
Yellow SCL

I used a SparkFun level shifter (this particular model is no longer available).

Some examples of other level shifters which could be used:

python_lcd's People

Contributors

dhylands avatar

Watchers

Alexandre Almeida avatar James Cloos 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.