Monday 29 June 2015

Measure the temperature and light enviroment

Hi! how you doing?, in this post i want to show one of the most interesting uses in electronics, the sensors. With arduino and sensors you can measure any physic event, like light, temperature, distance, noise, anything  you can imagine.

Here i measured the temperature and the light of the corridor of my home. The sensors are very cheap and very easy to use in an arduino, you can think, why i want  an arduino if i have pins in my raspberry pi?, and this is a good observation. But you have to consider that the raspberry only has digital pins and the arduino has digital and analog pins.
Most of the sensors requires analog pins to read the value, so you can't use a raspberry for this.

We split the post in two sections:
  1. how do we build the arduino and sensors
  2. how we communicate the raspberry pi (openhab server) with the arduino

Build the arduino with light and temperature sensor

Requirements
  1. An Arduino uno
  2. arduino ethernet shield
    http://www.aliexpress.com/item/UNO-Shield-Ethernet-Shield-W5100-R3-UNO-Mega-2560-1280-328-UNR-R3-only-W5100-Development/1620285783.html?spm=2114.32010308.4.2.4CoIdI
  3. DHT22 sensor
    http://www.aliexpress.com/item/1pcs-DHT22-digital-temperature-and-humidity-sensor-Temperature-and-humidity-module-AM2302-replace-SHT11-SHT15-Free/1059369726.html}
  4. Light sensor
    http://www.amazon.com/gp/product/B00AF278A8?psc=1&redirect=true&ref_=oh_aui_detailpage_o01_s01
  5. Arduino case (optional)
    http://www.amazon.com/gp/product/B00N52HR5Q?psc=1&redirect=true&ref_=oh_aui_detailpage_o02_s00
  6. Mini protoboard
  7. Wires

The light sensor is more easy than the temperature sensor, because you only have to read the pin to know the value. As every analog sensor you can read a value between 0-1024, this is connected to a digital pin but remember is a PWM pin, their behavior is like a analog pin.
With the temperature sensor is a little more difficult, but don't think is rocket engineering.
You have to download the dhtlib and use the library, there are other libraries you can try, follow this link if you want to learn more.

The Arduino expose the measurements as a HTTP server, this the reason of the ethernet shield. Could be also a wifi shield and you don´t have to plug the arduino to the router but remember the ethernet shield is extremely more cheaper.
So you have to use the ethernet library to expose the values, for convenience and more interoperability the values are formatted as xml.

Communication between the raspberry pi and the arduino

The raspberry see the arduino as a normal web page. You get the values inside a xml, so you have to do an HTTP request and transform the values.
I defined three numbers items, the temperature, the humidity and the light, in the binding you can refresh the values every 30 seconds for example.
I don`t do it, but you can for example make a rule for activate the air conditioner if the temperature have a determined value or switch on the light if is getting dark.

Sunday 21 June 2015

Control your termostat



Hi everyone!, this post is to explain how do i control the thermostat in my home. As you know the electrical thermostat is one of the appliances that consumes more energy, especially in winter it is a good idea to turn off the thermostat when you are not in home. There are a lot of cheap timers you can buy anywhere, however,  the principal advantage applying the concept of internet of things is  control the appliance everywhere and apply more intelligence.

Saturday 20 June 2015

Control the air conditioner with openhab



you want to turn on the air conditioner and you can't find the remote control, or in case you find it it, the batteries hasn't enough power. Yes, is so frustating.
Anyway, if you don't have any of this problems is a good idea to have only real universal remote control, one you have all the time with you, your cell phone!!.

Monday 15 June 2015

The Domotic Server


hi folks!, this post is about the software i use for the domotic web server, there are many open source options for choose the software, for example freedomotic, PiDome, home assistant and many more. But i choosed openhab, why? why i did it? because it is developed in java and there is a large community supporting the project. In my case i have a lot of experience in java and it is more easy for me for collaborate with the project or change something that i want only for me.

Tuesday 9 June 2015

Introduction

Hi, my name is Gabriel and i am engineer with a lot of experience in java who loves domotic. I Want to turn my home into an automatic place, the target is to controll all with my cell phone or my computer, and i am close to make it.