Introduction: O-R-A RGB Led Matrix Wall Clock and More **updated Jul 2019**
Hello. Here i am with a new project named O-R-A
It is a RGB LED Matrix wall clock that display :
- current weather condition icon
- Google Calendar events and 1h reminder notifications
at a specific time it shows:
- Google Calendar today and tomorrow events list
- weather forecast
- breaking news
- current date
- Magic 8 ball
- Kitchen timer
For any functionality the device play a different audio alarm. For all kind of weather conditions there's a corresponding audio file to be played when the functionality is called.
The functionalities like Google Calendar list, Weather forecast, RSS breaking news starts at preselected time when device is in "clock mode", these can be also called directly operating the switches. Another functionality during "clock mode" display current day/month/year. It can be run pressing ENTER button. Pressing CHANGE STATE button and then ENTER button within 3 seconds in "clock mode", let you enter into options menu. CHANGE STATE button is sets to scroll inside menu, ENTER button is to confirm option selected.
This project is an evolution of my previous LEGOLED and TEMPO. The RGB led matrix panel has resolution 32x64 now, so it is possible display more intellegible graphics, fixed and scrolling text at the same time. Using TEMPO functionalities the device turn on & off automatically without any button or external timer. A PIR module detect the presence of persons therefore turn on/off display.
Weather forecast and calendar data are collected every minute provided by Google Calendar and Open Weather Map .
This project is fully customizable starting from a Raspberry PI B+, 2 module 16x64 rgb led matrix and power supply. It can be expanded, like i did, adding USB sound cards, speakers, on/off power circuit.
Step 1: What You Need
- Raspberry Pi B+ (with built-in wifi or dongle )
- 2 x 16x64 RGB led matrix or 2 x 32x32
- generic frame (40x50 cm & 3 cm depth approximately)
- frosted plastic sheet
- window solar film
- PS 5V 10A
- thermosetting sheath (*)
- relay module (*)
- extra PS for audio amplifier (*)
- 3W audio amplifier module (*)
- speakers (*)
- USB sound card (*)
- 2 x microswitch (*)
- PIR (*)
- Attiny85 (*)
- DS3231 (*)
- Mosfet IRF540 (*)
- Resistors: 3x1K, 2x10K, 1x2K (*)
- terminal block (*)
- header strips female (*)
- header strips male (*)
Step 2: Raspberry Pi Setup
This guide is basically based on Raspbian Jessie Lite, Python 2.7 and RGB LED MATRIX library by Hzeller Github user.
First of all update & upgrade RPI
~ $ sudo apt-get install git
Download RGB LED MATRIX library from Github
~ $ git clone <a href="https://github.com/hzeller/rpi-rgb-led-matrix.git"> https://github.com/hzeller/rpi-rgb-led-matrix.git</a>
~ $ cd rpi-rgb-led-matrix
~ $ sudo make
blacklist RPI internal soundcard
~ $ cat <<EOF | sudo tee /etc/modprobe.d/blacklist-rgb-matrix.conf
> blacklist snd_bcm2835
~ $ sudo update-initramfs -u
Set external soundcard parameters if needs audio capabilities:
~ $ sudo nano /usr/share/alsa/alsa.conf
Now install matrix library
~ $ cd /home/pi/rpi-rgb-led-matrix
~ $ sudo apt-get update && sudo apt-get install python2.7-dev python-pillow -y
~ $ make build-python
~ $ sudo make install-python
and install other libraries needed:
~ $ sudo easy_install pip
~ $ sudo pip install httplib2
Copy samplebase.py script from ~/rpi-rgb-led-matrix/bindings/python/samples/ to home directory
Get API key registering for free to Open Weather Map
Install now OWM Python wrapper for PYthon 2.7 (thanks to CSPARPAGithub user)
~ $ sudo pip install git+https://email@example.com-LTS
Get Google Calendar credential following instructions at Google calendar API
For audio playing install Pygame
~ $ sudo apt-get install python-pygame
RSS feeds needs Feedparser installed
~ $ sudo pip install feedparser
copy my script ORAeng_131.py (english version) or ORAita_131.py (italian version) to home directory
create folders for sounds and pictures:
download and copy all PNG files to owm folder and mp3 files to dbsounds folder from the following link:
add your OWM credential to line 69 (API_key)
set city for weather forecast (check if it's covered by OWM and the correct name accepted) at lines 213, 215
fc = owm.three_hours_forecast('Napoli,IT')
The new Google Calendar API create problems. I've solved removing some modules:
~ $ sudo apt-get remove --purge python-setuptools
~ $ sudo apt-get autoremove python-pyasn1
try the script running
~ $ sudo python ORAeng_150.py # or ORAita_150.py for italian version
at first time the script will ask GCAL authorization. Click the link to google api credential. Give permission then, if everthings it's ok, you'll see clock starts.
due to excessive RAM usage after several hours, i wrote a script that simply restart python script when RAM usage goes over a threshold level. Then copy to home directory the script named memcheck renaming to memcheck.sh and add to crontab -e together main script
*/5 * * * * bash /home/pi/memcheck.sh
@reboot sudo python /home/pi/ORAeng_150.py
Step 3: The Scripts
The main script needs to be modified accordingly your needs. Assuming that OWM and Goggle Calendar credentials are set as their respective API instructions, the most important parameters are:
calendar events list performing every hour at minute 2, 32 (see script line 65)
weather conditions and forecast performing every hour at minute 7, 37 (see script line 66)
breaking news performing every hour at minute 11 (see script line 67)
breaking news rss channel. Inside script is set Instructable RSS, but can be changed. (see script line 366)
Obviously, the script gives priority to incomings calendar event or reminder notifications. Sometimes clock doesn't perform its features to avoid crossing of functionalities.
Attiny85 on/off timer needs to be programmed uploading the sketch Tempo_V1_9_1Mhz_bugfix.ino .
This allow to turn on device at 8 in the morning and turn off at 23. See tutorial for more info.
Step 4: The Circuit
The circuit has basically 3 sections
- power on/off timer handled by DS3231 module, Attiny85 and Mosfet
- switch for manual control of clock features
- connection section where is cabling for RGB LED Matrix datas and power, audio amplifier and Raspberry Pi
Not mentioned a resistive voltage divider that allow RPI to read a HIGH/LOW 5V signal from Attiny85
Switches are connected to RPI pin an GND directly using internal resistors
Attiny85 timer come from my previous project named TEMPO. Basically, DS3231 sends LOW signal to Attiny85 interrupt pin that wake it from sleep mode. At wake up Attiny85 sends HIGH signal to Mosfet transistor, activating the power supply circuit for RPI, LED Matrix and audio amplifier (if not connected to extra PS thrugh a relay, as my last configuration).
To shutdown RPI my script contemplate that RPI listen digital signal on pin 14, when it's HIGH, is called a shutdown command. Then RPI perform a correct shutdown process, then after one minute, Attiny85 goes back to sleep mode and Mosfet receives a LOW signal that turn off the entire device. This process is rough but effective.
PIR module is optional and connected directly to RPI GPIO.
My configuration require that following RPI GPIO pins are connected to:
15 to PIR
14 to Attiny85 pin 3 through voltage divider
21 to relay module
2 to switch (ENTER BUTTON)
3 to switch (CHANGE STATE BUTTON)
- noise due to LED Matrix power supply, solved using a small PS only for the audio amplifier. An optional relay allow to turn on amplifier only when required. This can cause a bump noise when it turns on/off.
The circuit has been etched using copper plate, 3D printer, marker and ferric chloride.
Step 5: Assembling
i've adapted a generic 40x50cm frame to this project together 3D printed parts and some optional extras.
The glass is shielded by window solar film and frosted plastic sheet. Led matrix needs to be kept about 1cm to glass to avoid to see the white inside leds. Small screws are necessary as M3 nuts and bolts. Obligatory are cables and thermosetting sheath.
Led matrices are screwed on the backside panel of the frame.
Step 6: And Now ?
The next step will be to add a temperature sensor, activation of bluetooth capabilities and, why not, an internet radio player until maximum Raspberry Pi potential.
Runner Up in the