Monday, 17 November 2014

ArduinoHomeAutomationProject: The Concept - The cognition that something big is approaching

THE START

I started to make a concept for an Arduino based home automation a couple of month ago.
In fact the concept isn´t ready yet, there are really much things you have to mind but it´s a start.

You have to mind: What should the whole thing do? How should the user interact with it?
Trust me! KEEP IT AS SIMPLE AS POSSIBLE! It will be a hard nut to crack anyway.

THE NODE

First of all we have to be sure what the sensornodes should do.
  • measuring (temperature, humidity, light intensity, buttons, current...)
  • actuators (switch on lights, radiators, sprinklers, ...)
  • how should those "sensor - readings" be shown to the user (displays, web interface, GUI for mobile devices,...)
  • how should the user interact with the system
  • communication & protocol

Is it possible to do those things with a small microcontroller like Arduino?
The answer is: most of them. We can get the sensor data, switch things on and off, and Arduino has the possibility to use displays (LCD, OLED, ...).

THE NETWORK

When you think, "that’s more than half the battle" you’re definitely wrong!

It´s a start, a sensor-node, but we need lots of them! Let’s say at minimum a handful for a small flat.

How should they communicate to each other? Arduino has SPI, I2C and Serial UART (RS232) on-board. What am I able to do? How can I extend the range of electronic signals? Do they have enough bandwidth?

It´s on you what you’re going to pick, there is enough useful hardware on the market and you can get an ArduinoLib for most of them. I´m not a great fan of radio communication so I decided to give RS485 a shot. It´s long range (over 1000m) bus-network, which is stable, doesn´t need much electronics and communication should hopefully be as easy as Serial.read(), Serial.print().
In fact there are also radio-transceivers which will work with the UART of the ┬ÁC, but I wasn´t able to test them till yet.

THE DATABASE

If you’re planning an automation system or a sensor network, you probably want to save the sensor-readings into a database. I think you should, like me, give MySQL a shot. It´s free, it´s reliable, and there is a big community behind it. The planning of the database will be its own story to tell :-P

THE WAY FROM THE SENSOR TO THE DATABASE

If you use Arduino plus an Ethernetshield you have the ability to write into a DB. It is possible, but that’s not the way I wanted to do it. I was really afraid of performance issues caused by DB queries.
So I decided to take another popular device, the Raspberry PI. The RasPI should do all the jobs I’m afraid Arduino has a lack of performance. The Raspi itself also has a huge community behind it, it’s a Linux based PC, doesn´t drain much current and it is possible to run a DB Server on it. So there is still one problem left... "How the h... can we get all the data from Arduino to the DB???".
Well, you can break your minds or follow my considerations.
We have:
  • PHP, it has the ability to read from the Serial with a library, I was not able to verify it´s reliability and I´m not a big PHP Coder.
  • PYTHON, I’m not familiar with python
  • JAVA
  • Processing, it´s a sister project to Arduino so the Environment plus the Syntax are familiar to me. (option chosen)

So all we have to do is writing a "bridge-program" which takes the data from the bus, process it and handle it to the DB.
Sounds like a plan, doesn´t it? 

THE INTERFACE TO THE USER

For me that was really one of the hardest decisions in the whole project. I wanted to get the GUI into the WEB and the only chance I´ve seen to get everything together was PHP (that´s hard, I don´t really know PHP nor have I ever written a code in PHP). So I have to learn PHP, "OH MY GOD!".
The fact, that I´m not used to it will definitely slow down the work progress.

THE CONCLUSION

If you think that were the main questions and we are ready to go, follow me on my adventure, and let´s proof you´re wrong.


Impressum

Auer Markus
Karwendelstr. 13
A - 6020 Innsbruck