Friday 4 October 2013

Concatenate a String with a Float

I came up with a very simple and difficult problem with my little Arduino, I couldn't concat a string and a float number, after a few hours on Google I found out the solution:



Helpful link: http://arduino.cc/forum/index.php?topic=103935.0

Lightwave RF Arduino


Intro:
I had some spare time ( and money ) and I decided to make my little flat a beginning of automate house.
I did some research how to control my lights from an Arduino, even knowing that I could replace the normal switch with a relay. This wasnt enough because I wanted to keep the manual system and to be controlled from an Arduino, so after few hours I came up with LightWaveRF system that has been "hacked" and it is possible to be controlled from an Arduino.


LightWaveRF
Their products are working with a simple RF protocol at 434 mhz, and they give you the possibility to control it from your smartphone, remote controller and a webpage.
Some people understood how the protocol works and they just write a simple library to interact with Arduino.
There are various adapter: Light switch, Power socket, Light, Sensor PIR, etc.. and if you get a remote controller and a RF receiver, you can reproduce the same signal from your code.

Sniffing:
I was using this library to find out what ID and what kind of signals the remote controller was sending to the light switch. After a few minutes on the result and few website, I understood how to reproduce the same behaviour with a single click.
I suggest to use the Decode example to get your ID and to understand what kind of signal your are sending. If you have a multi channels remote, you have to be careful on which command and which channel.

Here an example to turn on my light:

Here a little description what message it sends:



Send:
When you got the ID, Channel and which command to send, you re ready to send your first message to your device.
Use the SEND example as based and create your custom message, replace it on the turnOn function and then compile. When the terminal is ready, you should be able to send "1" and whatever you decided to do, it will do it.
Be careful! If something is not working, just try with simple command like ON and OFF, after that move on dimming and mood ones.