Blog Image

Make it happen

Soil moisture fail

Home automation Posted on Mon, May 09, 2016 08:48:39

The soil moisture sensor I used for my Plant Monitoring was a huge fail. I used a cheap sensor from china that didn’t seem to handle water so well!! The conductive foil has deteriated!
The new solution is a lot simpler. 2 wirer soldered to two nails.
Seem to work just fine.


Home automation Posted on Thu, March 17, 2016 12:44:55

Now the camera is partly working..

It’s currently only working in my own home network. I’m not able to take photos outside of my own home.. which is kind of the idea.

The solution for this is really simple. I’m using an old android phone with an app called “IP Webcam”. This app makes it possible to take photos and record video through a webinterface. Clicking tha “camera” button in my dashboard will take a photo and display it in my “Info-window”. This picture is also possible to click to get a bigger version.

The next step is to figure out how to do this from a different location outside of my home. Port forwarding does not work on my crappy router so I need to figure something else out.


Power part 2

Home automation Posted on Wed, March 16, 2016 15:30:45

Now the data is collected from the database and presented in a nice interface.

I have decided to show current conspumption as a graph ( API used), I also show todays, this weeks, this months and this years consumption. Clicking on the little graph icon in the upper right corner takes you to the detailed view shown in previous post.

One idea I have is to add a “recording” feature. I’m thinking if I would like to meassure a specific appliance in my home I could compare the average consumption for lets say 10 minutes back with the “recorded time period” , the difference should give you an idea of that specific applience consumption. Not 100% but still a good indication I guess.

I’ll let you know..

Yeah right.. code. The user interface is html so I guess you can figure that out. I have attached my power class that does the calculations. (I’m not a programmer so my php syntaxing is probably not by the book, but it works. ) smiley

I’m keeping detailed data (readings for every 60 seconds) for 7 days, older data is deleted. Every day data is aggregated to a daily table that is stored until the end of time.

Power part 1

Home automation Posted on Tue, March 15, 2016 11:58:18

Part one of the power measurement is now complete.. I have the ESP connected and reporting blinks from the power meter in my basement. Now I only need to get some power data and put in my home automation dashboard.

Here you have my nice little enclosed “pulse meter”.

This little box contains a ESP8266-1 connected to a LM1117 voltage regulator (to ensure a limited power supply to 3.3V) The sensor I’m using is a Light-to-voltage sensor (TSL 250R). The sensor is sticked to the power meters LED that blinks with different speed depending on current consumption. My sketch counts number of blinks for 10 seconds and then sends the data to my webserver (same way as “Plant example” does). I have done some timing measurements and for every 10s I’m losing about 100 milliseconds that the ESP needs to run it’s own background programs and also to send the info to my webserver. So for every 60 000 millisecond I lose 100 ms and I can live with that.. the measurement will be good enough anyway.

I have done a project like this before (using a rf receiver/transmitter) so the majority of the code on the web server side is already written. This is an example of how it looks today with it’s current layout (a really crappy picture but I think you get the idea). I might keep this as some sort of detailed view.
The data is collected from my mySQL db and the graphs are created using

Next: The Power button

Home automation Posted on Thu, March 10, 2016 09:23:21

Alright.. now we have working buttons for light and plant monitoring in the dashboard.. let’s move on to the next button: Power

The idea here is to read my house current power consumption. I plan to do this by reading the little blinky led on the power meter. This led blinks with different speed depending on power consumption. My meter will blink 10.000 blinks/Kwh

I plan to use a light-to-volatage sensor to be able to translate the blinks to a input signal for my ESP8266. When I have the number of blinks in the ESP, I will send them to the webserver similar to the Plant example.

Easy peacy.. right?

“Plant monitor” code

Home automation Posted on Thu, March 10, 2016 09:07:31

Here is some of the code to get the “Plant information”.
The DHT and Soil moisture information is sent to my webserver using HTTP GET requests.

The sketch sends the HTTP request to temp.php on my webserver and this page then reads the data sent in the request (temp, hum, id & soil). Since the sensor data is updated every 30 seconds (I will change this to maybe 4 times per day), the database is filled with a lot of information. To deal with this I have created a “daily” table to store information for longer periods of time and also to be able to create nice graphs in the future. All data in my “detailed” table older than 7 days will be deleted since I don’t see a actual need for this detailed infor for so long time.

Below I have attached the code for the temp.php page.

From temp to permanent

Home automation Posted on Wed, March 09, 2016 12:05:08

Today I made my soil moisture connection a bit more permanent.
This is what I use to send data to my “Plant” info in my home automation project. I’m sending air temperature, humidity via a DHT22 (or DHT11.. I’m not really sure which one I use). The info is send to my webserver through my ESP8266-12 and store in a mySql database. To meassure soil moisture I had to change my ESP8266-1 to -12 since -1 can not handle analog values (only Esp8266-07 & -12 can do this as far as I know.)

The info is then displayed the bigger “info-screen” in the dashboard.The pictures of the Plant will change depending on soil moisture.

New dashboard

Home automation Posted on Tue, March 08, 2016 11:32:05

Created a new dashboard for my home automation system.
Some of the Buttons are just ideas but now all the lighting and Plant status work. smiley