Take full control over your comfort.
The Devana Labs Hardware department was scheduled to start on Oct 2015. We needed to figure out how to exploit the provided facilities in order to unlock their maximum potential, which includes a beautiful space, solid equipment and a dozen talented students eager to test and push their capabilities further than they thought possible.
We needed to warm up at first, so we had prepared a lightweight project to help us shape our vision and expectations. And of course, some of us always wanted to control home appliances remotely.
Goals and plans
Our goal is to develop a simple and affordable Smart office solution.
In the beginning, we had significant problems hooking the ESP8266 module up to the Arduino. Later, it turned out that our only module was broken. This broken module had caused a week of delay, so we had decided to switch to another option which we had at our disposal: The CC3000 WiFi shield, which would be used as an access point.
There are literally thousands of available Smart Home/Office open source Hardware/Software solutions on the web, but they are all using a public cloud server and proprietary protocol. Now, it’s not that we were concerned about someone unauthorized seeing if our lights are on, as this could be publicly seen anyway, but we wanted to do things our way and to open doors for new possibilities. In favor of our choice is a recently publicized article about the vulnerability of IoT. It seems that we had made a good choice.
So we continued with the CC3000, and had created our first server/device MVP.
Problems with the CC3000
As soon we started testing, our problems with CC3000 appeared. After half and hour of operation, the device would stop. Secondly, the device was unable to handle bursts of messages, so if you hit the send button in quick succession on our test app, it would stop functioning. Furthermore, the response from the device was mostly OK, but sometimes would take as long as 5 seconds respond.
Moving on with the ESP8266
During our wrestling with the CC3000, a new shipment had arrived from Aliexpress, which had brought us new ventures with the ESP8266. Very soon we discovered that the new modules were working incomparably better than the CC3000. This was configured with the Arduino Mega, and the ESP8266 module, which worked very reliably. Then we figured out that the ESP had an internal microcontroller which meant that we would not have to use a host microcontroller. The internal microcontroller is a very powerful (for 5x5mm footprint) 32bit MCU that operates on an 80MHz clock. Currently, only 20% of the CPU is occupied by the WiFi stack, with ~36KB of free RAM. Additionally, the ESP8266-12E board now has 12 GPIO pins and enough non-volatile flash memory to store our written code.
First mock-up with ESP-only configuration. Peripherals are relay and DHT11, temperature and humidity sensor
Smart Labs is based on a client server architecture. Server can be any device capable of running Linux and a Django web application. This includes low power, single board computers such as Raspberry Pi. Web application is written in Python 2.7 and uses Django web framework in combination with Django REST framework. We have chosen Django because it has a good support, tons of usable packages and is designed for fast development without having to go in to details regarding web protocols and technologies.
The server has to manage a lot of peripherals and has to be resistant to power failure. To handle those problems and create a more responsible server, we have chosen to use a database to store information about peripherals. Currently, that is the most common free database, MySql.
Since there is a port of Arduino libraries for ESP8266 we had all the benefits of software part of the Arduino project. Every node consists of one ESP-12 and up to eight sensors and/or actuators. DHT-11 temperature and humidity sensors, PIR motion detectors, IR transmitters and relays are supported. Every node has its configuration saved on onboard memory so that it can be customised to specific needs.
When a node is turned on it first connects to WiFi network and registers every sensor and actuator to the server. This is done over http protocol and node acts as web client. Once the registration is finished node turns on a small http server and waits for the commands from the main server. For the next version we plan to add remote configuration of nodes to ease the process of installing SmartLabs system. Also, we plan to improve overall system security since we are currently relaying on the WiFi encryption.
Third part of the system is an Android tablet app. While we were working on it we had faced few problems. The biggest one was about making app nice and responsive. It had to look good, but to be practical. To be simple, but to give user the feeling of absolute control over their office. Intuitive design is also essential for good smart house app. Well, maybe it would be the best if you can check yourself!
Valerija SpasojevićFront End Developer
Dusan Gladović3D designer