Home Dashboard using a Raspberry Pi

After creating a desktop home automation dashboard and, later, a live stream “digital picture frame”, I got the idea to combine the two into an always-on control panel that condenses everything I care about into a single kiosk which can sit on my end table or nightstand.

What it does

It’s essentially a condensed UI of the desktop version linked above which uses the same databases and processes.

  • Current indoor temperature and humidity (via DHT11 sensor)
  • If my Amazon Echo is playing music, it’ll display the artist, song, and album
  • If I’m watching TV, it’ll show the title, channel, and image/movie poster
  • Display unique icons for each person in the house (by sniffing for their phone’s bluetooth signal)
  • It’ll show the status of my lights (on/off) and update if that status changes (using the Wink API)
  • Through touch screen, allow me to control my lights in near real-time.

Materials Used

How it works

Much of this (temperature, humidty, DirecTv and Wink control) is covered in “The Foundation” post.  Specific to collecting information from the Amazon Echo, I use IfTTT and the Maker channel.  Each time my Echo plays a song, I POST to a script similar to the one below which stores the song in a MySQL database.  I can then query that, determine if the song is still playing, and publish it to the UI.

<?php
$conn = mysqli_connect(<credentials>);
if (!$conn) {
 die("Connection failed: " . mysqli_connect_error());
}
$song=$_REQUEST['song'];
$artist=$_REQUEST['artist'];
$album=$_REQUEST['album'];
$timestamp=$_REQUEST['timestamp'];

$sql = "INSERT INTO echo_history (artist, song, album, timestamp)
VALUES ('$artist', '$song', '$album', '$timestamp')";

if (mysqli_query($conn, $sql)) {
 echo "New record created successfully";
} else {
 echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}

mysqli_close($conn);
?>

My Maker recipe looks something like this: IF then to URL

recordmusic.php?artist= {{ArtistName}}&song={{SongName}} &album={{AlbumName}} &timestamp={{PlayDateTime}}

Method POST.

That’s about it for the controller – quite simple and is probably the most practical project I’ve done thus far.

Advertisements