This is how to build the mealtime announcer. The name is after the phrase: "Dinner-is-in-the-Dog". It was originally built as a birthday gift for my father.

0. This is an original model B (256M RAM, rev1). No heatsink fitted. Base = Raspberry Rock (for display). Extra hardware: BLISO board (http://circuitsurgery.com/raspberrypi/bliso.html)
   [As it only uses 1 USB port, and no ethernet (except for initial setup), a Model A would also work.]
   NB, use a good PSU, AND bypass all 3 of the polyfuses. Otherwise, the WiFi is really unreliable, and we sometimes get SD card read failures.
   After doing the bypass, don't hotplug USB devices, as it causes a brownout/reboot.

   Ensure that the middle link on the BLISO is set for the LED rather than the button. 
   [I soldered mine, rather than using a jumper, because there isn't enough vertical height under the lid of the Raspberry Rock.]
   
   
1. 2013-07-26-wheezy-raspbian.img, on 8GB uSD card.

2. Firstlogin: expand filesystem.  Password: [see passwd.txt, not distributed in the online howto]. No boot to desktop. Hostname "raspberry". GPU = 32M. No Overclock (it's unneeded, and we otherwise have SD-card corruption issues sometimes (though this may be polyfuse-related)

3. Copy over ssh key. Apt-get update/upgrade. Set up bash and inputrc.

4. Install wiringpi, wiringpi-python:  git clone git://git.drogon.net/wiringPi  ;cd wiringPi ;git pull origin ; ./build
   apt-get install  python-dev python-setuptools 
   git clone https://github.com/WiringPi/WiringPi-Python.git ; 
   cd WiringPi-Python ; git submodule update --init ; sudo python setup.py install
     gpio -v; gpio readall
     gpio -g mode 0 output ;   gpio -g write 0 1; gpio -g write 0 0    #for the leftmost LED.
     GPIO 21 is the sounder.  gpio -g mode 21 clock ;  gpio -g clock 21 4000; gpio -g mode 21 out    (freq is limited to 4600-18000 - why?)
     PWM led:  gpio -g mode 18 pwm; gpio  -g pwm 18 512    #0-1023
   -> write bliso.sh to do some various things.

   Note that gpio is rather slow taking about 10ms per edge. Mostly this is the process-startup overhead. Examples:
	time for i in `seq 1 500`; do gpio -g write 4 0; gpio -g write 4 1; done
		=> 10.9s => 10.9ms per edge  (mostly process overhead)
	gpio export 4 out
	time for i in `seq 1 500`; do echo 1 > /sys/class/gpio/gpio4/value; echo 0 > /sys/class/gpio/gpio4/value; done
		=> 0.41s => 0.41ms per gpio edge.  (note that echo is a bash builtin)
	gpio export 4 out
	time for i in `seq 1 500`; do /bin/echo 1 > /sys/class/gpio/gpio4/value; /bin/echo 0 > /sys/class/gpio/gpio4/value; done
		=> 9.3s => 9.3ms per gpio edge.  (/bin/echo is much slower)


6. Install PHP:  apache2 php5 libapache2-mod-php5 fping

7. Network. Put this in /etc/network/interfaces:  (note that this IS sufficient to configure wpa-supplicant),

	auto lo
	
	iface lo inet loopback
	iface eth0 inet dhcp
	
	auto wlan0
	allow-hotplug wlan0
	iface wlan0 inet dhcp
	        wpa-ssid "OUR_SSID_GOES_HERE"
	        wpa-psk "OUR_WPA2_KEY_GOES_HERE"

	        
This particular Pi has:
ethernet: HWaddr b8:27:eb:de:1e:53 
wlan:     HWaddr 00:e0:4c:00:3b:3b  
(so configure my DHCP server to allocate a reserved/fixed IP, corresponding to the DNS address, of "raspberry....").

The WiFi Dongle I'm using is an EDUP, identified by lsusb as: Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
It's not hugely reliable. One suggestion is to disable power management thus: http://www.xbmchub.com/forums/raspberry-pi-discussion/8037-your-wifi-dongle-dropping-connection-mainly-edimax-ew-7811un.html
  echo "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0" > /etc/modprobe.d/8192cu.conf
Check that power-management is off (after restart):  cat /sys/module/8192cu/parameters/rtw_power_mgnt
[Note that shorting the polyfuses has helped a lot now.]
  

8. Scripts in bin go in ~/bin. Chmod +x.  Delete /var/www/index.html (so .php takes priority). Then symlink:  ln -sf /home/pi/bin/index.php /var/www/index.php;  ln -sf /home/pi/bin/images /var/www/images

9. Crontab (as pi) has:
	@reboot /home/pi/bin/bliso.sh init2
	@reboot /home/pi/bin/checknetwork.sh		


10. To use:
	Setup on network (wifi, DNS, DHCPD)
	browse to "raspberry".  (if necessary, use IP, or http://raspberry).
	Click the button.

	Or, click the bottom-left of the bliso buttons to shut down.
	Or, click the bottom-right of the bliso buttons to reboot.


11. To do in future:
	- Would be nice to have a lower pitch. But 4000 Hz seems to be the minimum. Also, possibly some more imaginative LED flashing patterns.

	- Might be useful to lock to somehow prevent contention between multiple instances of bliso. (especially in 5 minute countdown mode).
	  [The current workaround isn't perfect].

	- bliso.sh has trouble flashing all the LEDs together (each LED needs a new process of gpio, which takes ~ 5ms). It would be faster to avoid
          the new process overhead, by using echo > /sys/class/gpio/...  (echo is a bash builtin).
	
	- We could make the onboard green SD-card/"OK" LED act as a heartbeat etc: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=12530

	- It would be nice if we could perfect the vertical spacing of the buttons, for multiple screen-sizes.

	- JS GUI - would be an improvement if multiple presses of the buttons didn't leave competing JS timers running.
	
	
12. Note that the Glyphish icons included here may be redistributed freely (as in beer), but are not GPL. See 00-readme-license.txt for the details.
