This instructable belongs to a huge project. This is just one part of it. In case you found this page first, please visit the main project https://www.instructables.com/id/GalileoHome/
The App Frontend enables to manage different devices (ventilator, door opener, lights, coffee machine) in a smart way. In other words, it´s possible to control those electrical appliances through your mobile phone and even to have your own presets with ideal temperature, light and volume. values. In this way the different devices work respectively if the command in the app is invoked or if the conditions of your home reach the preset values. Our assignment consists on how to manage the connection between the appliances and the app.
This is part of the final project named “Home automation” of the course “Multimodal Media Madness” which belongs to the Media Computing Group at the RWTH Aachen University. More information about this and previous projects can be “browsed” on the website http://hci.rwth-aachen.de/m3_ss15. The creation of innovating tools which make life easier and personal fabrication are the main topics of the project, which was possible with the use of a 3D printer, 3D-design software and an Intel Galileo board.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Prerequisites
• Mosquitto Server + Clients
• C++ Standarlibraries
• Unix-compatible C++ Compiler (for example G++)
• Unix-based operating system
Step 2: Communication
Two protocols were used to make possible the communication between the app and the devices:
We used the open Client Server MQTT protocol for the connection machine-to-machine (M2M)/Internet of Things (IoT). MQTT is based on a system of transport using two commands/instructions, publish and subscribe. This event based protocol is advantageous for applications which require a smaller amount of memory when running and for locations with scarce network bandwidth. You can find more information in the webpage of MQTT: http://mqtt.org/
MQTT creates a system where clients and server (this is called the broker) interact and interchange messages which represent data. Connections take place through TCP (Transmission Control Protocol). Messages contain data from the so-called topics which are a sort of parameters. The clients are respectively subscribed to a range of topics and they receive the messages published to those topics through the broker.
To make possible the communication with the application it was used another protocol, the Hypertext Transfer Protocol (HTTP). HTTP uses as well the transport protocol TCP. The app sends HTTP-requests to the server. These requests are processed through the API-Server and sent to the MQTT-server. For this purpose the server API works as a device and for that reason it can publish information (messages). To get to send messages from the MQTT-server to the app the API-server subscribes to all the topics from the MQTT-server und write them in the corresponding HTTP data files. Consequently it’s possible for the app to query and represent the information through easy GET-requests.
Connections are easier to understand on the pictures.
Step 3: Management of the Rules
Die app enables that the User creates his own rules. These rules consist of a combination of values of sensors and functions of the devices. Verification and changes are effected through an event manager, which is part of the server API.
Step 4: Building Your Own Server
Installing the developer image:
- Download the Intel Galileo Developer image from http://iotdk.intel.com/images/iot-devkit-latest-mmcblkp0.direct.bz2
- Extract it with a tool of your choice
- Then copy the whole image onto your micro SD card for the Galileo
Maybe the root partition is too small for the next step. If so, you may resize the partition with a tool of your choice (e.g. gparted)
Login vie SSH:
- Get the ip address and log in with ssh (ssh root@IP)
- Go to your home directory
- Pull the repository with git pull (git clone https://gitlab.com/M3-Final-Project/M3-Home-Automa...)
- Got to the Image directory (cd M3-Home-Automation/Image)
- Run the install script (./install.sh)
Make some configs
- Edit the config file at /etc/m3config (vi /etc/m3config)
- Here you can choose whether it should be a server or a client
- If you select server, then you must enter the current IP address of your Galileo