Go Down

Topic: Wireless temperatur sensor that is compatible with Tellstick Duo (Lib. included) (Read 23533 times) previous topic - next topic



This is a mini project I made last weekend.
I have a Tellstick duo http://www.telldus.se/products/tellstick_duo

The Tellstick duo can wirelessly (433Mhz) control a lot of different brands of remote sockets.  It can also receive temperatur and humidity from a variety of sensors.

I found a excellent article how to hack a "WH2 Wireless Weather Station Outdoor Sensor" at this site http://lucsmall.com/2012/04/27/weather-station-hacking-part-1/.

So I made a wireless temperatur sensor that is compatible with my Tellstick Duo (and WH2 Weather Station).
The protocol is called "fine offset".

The sensor use the following parts:
Cheap 433Mhz transmitter
LM35 temperatur sensor.

The Attiny sleeps for 30minute (wakes up every 8 seconds and checks if 30 minutes has passed) and then makes the readings.
Sends the result to my Tellstick and then sleeps again for 30 minute.

In sleep mode it only consumes 59uA (according to my multimeter).

My next sensor will use a DHT22 humidity/temperatur sensor.
I attach 3 pictures.

Sensor1.jpg      Shows my simple "board" with Attiny85, LM35 and radio transmitter.

Sensor2.jpg      Enclosure with my "board" and two AA batteries inside.

Sensor3.jpg      Output from Tellstick Duo command line utility.


I made a simple library if someone want to make a sensor.

I also attach a example sketch (with sleep code).
The "readTemperature" function is "borrowed" from this site: https://code.google.com/p/uberfridge/source/browse/trunk/arduino/fermentationMonitor/readSensors.pde?r=15

Library usage:

//"Creates" sensor1 with transmitter connected to PB0-5 (only PortB is supported in version 0.1)
TellstickSensor Sensor1(0);

//Transmitts sensor data

//Set temperature
//225 = 22,5C

//Set humidity

//Number of times the sensor data should be transmitted (default 3)

//Delay in ms between transmitted data (default 10)

//Device id for sensor 1-255

Attached zip file is updated with CRC fix and example.


Great project. Thanks for sharing!

Have you verified your CRC8-results? If I recall correctly the Tellstick doesnt verify CRC for fineoffset?

This project; https://github.com/lucsmall/BetterWH2 claims  data sent from your Transmit-code has bad CRC.
The data arrives fine, but the CRC is bad/incorrect.
(Running your code on Attiny85, and BetterWH2-reciever on UNO)

Edit, src: telldus does not verify CRC. https://github.com/telldus/telldus/blob/master/telldus-core/service/ProtocolFineoffset.cpp#L20


Hi, thanks for your feedback!

The code from your link use the same CRC8 function (modified function from the  OneWire library) as I do.

I recorded the traffic with my occiloscope and the CRC bits  looked ok what I could see (compared my output with the picture from http://lucsmall.com/images/20130507-08-worksheet.png when I used the same temperature/humidity).
You are right that the Tellstick Duo don't care about the CRC bits but I send them anyway if you want to recive the data to a weather station.

By the way I have updated the library, fixed some major bugs (now handle negative temperature correct and changed some datatypes).
Also uploaded a new shetch that use a DHT22 sensor.
The row with the "OSCCAL " need to be removed or changed (use tinytuner to get the correct value if you use the internal oscillator).

My sensors (three) has worked flawlessly since I made them :)


I have tried your code but unfortunately without any success. I have verified that my TX circuit is working by using a simple transmit library (just to switch devices on/off).

To troubleshoot this does anyone have an example of a valid fine offset package from a sensor? I do not have a scope but I have a tellstick net which does not see what I send when trying to simulate a sensor.


Hi Solem!

Sorry to hear that the sensor do not work.
Did you check out the site I linked to? http://lucsmall.com/2012/04/27/weather-station-hacking-part-1/
At the bottom you see a hand drawn picture with valid data.



Yes I noticed this site, however I am not exactly sure how to pass a datastring directly into the library. I guess I somehow have to fill _cdata[0]-[3] with the bits?


Maybe you could modify the code so it prints out 1/0 in the serial monitor.
Then you can set the temperature and humidity to the same as in the picture and compare the output.

Another error source could be the fuses of your MCU (if you use a Attiny or other non standard setup)?
Double check that the delay functions are working correct  (the library uses the delayMicroseconds function).



Yes, I can try the serialmon.

I am not using the Attiny but Arduino pro mini, with atmega 328. Might be this is causing the trouble.


I was struggling to get this lib running and i found out that earlier FW versions of the Tellstick DUO didnĀ“t care about the CRC and then it worked. However i wanted it to work with latest FW (currently Ver 12.0) so for this needed to fix the CRC.
I am not a programmer at profession so my solution is most lightly not up to programming standards but it solves the problem with the CRC and now it works fine with all the latest SW & FW.
Running on Arduino Uno Rev3 with Ebay 433Mhz cheap TX



Thanks Ranemyr!

I noticed the same think when I upgraded my firmware. I tried to find the error in the CRC code but could not find it.
Ended with me downgrading the firmware.

So it is great that you fixed it.



Nice work, i managed to get it to work on a MEGA2560 right away with one sensor.
I would like to attach up six sensors.
Have you tried this with several sensors?

When add more sensors it only sends the last one, any ideas??




I have not tried to create several sensor objects.
But you could use one sensor object and change the deviceID.






Thanks for your contribution!

However - I can't get it to work properly. I've used Ranemyrs zip on my Arduino Uno.

To test I use:

  Sensor1.SetTemperature(999);    //Set temperature
  Sensor1.SetHumidity(77);        //Set humidity
  Sensor1.SetSendCount(3);        //Number of times the sensor data should be transmitted (default 3)
  Sensor1.SetSendCountDelay(10);  //Delay in ms between transmitted data (default 10)
  Sensor1.SetDeviceID(225);       //Device id for sensor 1-255

I see that my Tellstick recives this data. However - it also seems to receive/register lots of fault sensors.

Example directly after startup:

tdtool --list-sensors gives:
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=225   temperature=99.9   humidity=77   time=2015-08-11 00:49:56   age=1
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=112   temperature=-48.7   humidity=77   time=2015-08-11 00:49:56   age=1

As you see, ther first is correct (id=225, temperature 99,9 and so on...). But the second row is errouneous (id=112).

Anyone else having the same problem? I've tried a couple of different values but I clearly see that a lot of bogus-sensors get's listed.

I have two real sensors (protocol=mandolyn) up and running. But the only "sensor" with protocol=fineoffset is my Arduino.

If I have my Arduino up and running for some time (10-20 minutes) I get a long list of erroneous registrations. Here's a part of the list I end up with:

type=sensor   protocol=fineoffset   model=temperaturehumidity   id=97   temperature=99.9   humidity=77   time=2015-08-11 01:04:11   age=171
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=113   temperature=99.9   humidity=77   time=2015-08-11 01:06:53   age=9
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=135   temperature=15.9   humidity=58   time=2015-08-11 00:56:04   age=658
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=233   temperature=99.9   humidity=77   time=2015-08-11 01:05:32   age=90
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=95   temperature=-114.9   humidity=77   time=2015-08-11 00:56:47   age=615
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=241   temperature=99.9   humidity=77   time=2015-08-11 01:01:34   age=328
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=229   temperature=99.9   humidity=77   time=2015-08-11 01:00:56   age=366
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=49   temperature=99.9   humidity=77   time=2015-08-11 00:59:35   age=447
type=sensor   protocol=fineoffset   model=temperaturehumidity   id=227   temperature=99.9   humidity=77   time=2015-08-11 01:04:54   age=128

As you understand - I need to correct this to be able to have a useful system.

Grateful for all help I can get on this! Can't find any other option to send data to my Tellstick from an Arduino...



How often do you send data from your sensor?
It seems that you got a lot of errors in only 10-20 minutes.

The old Tellstick firmware do not care about CRC. If you upgrade to the latest firmware I think the faulty values will disappear.


Go Up