Originally this project was meant to be my entry for the "Windows 10 IoT Core - Home Automation Contest" here on hackster. Unfortunately I could not finish the project on time (it is still not finished and will be extended), but I thought I am going to publish it here on hackster anyway, regardless of the contest. And delivering late, is better than not to deliver ever.
The Story Behind the Idea
My daughter was telling me, that she was afraid sometimes to sleep in her room (she's 8 years old) if I don't leave the lights turned on. Many of you (if you have children) will know about this kind of scenario only too well :) So we (me and my daughter) decided to put this Iron Man themed night-light together.
- Turn extra lights on and off via voice commands
- Turn the connected clock on and off via voice commands
- Send out SMS messages to parents if anything is wrong via voice-input
- Emergency calls (not implemented yet)
- Play a pre-defined set of preferred songs via voice-input
- Set time and alarm via RFID cards (set time, set alarm, alarm-on, alarm-off)
- Video streaming (implemented in code, but not yet activated, which will be run using Microsoft Azure)
Used Operating Systems
- Windows 10 (and Windows 10 IoT-Core)
- Linux (Raspian)
During my tests, I realized that Windows 10 IoT Core, Windows 10 Mobile and Windows 10 for Desktop are very different in the way they handle voice-input and output. The source-code for voice input will work on the RPI2, a Windows Phone and the desktop (try it yourself), but I think I have to check additional scenarios for different device-types and how to handle the different platforms appropriately.
For the first demo of the project I made the decision to run the NiteLite app from the desktop. I had it working on the PI2 as well, using a very cheap microphone and a USB-Soundcard (later this will be the preferred device). For now, it runs on the desktop and Raspian is taking over the backend-parts.
Used Programming Languages, Editors and IDE's
- VIM on Linux
- Visual Studio 2013 and 2015 on Windows 10
VIM is a bit strange at first (especially when you come from a Visual Studio background), but it is one of the most versatile editors out there that I know and love for many years.
Visual Studio gives you the power of an IDE that has been loved and supported by millions of developers world-wide and that has a productivity-factor that cannot be topped by other IDE's on the market.
Here are the programming languages and execution environments used for the different parts of the project:
- Visual C# for the Web API server (full blown .NET)
- Visual C# for the Streaming Server (full blown .NET)
- .NET Micro Framework for the Gadgeteer part, also C#
- Mono as the runtime and the serial commanding part on Raspbian, using the latest Xamarin repositories
- Node.js for the media-player part
- Pyhton in conjunction with OpenCV for the camera capturing and streaming part on Linux
I must say, that the Mono-Part on Linux worked out quite well. Using Samba to create a network-share on the PI was pretty easy. Visual Studio just had to copy the resulting assemblies to the RPI2 share and I just used putty to execute the code using Mono. Because I am not very familiar with Python, that part was not as easy to manage. However, Python is a very intuitive language and the setup of OpenCV using Python bindings worked out very well and without any major issues.
- 3 Raspberry Pie's 2 (one for the Web Api Server, one for the Node server and one for the Python/OpenCV scenario)
- One Fez Spider from GHI (.NET Micro Framework + Gadgeteer) for the clock
- 2 Teensy 3.1 boards (one for serial-communication, used as a USB2Serial bridge, one that was used to control the Iron Man pulsing and lightning via a serial connection to the Bluetooth Low Energy module)
- One Oxygen board (.NET Micro Framework) using a Hydrogen Bluetooth Low Energy module. This module was connected via a serial connection to the previously mentioned Teensy 3.1 board
- GHI RFID Reader module for the Fez Spider (to read the input of the various RFID-Cards)
- GHI SDCard module to be able to change backgrounds on the clock's screen every 5 minutes
- GHI USB Power module to power the clock
- GHI Wireless module, to give the clock access to the local network and the internet
- One standard RGB led to enable Iron Man to pulse in three different colors
- Two 2mm LED's to show the status of he serial port on the Teensy 3.1 that was used as a USB2Serial bridge (incoming and outgoing serial traffic)
- 2 TP-Link wireless adapters TL-WN725N and TL-WN823N (work both without any issues under Raspbian)
- Various sheets of acrylic glass, 5mm and 8mm thick
- The cheapest Iron Man figure (plastic) that I could find out there
- One cheap USB-Sound-Card (any will do) for Windows 10 IoT-Core (previous tests), with two standard input jacks to connect a simple microphones and headphones
- One super cheap desktop microphone that I dismounted and positioned as an add-on on Iron Man
This image-series should give you a pretty good overview on how the components have been put together:
You can download the code for the project on GitHub:
The rest of the code will be published in a separate repository and made available shortly.