Code Monkey home page Code Monkey logo

rpihwmonitor's Introduction

System Info Display

Display basic system information on a OLED display (using luma.oled), or in a x-window (using luma.emulator).

This is a re-implementation of "Raspberry Pi hardware monitoring display with icons" by plukas and "SSD1306 with Python" by Peter Scargill.

Based on the sys_info example.

Testing on emulated hardware

Test/modify the layout and system calls on a full Linux machine. The information is displayed on a small x-window for 15 seconds.

Installation for python3

luma.emulator

sudo apt install python3-dev python3-pip build-essential
sudo apt install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev
sudo pip3 install --upgrade luma.emulator

Display when script is changed

.sys_info.py will show the emulated display only for 15 seconds. The following commands will execute the script every time the file is saved

while inotifywait -qqre modify ./sys_info.py; do
  ./sys_info.py
done

SSD1306 on a Raspberry Pi

After .sys_info.py is called, the display will be updated once a minute.

Installation for python3

luma.olded

sudo apt install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential
sudo -H pip3 install --upgrade luma.oled

Additional dependencies on Raspbian Stretch Lite

sudo apt install libopenjp2-7 libtiff5
sudo -H pip3 install psutil

Start after boot

There are different options to start a job after boot, see here. This are the ones I have tried/plan to try out.

  • cronjob: easy to set-up, need to reboot to update the script
  • service: harder to set-up, easy to start/stop

Run as a cronjob

Add the following lines to your crontab (crontab -e)

@reboot bash -lc $HOME/RpiHWmonitor/sys_info.py &

The bash -l is needed to get the right $PATH for iwconfig, which in turn is needed for the wifi signal strength.

Run as a service

The systemd service file (RpiHWmonitor.service) defines a new service called RpiHWmonitor, which is to be launched once the multi-user environment is available.

# copy the service file
sudo cp RpiHWmonitor.service /lib/systemd/system/

# set the required permissions
sudo chmod 644 /lib/systemd/system/RpiHWmonitor.service

# enhable new service
sudo systemctl daemon-reload

# start/stop/reload service
sudo systemctl start RpiHWmonitor
#sudo systemctl stop RpiHWmonitor
sudo systemctl reload-or-restart RpiHWmonitor

# check service status
systemctl status RpiHWmonitor

# start after reboot
sudo systemctl  enable   RpiHWmonitor # start after reboot
#sudo systemctl dishable RpiHWmonitor # don't start
sudo reboot

For more info about systemctl usage, see this tutorial, and this article about auto restart crashed services.

rpihwmonitor's People

Contributors

avaldebe avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

tobikr

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.