Wednesday, March 13, 2013

Wireless humidity & temp. sensor

Some times there is a need to measure temperature and humidity in a place where you can't put wires. The best way to resolve this problem is to put a wireless sensor. You can make one by yourself, but it will require a lot of work: making the pcb, find a good isolated enclosure(in case it rains). Ok, maybe one device will not be so complicated to make, but if you need few of them it can take a lot of time. So i decided to take a commercial one and to hack it. Of course there are some base station for that remote sensors, but they don't do smart think and you can't connect them to the internet :).

There are a lot of companies that produce wireless humidity and temperature sensors. This is my choice :



And back side:



Here you can see the pcb:



And one more picture:


This sensor sends humidity and temperature over 433Mhz radio frequency every minute. Also it has a lcd to display the data.  The precision of temperature is 0.1 degree, pretty good. The device can be forced to send data by pressing the TX button on the back. On the back there is a switch to select Celsius or Fahrenheit to be displayed.

In order to decode the signal we need a 433Mhz radio receiver. I plugged the receiver to mic input on a sound card(unfortunately i don't have a digital oscilloscope). And to register the signal i used sound forge.

It looks like the sensor sends the same frame 32 times. Every frame lasts for around 52 ms and the pause between frames is around 8ms. So, all 32 frames are sent in 1920ms(it's a big window). Here is how looks one frame:



As you can see there are only two patterns. In both of them the timing when the signal is high is the same. That means, that only variation in the timing, when signal is low, says when we have logical "1" or logical "0". So i made the following assumption:

                 
                


I made a table that shows the received code and the actual temperature(displayed on lcd):

Received code Temperature (°C) Humidity (%) Battery status
0100_1011_0001_0000_0011_0100_0000_1100_0000 19,2 52 -
1100_1010_1001_0000_0010_0110_0000_1111_0010 24,2 38 low
0110_0110_1001_0000_0010_1000_0001_0000_0000 25,6 40 low
1001_1100_0001_0000_0010_1000_0001_0000_0010 25,8 40 -
1010_1000_0001_0000_0010_0000_0001_0001_0001 27,3 32 -


After some thinking a have got this( for 24,2°C, 38% ):


So the sensor sends 36 bits, that means:
  • address  -  first 8 bits are changed on every power up of the sensor. 
  • battery  -  when the battery is low,  this bit is set to '1'.In this case a battery is displayed on the LCD screen.
  • unknown data  -  this 8 bits remains always the same, so i couldn't track them.
  • humidity  -  is the binary representation of the humidity. So dec(38) = bin(0100110).
  • temperature  -  is the binary representation of the temperature multiplied by 10(or just remove comma from the temperature). That means: dec(242) = bin(000011110010).
The only problem with this sensor is that the address is changed on every power up. That means, that i have to reassign the sensor in my system every time i change the batteries, which happens every 10 months.

No comments:

Post a Comment

Write your comments here...