When our developers Andrew and Nazar had ran into smart home topic, they’d decided to sort out the activation of various electric appliances with the use of a cellular phone. Their idea was to find an easy to use and a fun way, so they’ve chosen the Raspberry Pi.
Paspberry Pi is a British developed credit card sized microcomputer family, utilizing ARM compatible Broadcom’s SoCs. It has a wide range of boards themselves sporting CPUs from 700MHz up to 1.2GHz and the RAM ranges from 256MB to 1GB. Most boards are equipped with several USB ports, Secure Digital slot (microSD sometimes), audio jack, HDMI, and the newest Pi 3 is packed with Wi-Fi 802.11n and Bluetooth.
Raspberry Pi Foundation, responsible for the development of this wonderful device, provides a Debian-based (thus highly stable) Linux distribution called Raspbian, though a vast range of Ubuntu-based, Windows 10 based and many other systems are available. Python is supposed to be the main programming language, accompanied with Scratch and the synonym of multiplatform goodness – Java. Surely, with so many distributions available there is support for countless programming languages.
With ten million Raspberry Pi units sold as of September 2016, one can be sure that there are both: a big fan base and loyal and skillful community accompanying this small and versatile machine.
So, with managing platform chosen, the first step was controlling of cutting and supplying power to a fan. The fan happened to be standing on our HR’s desk, so he enjoyed what seemed to be The Rize of the Machines.
The method was quite straight-forward: the fan was connected to the power source indirectly, but through a filtering relay, controlled by Raspberry Pi. That meant the own switch of the fan should be always “on”, and a command from the Pi’s port to the relay could supply or cut the power. Port bonding was quite a challenge, but initiated a data research bringing new more apt relays to the project.
Even a simple triggering relays, being actively controlled, bring wide possibilities. Full room of appliances could be connected to a set of filter-relays and switched on and off by a time-table, pattern, rule or a direct command. Mind you, own switches must be “on”.
After gaining ability to bond and control the relays by Raspberry Pi ports, the next step was the software. The one that brought real versatility to the project. After guys blew all the important papers off HR’s desk. The ability in question was the aforementioned timetables, patterns, rules and a possibility to wirelessly ask the Pi to blink HR’s desk lamp.
Raspberry Pi runs Linux loaded with all the great tech we are used to see in that OS. Light, stable and apt, all in a credit card sized design, it was loaded by our new server software, that processes all those timetables, patterns, rules and direct commands and translated them through it ports to filter-relays switching on and off all the connected gear or any at a time.
That already allowed a nice control over full rooms, leaving a need only in a client app. So, the developers have created an Android app that allowed first only direct commands over WiFi connection and later a full control over server’s functions.
Their next step was a shift to a more precise control over the appliances, than just switching them on and off. Our office air-conditioner became a subject to their experiments. The developers used the own aircon’s remote to teach an IR transceiver connected to our loyal Pi aircon’s commands, that allowed them to implement control over the climate machine using sequential commands emulating pressing buttons on the remote. Now the server may be programmed to set the aircon on “swing”+”18 degrees” in Summer mornings before everybody arrives, and switched off, when everyone leaves all by a timetable on the Pi-server, or set to “+28” from chief developers Android phone when he feels chilly, or is testing his favourite Pi-controlled cooling fan.
Since Pi is interface rich, runs Linux and has a server, a VPN can be created to control one’s home or office from a distance only limited with Internet reach, including full control over lights, climate and dead switching all electrics if needed.
This system also has great security capabilities. Movement, perimeter and volume sensors could be triggered or watched through it, alarms set and viewed, security systems activated or relieved. All with a simple Android App connecting to a Raspberry Pi running our server software.
As of present moment our developers are able to robotise an electric appliances rich room in a month term, including heating, cooling, lights, security sensors and webcams, all with an Android app and server support.
They develop schematics individually, providing it to customer’s electric engineers to integrate the needed hardware into the room’s electrics and on the last building stage connect and tune our server giving flexible control into clients’ hands. And relieving from those torturing questions like: “have i turned the lights off? Have i left the kettle/iron on? Is the aircon on?”
Not only control is possible though, monitoring the security stations and power consumption is also possible. It’s another topic, but our developers are quite interested in it.
Nice idea to switch everything unneeded leaving the office, charge the security system, set the home aircon to 20, switch the preset multicooker on and ask the kettle to make some hot water for a lovely cup of tea till seven o’clock, just by a touch of an icon in a phone app, while going down in the lift of your office building, isn’t it? Well, our HR is very fond of all this now, when he knows that his cooling fan is quite sane.
The code is available on Github.