/WFH_LCD

Primary LanguagePython

WFH_LCD

A Work-From-Home LCD status indicator built with a Raspberry Pi Zero. Based on Caroline Dunn's amazing work. You can see the original tutorial over on Tom's Hardware

Update your work available/busy/meeting status on a Raspberry Pi LCD screen from your desktop. Designed to use a Raspberry Pi Zero W with pre-soldered GPIO headers and a 16x2 LCD screen with I2C backpack

ProjectGIF

Main Changes

  • Dashboard page re-written to be generated via data in the JS file. Makes the code cleaner and easier to add/remove statuses
  • Bootstrap added for some lazy but quick styling of dashboard screen
  • Added ability to run Flask web server without LCD driver to make dashboard local development possible
  • Added load states to stop doubleclicking of buttons (this send the screen out of sync sometimes)

What you’ll need

  • Raspberry Pi Zero W with pre-soldered GPIO headers or you can solder them yourself. We could have used any model but the Raspberry Pi Zero W is small and low-power.
  • Power supply/microSD card/Keyboard/Mouse/Monitor/HDMI Cable (for your Raspberry Pi)
  • 16x2 LCD screen with I2C backpack
  • Small screwdriver to adjust contrast of the LCD screen
  • 4 Female-to-Female jumper wires

Hardware Assembly

Pinout

(Image credit: Tom's Hardware)

From the I2C backpack on the LCD screen (using 4 female-to-female jumper wires)

Connect GND to a ground pin on the Raspberry Pi. Connect VCC to 5V (pin 2) on the Raspberry Pi. Connect the SDA to pin 3 on the Raspberry Pi. Connect the SCL to pin 5 on the Raspberry Pi.

Case available via Thingiverse

Setup the LCD Display

You can use full GUI Raspbian or Raspbian Lite. I opt for Raspbian Lite as running a GUI on Pi sitting in signage seems like unnecessary overhead. After installing Raspbian on your MicroSD card you need to enable I2C either from the desktop Raspberry Pi Config tool, or using sudo raspi-config at the command line and using the "Interface Options".

Setting up the Pi to run the sign server

The rest will need to happen in the terminal. I'd recommend running a software update with sudo apt update and sudo apt upgrade.

If you're running a fresh stock image of Raspbian, you will likely need to install some dependencies to get everything working. This will include installing git & python3-pip using apt.

sudo apt install git
sudo apt install python3-pip

Once git is installed you need to clone this repository to your Pi.

git clone https://github.com/mrbrainz/WFH_LCD

When this completes you need to go into the directory you've just cloned

cd WFH_LCD

You now need to install the driver library for the LCD screen and the Flask web server library to run the control panel.

pip install smbus
pip install flask

Once all of this is done you can test that the screen is wired up correctly and working:

python lcd_disp.py

If it's all working, you need to adjust your screen's brightness with a screwdriver if you have not done so yet,

Brightness Adjust

You can now test the app to see if it works:

python status.py

As this runs, the terminal will show you your Pi's IP address. Go to a web browser on the Pi or another device and enter the Pi's address:

e.g. http://192.168.1.69:5000

You should see the grid of status options in your browser. Clicking one should update the pi's LCD screen to have the message you chose.

Setting the signage to start on boot

You need to add a line into your .bashrc file in your home directory to set the script to start on boot.

Assuming your username on your Pi is pi then you need to enter:

sudo nano /home/pi/.bashrc

This will open the .bashrc file in the Nano editor. Go to the bottom of the file and add the line:

python /home/pi/WFH_LCD/status.py

This again assumes your username is pi.

You can then hit Ctrl-X to exit and Y to save.

You can then reboot your Pi with sudo shutdown -r now.

Once your Pi reboots, it should automatically run status.py Python script every time.

Future possible work

  • Completely drive endpoint creation via data, possibly externalised from JS and main PY file into a JSON doc (I don't know Python, so this is beyond my expertise)
  • Improve mobile responsive layout
  • Enable mobile add-to-homescreen web app installing
  • Actual API responses to confirm when screen has updated (probably not needed for something this simple)
  • Storage of last status sent and time of event on the Pi. (again, I don't know Python, so this is beyond my expertise)
  • Read current screen contents and act on it - Is this even possible? I can't see it in the LCD driver
  • Backlight control in the panel - the driver does do this