Home Automation

DSC_0074

Behind the project

Even though I started this project very long back I started blogging very late. So, a brief history about my most favorite project “Home Automation”.

Software

Till date tried lot of options. Major one is my own screen gadget framework using Java Swing. This is so many years back. After that impressed with Java FX and migrated to Java FX.

But…

With Android OS gadget frame work is already in place. i.e. “Widgets”. I need to concentrate only on my widget not on frame work. So moved to Android widgets.

After that I have chosen jQuery + Phonegap. Almost same code for Andorid widget, Windows sidebar gadget, web application. But, for Android AppWidget still Java.

Hardware

Hardware side, AVR + my laptop(but sitting on desk) running on window.

But as laptop is power hungry and difficult to restart if power goes off and come back. I kept on searching for embedded devices which can solve my problem which should also work with less power compared to laptop/desktop. Tried with AVR + ENC28J60, Arduno, … Ultimately landed on Raspberry Pi. Now AVR + Raspberry Pi.

Overview of entire system

Wrote a Java servlet deployed on Apache Tomcat on my Pi. This will interact with hardware using Nordic nRF24L01+ which will send instructions to other controller.

Controller is AVR with Nordic nRF24L01+. Better if I show the picture. So, its here.

controller-with-servlet

Picture 1.01: Controller which receives commands from remote place(ex:web) and sends instructions to end points. XMPP server is to publish changes to other clients.

endpoint

Picture 1.02: End point(Device) controller

Why not XMPP to set/get device information?

Yes, why not? Decided to remove servlet which used to handle setting/getting device information and use XMPP itself. Now the new approach is…

controller-with xmpp

Picture 1.03: All communication is over XMPP

I think this is simpler than earlier design. Does it make sense?

@Feb 15, 2014 – 00:03

My RPi as an Audio player which can be controlled from my Mobile

I want to use this RPi as an audio player. So, bought(lazy to make my self) a basic and low power amplifier board from Hacktronics.

Components involved:

  • Audio amplifier connected to 3.5mm PWM out of RPi – Yes, its bad choice compared to HDMI, but a quick solution.
  • VLC media server on RPi.
  • Remote for VLC on my mobile.

Power for audio amplifier was taken from my other Device Controller. So, its always on – Need to have auto on-off control for this. But for now its fine as this is not a power hungry device.

@Nov 23, 2015 – 01:42

Upgrade to ESP8266

I bought a lot of ESP8266(from InkOcean) modules long back, but until now I could not got time to play with them. Last week, I could get some time on few mid-nights to play with ESp8266 WiFi modules. Initially I thought I will use ESP8266 C SDK. But I need to spend lot of time to get into that and learn it to write the code to suite for my application. So, searched for alternative ways and got NodeMCU’s Lua interpreter. Even though it has its own limitations, with my limited time I felt its fine to use it. At last I could get it up and running with Lua script. Written most of the bridging part between WiFi and Serial Port. Now I need to plug into Device Controller. Even though ESP8266 is power hungry compare to my existing nRF24L01+, it has lot of advantages as it is IP based so let me try and see how it goes.

When I started this initially, even though I did not had any plans on using different types of wireless modules, good that I wrote an abstract classes for wireless device communication initially itself. Now with ESP8266, it took me not even an hour to write another layer using ESP8266 module for my SesnorServlet. The next phase is to add ESP8266 layer to AVR.

@May 05,2016 – 23:33

ESP8266 in action

I changed AVR code as well to use ESP8266. But during this, I hit the major hurdle of Lua interpreter, i.e memory limitation and hence I have to move out of Luv. So, I moved to Arduino ESP8266 library and rewrote complete ESP8266 code and it worked fine. Now my AVR device is IP based. With 8266, the communication between the controller server and Device Controller is much faster.

Photos and Videos

Want to see real pictures? They are here.

Demo video is here.

sample-video

Pending Tasks

  • Integrate with calendar scheduling to control devices automatically.
  • Voice control.
  • Lot many…
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s