Saturday 13 May 2017

Raspberry Pi based Radio Alarm Clock (part 1)

As part of a project to develop my electronic and programming skills plus need an alarm clock I decided to build one from scratch using a Raspberry Pi.

Partly inspired by the Pimoroni Pirate Radio kit which was is based on the Raspberry Pi Zero W. The wireless enabled version of the miniature version of the Raspberry Pi.

My initial wish list was for it do the following

  • Display the time
  • Play radio channels
  • Sound an alarm at a set time
  • Simple controls

The feature keeps on growing as I have further ideas and inspirations, the current feature list is as follows.

  • Display the time
  • Display the day
  • Display the date
  • Play streaming internet radio stations
  • Play MP3 file from local
  • Play MP3 file from network
  • RTC time source in case of no internet access
  • Display today's weather
  • Sound an alarm (7 day bases)
  • Simple controls
  • Management web server

My ideas for the simple control was to have a single press button to select various modes, a multi-function button using a rotary encode with a combined push button and a large illuminating push button for the alarm off.

For the time display the Pimoroni microdot phat caught my as interesting display and I decided to incorporate that as a time display mimicking a lot of clocks.

As with all good projects I should of looked at more options for the hardware especially consider the later functionality I came up with.

For a sound option I decided on the Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi with their Stereo Enclosed Speaker Set.

This all came together as a prototype hardware rig on my workbench.

First Prototype hardware

One of the advantages of the Raspberry Pi and the ecosphere that has built up around it and the other micro-controller boards like the Arduino is that you can stack the shields to use the different functionality as long as there are no clashes with the pins being used or the addresses of devices being used.

For adding the control devices I need to wiring in the switches to the GPIO pins on the Raspberry Pi, although the Stereo bonnet has a row of plated holes replicating the GPIO pins it could become expensive if I needed to chop and change the wiring around. I went for the Adafruit Proto bonnet as a means of connecting the various controls.

First switch added to proto bonnet stacked on Raspberry Pi
One of the additional features I decided to include was to show a weather symbol on a OLED display to indicate the current days forecast.The current hardware design is show in the wiring diagram

Wiring diagram


The final prototype hardware is showing below
Final hardware assembly
The hardware interfaces are the default ones for the devices with a selection of GPIO pins for the switches that don't clash.

Device
Interface
Address
MicroDot PHAT
I2C
0x61, 0x62 or 0x63
OLED Display
I2C
0x3c
RTC
I2C
0x68
Stereo bonnet
I2S
GPIO 19, 21, 24
Mode Switch
GPIO
GPIO 16
Rotary encoder
GPIO
GPIO 6, 12, 13
Alarm Switch
GPIO
GPIO 5
Alarm Switch LED
GPIO
GPIO 20

I will be launching a Sourceforge page with details of the project and software as it is developed.

In the part 2 I will be looking at the basic configuration of the Raspberry Pi and the libraries need to drive all the hardware.




No comments:

Post a Comment