/OLED_Stats_Docker

OLED Stats display script and settings for Docker implementation

Primary LanguagePython

OLED_Stats_Docker

OLED Stats display script and settings for Docker implementation

The script is pre-configured for 128x64 I2C OLED display.

Installation Steps

Connect GND, VCC(3.3v), SCL, & SDA ports of the display according to the picture shown below:

(If you don't happen to have a 3.3v, a 5v will also work fine).

How to install Docker

If you do not have Docker yet. Copy and paste the following as a none-root user:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
rm get-docker.sh
exit # logout and back in for changes to take effect!

To use the docker command as a none-root user, logout and in again for the change to take effect.

Script setup

sudo raspi-config nonint do_i2c 0
docker run -d -e start=08 -e end=23 -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime --network=host --device=/dev/i2c-1 --device=/dev/gpiomem --restart=on-failure --name OLED_Stats mklements/oled_stats

If you don't see anything happening on the screen, it's possible that the current time is outside of the default time set for the screen to be on (from 8:00 to 23:00). It's als possible that the wiring wasn't done properly and can be checked by doing:

docker exec -t OLED_Stats i2cdetect -y 1

It's expected to see this output:

macley@raspberrypi:~ $ docker exec -t OLED_Stats i2cdetect -y 1
     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: -- -- -- -- -- -- -- --

Set Display On/Off Time

The script automatically turns the display on or off depending on the time of day. By default the display will turn on at 8 and will turn off again at 23. You can change these times by changing the -e start=08 -e end=23 parts to the times of your liking in the run command.