Blog posts for this project:





This week's progress on the IoT Alarm Clock! Mainly soldering, but also some testing.




During boot, I noticed some messages and characters were being displayed on the Pi-Lite. To get rid of this, I followed the steps below.


Edit the inittab file and comment out the following line (completely at the end of the file):


sudo nano /etc/inittab

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100


Edit the cmdline.txt and remove the following part:


sudo nano /boot/cmdline.txt

console=ttyAMA0,115200 kgdboc=ttyAMA0,115200


The full explanation can be found on the Ciseco website:0: Setting up the Raspberry Pi to work with Ciseco hardware



Arduino Micro


As mentioned in the first part of this project, I'll be using an Arduino Micro to add a bunch of I/O to the Raspberry Pi.

Using a small prototyping PCB and some male and female headers, I made a board to which:

  • the Arduino Micro can easily be plugged in or removed/replaced
  • buttons, LEDs, etc ... can easily be added and plugged in


As illustrated below, one row of male headers is connected to the Arduino's I/O on each side, and a second row of headers is connected to ground.

This allows me to plug in components which on one end will be connected to the Arduino I/O and on the other end to ground.

IMG_3673.JPGphoto (2).JPGIMG_3681.JPG


I configured the Arduino to wait for interrupts and send a character over the Serial interface towards the Raspberry Pi via the USB connection.

The Raspberry Pi waits for data to come in, and once it does, triggers the correct action.


Arduino code:


void setup() {
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);
  pinMode(2, INPUT_PULLUP);

  attachInterrupt(1, sendA, FALLING);
  attachInterrupt(2, sendB, FALLING);
  attachInterrupt(3, sendC, FALLING);


void loop() {


void sendA() {

void sendB() {

void sendC() {


Raspberry Pi code:


import serial
import os

ser = serial.Serial("/dev/ttyACM0",9600)

        x =
        if(x == 'A'):
                os.system("echo 'button 1' | sudo minicom -b 9600 -o -D /dev/ttyAMA0")
        elif(x == 'B'):
                os.system("echo 'button 2' | sudo minicom -b 9600 -o -D /dev/ttyAMA0")
        elif(x == 'C'):
                os.system("echo 'button 3' | sudo minicom -b 9600 -o -D /dev/ttyAMA0")


The result of this test:







The breadboard pushbuttons worked fine, but I wanted something good looking, so I got some shiny illuminated pushbuttons.


I soldered wires for the pushbutton and for the integrated LED. Both are connected to the Arduino Micro, which can be used to react on button presses, but can also dynamically turn the button's LED on or off.

For example, by default all LEDs could be off until a button is pressed, in which case the LEDs will light up for 30 seconds before turning off again.

photo 2.JPGphoto 4.JPGphoto (1).JPG



Single power supply


Because I'm using the onboard amplifier of the Wolfson audio card, the card requires external power. Along with the Pi itself and the Pi-Lite, that makes a bunch of different components requiring a 5V power source.

I only want to use a single power supply to power my project, so I grabbed some cables, started cutting, stripping and soldering them into a master cable able to power all components.


Also, to make a more reliable connection to the Pi-Lite, I soldered some male header pins to which I can connect power and the serial pins of the Wolfson audio card.


photo 1.JPGphoto 2.JPGphoto 3.JPGphoto (3).JPG


As you can see in the last picture, all components are now properly connected to the Pi.



Train API


With all the soldering and hardware setup pretty much done, it was time to move to the software part of this project.


To fetch the train data and be able to use it in the alarm clock, an API to query is most useful.

Luckily, there is a third party API available for belgian public transportation, called iRail. API documentation can be found here: API/APIv1 – Project iRail


I've made some tests with calls that will be interesting for my application:


Screen Shot 2014-05-13 at 21.18.41.png

Screen Shot 2014-05-13 at 21.18.26.png


The second call returned 6 possible train connections between "Lokeren" and "Brussels South" for an arrival time around 09:00.

This data will need to be parsed carefully and the connection offering the most time to sleep in, while ensuring a timely arrival, should be selected.

In the exceptional case that all trains would be delayed, additional time to sleep in can be provided, while still picking the train connection with the best arrival time.





I started working on the enclosure in parallel. Not much done yet, but here's a sneak peek:


photo 1.JPGphoto 2.JPGphoto 3.JPG