Giter Site home page Giter Site logo

niaev / cpu_display Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 21 KB

Python script for displaying CPU usage and temperature in a LCD using I2C, for Raspberry Pi

License: The Unlicense

Python 89.10% Shell 10.90%
cpu-monitoring lcd-display python raspberry-pi

cpu_display's Introduction

cpu_display

cpu_display is a python script for displaying CPU usage and temperature in a LCD (16x2) using I2C module, for Raspberry Pi.

Requirements

Hardware

  • Any Raspberry Pi model (I think so, at least, let me know if you have any trouble with your model);
  • Liquid Crystal Display 16x2;
  • I2C Module;
  • Some cables

Software

For cpu_display to work in your Raspberry Pi, not depending on the operating system you are using, you may need to install some packages:

  • lm-sensors
  • python3-smbus
  • python3-rpi.gpio
  • i2c-tools

And enable I2C interface through raspi-config, following those steps:

  • Type sudo raspi-config in your terminal
  • Select "Interface Options"
  • Select "P5 I2C"
  • Select "Yes", to enable I2C interface

Installation

If you want cpu_display to work at startup or login, you will need to run setup.sh script. If you don't want to, you can just execute the main script alone:

./cpu_display.py

Requirements satisfied, you can now setup cpu_display, typing the following line in your terminal:

sudo sh setup.sh

setup.sh may need to edit /etc/rc.local, a file that requires superuser access, so don't forget the sudo command at the beginning.

Usage and how it works

The output of the script will be the following, if everything is correct with the requirements previously described.

[+] LCD detected!
[+] Writing information...

If you can see this output after running the script, your LCD is probably displaying stuff.

The info displayed is changed every 2 seconds. CPU temperature displayed is retrieved from the sensors command and usage is from /proc/stat, both are stored in a temporary file and then formatted into your LCD.

cpu_display's People

Contributors

niaev avatar

Watchers

James Cloos avatar  avatar

Forkers

1b223

cpu_display's Issues

Problem with modules on non-RaspOS systems

Testing cpu_display.py script in Ubuntu 20.04 and RetroPie leads to ModuleNotFoundErrors like:

ModuleNotFoundError: No module named 'smbus'

After installing smbus with pip3 install smbus, it leads to the error:

ModuleNotFoundError: No module named 'RPi'

It's important to inform this at the documentation (useful link).

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.