R_pi/messenger @ Scroll pHAT HD

Text from my Blog @ https://lovemypi.wordpress.com/blog/

This was actually my first rpi project involving a pimoroni scroll phat HD display.
Im really proud how this turned out,especially how much stuff I was able to stuff into the casing 🙂
Even for the photos , I couldnt bring myself to remove the protective layer from the plexiglas (yet) :)

A piZeroW with a LOT OF cables sits in a a cheap ebay alarm clock casing.
The case turned out to be the perfect housing for a lot of cool stuff 🙂 :

Features :

  • scroll_phatHD display on front
  • oled screen embedded into the top snooooooze button (which actually now features 2 buttons instead of only one like the original alarm clock)
  • 2 x 8LED ws2812 stripes of godly bright light on the back
  • a DHT22 sensor (temp/humidity)
  • an active piezoBUzzEr
  • a socket for an external 12 pin screw terminal plug in case I want to add/run additional stuff
    like… a neopixel ring clock,or a max7219 matrix display 🙂
  • oh right… and I also adapted the original 3 buttons on the back.
  • and of course there is a mandatory dash button for remote control.

rpi_messengers main purpose was to show PIR (motion detector) alarms,that take place at a remote old house,that Im trying to fix right now. (check my previous post below @ remote surveillance)
So whenever someone walks up there,I get a pir alarm message on my little powerUPmodded alarm clock 🙂
Also I use a hacked amazon button up at the house as door bell,so whenever someone actually presses the door bell,I also get a notification.

Stuff I learned :
PHYTHON… god I love coding… when I first looked at a python code about 4 weeks back,I was about to vomit… as I HATE coding.
Well then I kinda remembered how much I liked BASIC back@school,so I gave it a try,and hey… its quite easy,and its powerful.
In combination with linux its UNBEATABLE… there is a tool/line of code/fix for everything you can dream about 🙂
You just have to spend enough time to look for solutions,and if I got anything plenty… its TIME 🙂

As the phatHD display is as bright as it gets,I also use the clock.py script for notification.
Whenever there was a door/pir alarm,a NOTIFICATION file is generated(via ssh from the remote master rpi),with a timestamp& text inside,aditionally alarms are appended to the file,until it gets displayed.
If the file SILENT exists (generated by a cron job),there wont be any sound or flashing ,but the ws2812 leds on the back fade in and out slowly at a low brightness setting.
The clock.py script checks every second if the NOTIFICATION file exists,and if it does,the time flashes every other second with double brightness.
You can press the top button or a dash button to clear the notification.
For that I use the advanced_scrolling.py script. It just reads me the content of NOTIFICATION,and deletes it afterwards.
The notifcation script,is argument based,so it can be used for a variety of stuff,its mostly used via ssh from the remote master control raspberrypi,which is connected to the PIR,and controls the other rapsberrypis as well.
I also use it to display the weather (ansiweather),or show the system status (wifi link quality / uptime / cpu / mem/ …)

My adapted clockscript runs ALWAYS & EVER.
It just get frozen,and resumed via kill -s STOP/CONT from any other phatHD script that wants to use the phatHD display.That way the clock script doesnt have to be killed&loaded everytime an alarm or newsfeed is displayed.
The brightness of the clockscript is set via BRIGHTNESS file (just a file containing i.e. 0.14).
Via signal ,I can trigger the clockscript to reRead the brightness and change the brightness. A cronjob triggers a bash file that has brightness conditions (time/wifi strength determens location) and changes the values accordingly over the day.

Also there is a night mode (a mod version of progress.py),which only displays a dim dot during the night.
also this nightmode gets active as soon as a rawsocket listener script discovers my media player on the home network (it just looks for arp packages).

For the buttons I use a script I found online (check references below),and modified.
Originaly ,it was only for one button,short & long press.
Now its there for all buttons,and it really works quite well.

I guess there isnt anything more I can stuff into that tiny casing 🙂
Never thought of myself as a nerd before,but then I met a pi zero…and I knew… Im a nerd / definitely 🙂

References :

clockscript based on :

notication scroller based on :

Button_script based on :

rawsocket_listener for dashbuttons/or other devices based on :

Hardware :

  • pimoroni PHAThd white
  • 128 x 64 yellow/blue OLED (SSD1306 control chip,easy thing to use)
  • 2x ws2812 8LED rows (use luma.led for control)
  • DHT22 sensor
  • 12pin ScrewTerminalPlug/socket
  • active piezo buzzer (3-12V) (loud enough@3.3v !!!)
  • casing : some check ebay alarm clock ,comes in a variety of colors)
  • 3mm white creamy plexi glas

I also used stripes of plexiglas to mount the buttons (top/back),raspberrypi and the phatHD display within the case.Not much air/space left inside the case 🙂

1 Like