The goal of the “Wake me up” programs is to set a wake time that will turn on the lights and say something like: “Wake Up Wake Up”. The logic was done in Node-Red and it was quite straightforward. The hardware used was:
- A Raspberry Pi
- PowerSwitch Tail II
- A desk light
- A speaker
The PowerSwitch Tail II ($26) is a power cord that is enabled/disabled with I/O pins. The PowerSwitch pins connect to GPIO18 and GND on the Pi. A desk light is plugged into the PowerSwitch Tail and speakers are connected to audio jack on the Pi.
With the PowerSwitch Tail II there are a lot of devices that could be controlled. For us, we simply connected it to a desk lamp. The setup shown below was later moved into a bedroom and place on a bedside table.
For this project two Node-Red libraries were used; a scheduler library and a text to speech library. They are installed by:
sudo apt-get install festival cd $HOME/.node-red npm install node-red-contrib-say npm install node-red-contrib-simple-weekly-scheduler
After the packages are loaded restart the Pi, and then start up Node-Red. On the Node-Red configuration Web page, drop a scheduler, and wire a Pi GPIO, and a Say node to the scheduler.
Double-click the scheduler node and set the wake up times. The start/end payloads are numeric and 1/0. Below is the scheduler configuration.
For the Pi GPIO node, set the GPIO to Pin 12/GPIO18.
Next for the Say node, enter the text you want spoken .
For the final circuit, inject nodes can be included for testing. An “on” inject sends a 1, and an “off” inject sends 0. At the wake up time the schedule node will send a payload that will trigger the speaking of the wake up text and the desk light will be turned on for 15 minutes.