Code Monkey home page Code Monkey logo

oled_sh1106_status's Introduction

oled status screen for sh1106 drivers

img

This is the script that outputs system status on a sh1106 (not ssd1306) OLED. It's tailored to my needs so you will probably want to modify it a little bit.

Setup

  1. Enable i2c interface on your raspberry pi.
  2. Check that your oled is connected using i2cdetect -y 1. The correct output is:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
  1. Follow this guide to install luma.oled. Make sure puthon3 is installed. https://luma-oled.readthedocs.io/en/latest/software.html

Running manually

In the repo folder, run: python3 status.py

Running as a service on startup

  1. Create a new service file: sudo nano /etc/systemd/system/oled.service
  2. Paste this into it:
[Unit]
Description = SH1106 status OLED.
After = network.target

[Service]
WorkingDirectory=/full/path/to/repo/oled_sh1106_status
ExecStart = python3 status.py

[Install]
WantedBy = multi-user.target
  1. sudo systemctl daemon-reload
  2. sudo systemctl enable oled.service
  3. sudo systemctl start oled.service

If you make any changes to the service file, run:

sudo systemctl daemon-reload
sudo systemctl stop oled.service

If you want to stop the service:

sudo systemctl stop oled.service

Status display

You can send custom status messages from anywhere in the os. You can add a new message by running

python3 up.py add Your Message

After that, it will be displayed on the oled. To remove it, run

python3 up.py remove Your Message

You can use this feature to track background tasks. For example:

python3 /full/path/to/repo/oled_sh1106_status add Backup Job ; your_backup_command ; python3 /full/path/to/repo/oled_sh1106_status remove Backup Job

To make it shorter, you can create a symlink:

sudo ln -sf ~/feats/oled_sh1106_status/up.py /srv/oled/up.py

oled_sh1106_status's People

Contributors

martenfur avatar chaifoxes avatar

Watchers

 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.