Posts

Raspberry Pi Dashboard refactored

Recently I refactored the Raspberry Pi Dasboard to use the PHP micro framework Slim. I used the Slim Skeleton as starting point with Slim Twig View as template engine.

This update includes also the ability to control the colour of my various wordclocks and the possibility to manage mobile notifications into my Android app with the help of the Google Cloud Messaging.

Additionally I switch the power socket control to pilight, therefore I had to change the control to communicate with the pilight API.

The PHP code for retrieving the pilight config and control a power socket is shown below:

function getPilightConfig(){
    $output	 = '';
    $config = '';

    $socket	 = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
    $result	 = socket_connect( $socket, PILIGHT_ADDRESS, PILIGHT_PORT );

    $identify	 = '{"action":"identify"}';
    socket_write( $socket, $data, strlen( $identify ) );
    $output .= socket_read( $socket, 1024 );

    $data = '{"action":"request config"}';
    socket_write( $socket, $data2, strlen( $data2 ) );

    do {
        $output = socket_read( $socket, 1025 );
        $config .= $output;
    } while ( strlen( $out ) >= 1024 );

    socket_close( $socket );
    return json_decode( $config, true );
}

function sendPilight( $socketname, $state ) {
    $output	 = '';

    $socket	 = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
    $result	 = socket_connect( $socket, PILIGHT_ADDRESS, PILIGHT_PORT );

    $identify	 = '{"action":"identify"}';
    socket_write( $socket, $data, strlen( $identify ) );
    $output .= socket_read( $socket, 1024 );

    $data = '{"action":"control","code":{"device":"' . str_replace( ' ', '', $socketname ) . '","state":"' . $state . '"}}';
    socket_write( $socket, $data2, strlen( $data ) );
    $output .= socket_read( $socket, 1024 );

    socket_close( $socket );

    return $output;
}

TinyTX LDR Sensors

To monitor the control light of my cooker and oven I mounted two LDRs (light dependent resistor) on a TinyTX sender. The LDR recognizes changes of the light and the TinxTX sensor is redirecting this information to my Raspberry Pi. The Raspberry Pi is checking the local network for my mobile phone and notifies me with my android app when I am no longer at home and the cooker is still on.

Raspberry Pi dashboard Android App

To control my power sockets, receive push notifications and display TinyTX sensor data I developed a small android app, which connects to my Raspberry Pi.

Features

  • display sensor data from TinyTX sensors
  • control remote power supplies
  • minimal MPD control
  • possibility to receive notifications with Google Cloud Messaging
  • manage budget to a google docs table
  • receive android broadcast intent with Llama to send HTTP requests

Raspberry Pi dashboard and alarm manager

During my free time I am developing a small dashboard and alarm manager for my Raspberry Pi. The Webinterface is in Bootstrap-Style with small modifications to the Flat-UI Style. 

Features

Raspberry Pi TinyTX Sensors

With the help of Nathan and the german Raspberry Pi Forum I’ve adapted the development process for remote sensors which are connected via 433Mhz senders. The describtion for the installation and manufactoring of the sensors is described on the Website of Nathan and the german Raspberry Pi Forum. The TinyTX sketched from the Raspberry-Pi Forum are published on github:  https://github.com/meigrafd/TinyRX4,  https://github.com/meigrafd/TinyTX4

I have currently a DHT22 sensor which measures the temperature and the humidity, a DS18B20 temperature sensor and a PIR Sensor. Next I’m planning to add a LDR sensor.

The sender modules work with 3,3V which lead to problems with the PIR Sensor which only works accurate with 5V. I’ve discovered the solution for this problem on the following site: http://techgurka.blogspot.de/2013/05/cheap-pyroelectric-infrared-pir-motion.html