Mealtime announcer (Dinner Dog Daemon)
This device uses a Raspberry Pi and a Smartphone to announce mealtimes. The chef in the kitchen can trigger the Pi (wirelessly) to beep and flash with increasing urgency: starting with a 5-minute countdown and discreet pips, and
reaching, if necessary, a series of beep-beep-BEEP, beep-beep-BEEPs. [The name is inspired by the saying that "Dinner will be in the Dog, unless you come through NOW".]
It's based on the Pi, with some LEDs and a beeper, and a simple Ajax Web interface. The project is complete, but should be easy to modify.
It was originally constructed as a birthday gift, and I'm now sharing the details online so you can build your own.
Have fun with it...
Here are some pictures and screenshots. Click for full-size version...
Here are the parts needed:
- This is a fairly standard headless Raspbian installation; it uses WiringPi for the BLiSo, and apache2 and php5 for the webserver.
- Download the files from here. There are only a few, and they are well commented, and easy to modify.
- Detailed instructions are in the README.txt.
- This is Free Software released under the GNU GPL v3+. Please feel free to take it, modify it, package it etc.
- Author: Richard Neill. Do ask if you would like further information and assistance.
This is what it does...
|Button ||Icon ||Effect ||Interpretation|
|In 5 minutes ||Timer ||A short 'pip, then a 5 minute countdown on LEDs, then another pip. ||Advance warning... please be ready soon.|
|Announce ||Knife & Fork ||Ramp the LEDs up and down, with 3 beeps ||It's Lunchtime.|
|Reminder ||Musical notes ||Ramp the LEDs up and down, with 3 short bips ||Come on... don't dawdle.|
|Come on ||Running person ||Flash all the LEDs, with a long BEEP ||We're waiting for you... Hurry up! Now!|
|It's Burning! ||Pawprint ||Lots of flashing and prolonged pattern of BEEP/bip/bips ||It's getting cold, and will shortly be in the dog!|
- The BLiSo device has straighforward LEDs and buttons connected to logic-levels on the GPIO pins. The GPIO pins are controlled by gpio, which is part of WiringPi. The Buzzer output is clocked at 4 kHz, using the clock mode of
that GPIO pin, and the central LED is used in PWM mode for variable brightness.
- The script bliso.sh drives the BLiSo in specific patterns, such as ramping the LEDs, creating a series of bip-bip-bips, flashing them all, or listening for buttons.
- Note that using gpio is relatively slow (taking about 10ms per command). It would be much faster to use echo (a bash builtin) to write directly to /sys/class/gpio/.... However, we benefit from this latency
by making the LEDs appear to "ramp" on and off rather than switch simultaneously. See the comments in bliso.sh for more.
- The Pi is assigned a fixed IP and a DNS name of "raspberry". This is done with a "DHCP reservation" on our router. So each time the Pi requests an IP address by DHCP, it is given the same, predictable address. This is necessary so
that we can find its web interface.
- The Pi is permanently configured onto our Wireless Network by editing /etc/network/interfaces (see the README.txt for more.)
- To provide visual feedback of the network status, the checknetwork.sh script repeatedly pings the gateway, and adjusts the brightness of the center LED.
- One should never simply pull the plug on a Linux computer (especially one with a known-to-be-slightly-fragile filesystem on SD card). So, the bottom-left button on the bliso is configured for shutdown, and the bottom-right for reboot.
Bliso.sh is started in init2 mode by an @reboot line in crontab: it then triggers shutdown -h now or shutdown -r now as appropriate.
- The webpage is index.php. It's mostly quite simple, merely binding button-presses to bliso.sh via PHP's shell_exec() function.
- The webpage is all in a single file for compactness and speed of loading. This includes the AJAX code, the CSS, and the icons themselves (embedded in a data: URI).
- The gradients are all drawn in CSS, and the buttons are actually just links, styled as buttons. The reason for AJAX (rather than form posts) is that it makes the interface seem more responsive, and that merely re-loading the page
(without clicking one of the buttons) should never trigger the beeps.
- Just for fun, the interface automatically changes colour and the name of the meal depending on time of day.