the-raspberry-pi-guy / lcd

Licence: other
This repository contains all of the code for interfacing with a 16x2 Character I2C LCD Display. This accompanies my YouTube tutorial here: https://www.youtube.com/watch?v=fR5XhHYzUK0

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to lcd

mpy-lib
HTS221, LPS22, LIS2DW12, LIS2MDL, LSM6DSO, STTS751, bme280, bmp280, APDS9930, TM1650, TM1637, LCD1602, all kinds of micropython drives, examples, libs
Stars: ✭ 118 (+1.72%)
Mutual labels:  lcd
Adafruit CircuitPython CharLCD
Library code for character LCD interfacing
Stars: ✭ 54 (-53.45%)
Mutual labels:  lcd
PrecIR
You know what this is for ;-)
Stars: ✭ 60 (-48.28%)
Mutual labels:  lcd
go-coin-ticker
Raspberry Pi BTC/ETH monitoring daemon, LCD 16x2 & LED indicators
Stars: ✭ 14 (-87.93%)
Mutual labels:  lcd
dpf-ax
Tools and firmware for AX206 photo frames, from http://sourceforge.net/projects/dpf-ax/
Stars: ✭ 17 (-85.34%)
Mutual labels:  lcd
digital-electronics-2
AVR course at Brno University of Technology
Stars: ✭ 12 (-89.66%)
Mutual labels:  lcd
chisel
A library to sculpt text on any device that you can handle pixels
Stars: ✭ 37 (-68.1%)
Mutual labels:  lcd
pcd8544
Minimal footprint library for Philips PCD8544 LCDs on the Arduino.
Stars: ✭ 87 (-25%)
Mutual labels:  lcd
5110LCD PCD8544.swift
A Swift library for the Nokia3310/5110 PCD8544 Monochrome LCD display
Stars: ✭ 28 (-75.86%)
Mutual labels:  lcd
MD Menu
Menu system for displays with up to 2 lines
Stars: ✭ 49 (-57.76%)
Mutual labels:  lcd
LVDS-7-to-1-Serializer
An Verilog implementation of 7-to-1 LVDS Serializer. Which can be used for comunicating FPGAs with LVDS TFT Screens.
Stars: ✭ 33 (-71.55%)
Mutual labels:  lcd
qnapdisplay
Qnap lcd python module, features both writing to the display as wel as reading keypresses from the panel keys. It was developed on a Qnap TS-459 and a TS-453A, it works on some other models as well.
Stars: ✭ 37 (-68.1%)
Mutual labels:  lcd
vrEmuLcd
Character LCD emulator library (C99 engine, web front-end).
Stars: ✭ 45 (-61.21%)
Mutual labels:  lcd
picoLCD
Example code for interfacing with a LCD with a Raspberry Pi Pico
Stars: ✭ 25 (-78.45%)
Mutual labels:  lcd
U8g2
U8glib library for monochrome displays, version 2
Stars: ✭ 2,737 (+2259.48%)
Mutual labels:  lcd

LCD

This repository contains all the code for interfacing with a 16x2 character I2C liquid-crystal display (LCD). This accompanies my Youtube tutorial: Raspberry Pi - Mini LCD Display Tutorial.

You can buy one of these great little I2C LCD on eBay or somewhere like the Pi Hut.

Table of Contents

  1. Installation
  2. Demos
  3. Implementation
  4. Contributions

Installation

  • Install git

    sudo apt install git
    
  • Clone the repo in your pi home directory

    cd /home/pi/
    git clone https://github.com/the-raspberry-pi-guy/lcd.git
    cd lcd/
    
  • Run the automatic installation script with sudo permission

    sudo ./install.sh
    
  • During the installation, pay attention to any messages about python and python3 usage, as they inform which version you should use to interface with the LCD driver. For example:

    [LCD] [INFO] You may use either 'python' or 'python3' to interface with the lcd.
    

    or alternatively,

    [LCD] [INFO] Use 'python3' to interface with the lcd.
    
  • At the end of the installation script, you'll be prompted to reboot the RPi to apply the changes made to /boot/config.txt and /etc/modules.

  • After rebooting, try one of the demos:

    ./home/pi/lcd/demo_clock.py
    

    or

    python /home/pi/lcd/demo_clock.py
    

    or

    python3 /home/pi/lcd/demo_clock.py
    

top ⬆️

Demos

A list of demonstration (demo) files that illustrate how to use the LCD driver. Demos are ordered alphabetically.

Backlight Control

This demo showcases the backlight control of the LCD, which is available on some hardware:

Custom characters

It is possible to define in CG RAM memory up to 8 custom characters. These characters can be prompted on LCD the same way as any characters from the characters table. Codes for the custom characters are unique and as follows:

  1. {0x00}
  2. {0x01}
  3. {0x02}
  4. {0x03}
  5. {0x04}
  6. {0x05}
  7. {0x06}
  8. {0x07}

Please, see the comments and implementation in the demo_lcd_custom_characters.py file for more details on how to use custom characters.

Extended strings

This is demo showcases how extended strings could be used. Extended strings can contain special placeholders of form {0xFF}, that is, a hex code of the symbol wrapped within curly brackets. Hex codes of various symbols can be found in the following characters table:

For example, the hex code of the symbol ö is 0xEF, and so this symbol could be printed on the second row of the display by using the {0xEF} placeholder, as follows:

display.lcd_display_extended_string("{0xEF}", 2)

If you want to combine placeholder to write a symbol {0xFF} with the native Python placeholder {0} for inserting dome data into text, escape the non-native placeholders. Here is an example:

display.lcd_display_extended_string("Symbol:{{0xEF}} data:{0}".format(5), 2)

Forex

  • Author: @bariskisir
  • Additional Python package requirements: pip, requests, bs4

To install the requirements, follow this procedure:

  • Install pip and use it to install the remaining packages
    sudo apt install python-pip
    pip install requests bs4

IP Address

Display your Pi's IP address, which is useful for SSH access and more!

LCD

This demo shows how simple strings could be displayed on the LCD. For extended usage, take a look at Extended strings demo instead.

NetMonitor

This demo uses ping and nc (netcat) to monitor the network status of hosts and services, respectively. Hosts and services can be modified by editing their respective dictionaries:

hosts = {
    'Internet': '8.8.8.8',
    'Firewall': '192.168.1.1',
    'NAS': '192.168.1.2'
}
services = {
    'Cameras': {'ip': '192.168.1.2', 'port': '8000'},
    'Plex': {'ip': '192.168.1.2', 'port': '32400'}
}

Progress bar

This is a demo of a graphical progress bar created with custom characters. This bar could be used, for example, for showing the current level of battery charge.

top ⬆️

Implementation

Once you are done editing a demo_*.py file or writing your own Python script, follow the instructions on this section to run the script in the background. First, however, ensure that the script (e.g., script.py) has at least permission to be executed, as follows:

sudo chmod +x script.py

Similarly, file ownership can be configured via chown. For example, to set the user pi as owner of the file script.py, run the following:

sudo chown pi script.py

Systemd

Use the following procedure to run any LCD Python script as a (systemd) service:

  1. Create a new unit file in /lib/systemd/system/ called rpi-lcd.service:

    sudo nano /lib/systemd/system/rpi-lcd.service
  2. Copy and paste the following in the new unit file:

    [Unit]
    Description=RPi Python script for a 16x2 LCD
    
    [Service]
    Type=simple
    ## Edit the following according to the script permissions
    User=pi
    #Group=users
    
    ## Edit the following with the full path to the compatible Python version and your script
    ExecStart=/usr/bin/python /path/to/script.py
    
    Restart=always
    RestartSec=5
    
    KillMode=process
    KillSignal=SIGINT
    
    [Install]
    WantedBy=multi-user.target
  3. Enable the service and start it:

    sudo systemctl enable rpi-lcd.service
    sudo systemctl start rpi-lcd.service
  4. Check that the LCD is displaying the correct information; otherwise, check the service status:

    systemctl status rpi-lcd.service

top ⬆️

Contributions

Thank you for you interest in learning how to contribute to this repository. We welcome contributions from novices to experts alike, so do not be afraid to give it a try if you are new to git and GitHub. First, however, take a few minutes to read our CONTRIBUTING.md guide to learn how to open Issues and the various sorts of Pull Requests (PRs) that are currently accepted.

In addition, if you've never contributed to an open source project before, please take a look at the following resources:

top ⬆️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].