Pi-in-a-Box is a simple plastic box containing a switch and a Raspberry Pi connected to a speaker. When the switch is turned on, a program on the Pi calculates and reads out the digits of π in real time.
The electrical portion of Pi-in-a-Box is as simple as a DPDT switch (only using one pole so it could be SPDT, but I only had DPDTs lying around) connected to GPIO pins 16 and 20 (BCM) of a Raspberry Pi Model B+.
I also extended the audio output on the Pi to a jack on the enclosure, with a hole beside it for a Micro-USB cable to power the Pi.
This let me easily connect Pi-in-a-Box to the speaker conveniently supplied in the Airbnb apartment I'm staying at for the week in Reykjavík, Iceland.
Pi-in-a-Box would be pretty useless without its software (even more useless than it is already!) A Python script uses the RPi.GPIO package to listen for changes in the switch state and commands another script to start calculating the digits of π and reading them aloud with the simpleaudio package - see the code section for details (i.e. actual code).
Comments