Menu

Home

Hans Cornelissen

Objective: create a week based alarm clock written in Python running on a Raspberry Pi

priority/function
1 show current time
1 alarm sound on specific time
1 non intrusive
2 configure alarm
2 easy snooze function
2 easy skip next alarm function
2 instantly visible if next alarm is within the next 12 hours
3 automatic time sync
3 configure current time (when sync is not successful)
3 backlight brightness depending on room lighting level
3 choose mp3 file for alarm sound
4 schedule alarms over a week away
4 configure backlight brightness levels
5 multiple clock types
5 colouring themes

..

The clock will be used in the bedroom so it is important that no unwanted sound or light is emitted by the device.
Must be reliable to wake me up on time.
Friendly and simple interface to control clock and alarms when just waking up.

Hardware

  • Raspberry Pi (laying around)
  • Small case to keep everything compact
  • Display with touch function to keep control easy without the need for anything other then a finger
  • Capacitive touch system so touch is registered easily without the need for any force
  • DCF77 receiver for current time information
  • LDR for measuring light in room to adjust screen brightness
  • Audio output device

Software

  • Raspberry Pi, so linux OS
  • Python 2 or 3 because i want to get some experience with python for upcoming work related projects
  • Python libraries
  • Raspi tools..

Design decisions

Python 2 or 3. 2 is standard on the Pi and a lot of Python libraries are installed for version 2 => Python 2
Library for time and date support
Library for accessing IO pins.
Library for graphics
Library for audio
Library for UI controls

Maybe first some hardware decisions

Pi is model B (not+)
Seen a nice case for the Pi @ Adafruit
They also have a capacitive touch TFT display that fits the case
And some switches that fit the display and case
I have a DCF77 device laying around from Pollin which will need an extra transitor to invert the data signal to be able to use it with ntpd
Because I will be using the PWM interface of the Pi to control the backlight the standard sound will not work reliably.
JBL have a USB speaker that will work with the Pi: JBL pebbles
USB power supply with right angled micro usb plug or cable.
Optional: USB wifi to sync the time over internet
LDR and capacitor (10nf (103) or something, have to experiment..)

Python

Python IDE: decided on PyCharm in the end.. works fine on windows.
Standard time and date libs..
GPIO, wiringpi2 or RPIO. Last one has interrupt support ie handle Python code on an hardware interrupt.
Wiringpi2 seems better with PWM, less jitter. RPIO has DMA PWM which seems better for dimming the backlight smoother.
Transitions of the DMA PWM signal up in pulse width produce some jitter with the backlight flickering just when you want the screen to become more brightly in a smooth way.
Maybe use wiringpi2 and RPIO (and RPIO.PWM) together.. seems to work.

I want as much control over the graphical screen as possible. X is not a nice environment to keep things simple. Other frameworks seem a bit overkill or are just ugly.
I decided to go with pygame and create my own controls; just a simple set of controls for the UI. That way I can make it exactly as i want it.
Pygame also has audio support so all code is within the python environment.
Btw: I looked at a control lib created for pygame but found it to be too generic.

..

Project Members:


Discussion

  • Ronald Scharroo

    Ronald Scharroo - 2017-08-13
     

    Last edit: Ronald Scharroo 2017-08-19

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.