Wireless temperatur sensor that is compatible with Tellstick Duo (Lib. included)


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.

TellstickSensor.zip (6.18 KB)

Hey 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


TellstickSensor.zip (2.99 KB)

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.

Sensor.SetDeviceID(101); Sensor.SetTemperature(temp1); Sensor.Transmitt();

Sensor.SetDeviceID(102); Sensor.SetTemperature(temp2); Sensor.Transmitt();

Sensor.SetDeviceID(103); Sensor.SetTemperature(temp3); Sensor.Transmitt();


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.


Hi and thanks for the reply!

I belive I use the latest firmware (2.1.2)!? I don't see any newer? http://download.telldus.com/TellStick/Software/telldus-core/

Here is the typical code I've used for my tests (only changed other settings):

void loop() {
  delay(5000-blinkdelay);         //Set a delay between packages (blinkdelay = 500)
  Sensor2.Transmitt();            //Transmitts sensor data

Perhaps it's because I've tried so many times to upload and restart my sensor/Arduino? You also see a clear pattern: - At least two faults hits are registred!? - It seems to be common that data-values get "halfed" for each erroneous hit. Correct id=44 -> becomes id=22, and after that id=11... The same for the other data values. But some data also get corrupt in other ways - see the bottom table.

Right now, at about 21:48 I tried to run again. When I uploaded the code to my Arduino I get the following:

  1. I directly run 'tdtool --list' and get this (I left out hits from yesterday hits here):
fineoffset             temperaturehumidity     44     44.4°  44%   2015-08-11 21:48:28
fineoffset             temperaturehumidity     22     22.2°  22%   2015-08-11 21:48:28
fineoffset             temperaturehumidity     11     11.1°  11%   2015-08-11 21:48:29
  1. Running 'tdtool --list' again (after a couple of seconds) gets the "same" data but other timestamps (I left out hits from yesterday hits here):
fineoffset             temperaturehumidity     44     44.4°  44%   2015-08-11 21:49:06
fineoffset             temperaturehumidity     22     22.2°  20%   2015-08-11 21:49:07
fineoffset             temperaturehumidity     11     11.1°  11%   2015-08-11 21:48:55
  1. Again, after another few seconds (I left out hits from yesterday hits here):
fineoffset             temperaturehumidity     44     44.4°  44%   2015-08-11 21:49:28
fineoffset             temperaturehumidity     22     22.2°  20%   2015-08-11 21:49:28
fineoffset             temperaturehumidity     11     11.1°  14%   2015-08-11 21:49:12

BR / Calle

In my last post i left out some data. Here is the full list of today (bottom three hits are from tonight):

Here is my current "list" - where you still can see several hits from yesterday/last night. As I wrote - the number of hits might be related to how many times I've tried to get it to work. Nevertheless - erroneous hits always get registred...

pi@raspberrypi ~ $ tdtool --list
Number of devices: 1
2   LuxorSwitch2    OFF


PROTOCOL              MODEL                ID     TEMP    HUMIDITY    RAIN                    WIND                    LAST UPDATED
mandolyn              temperaturehumidity     11     15.3°  93%          2015-08-11 21:42:05
mandolyn              temperaturehumidity     31     15.9°  80%          2015-08-11 21:49:08
mandolyn              temperaturehumidity     32     -17.1° 36%          2015-08-08 19:37:08
fineoffset             temperaturehumidity     200    66.7°  55%          2015-08-11 00:38:16
fineoffset             temperaturehumidity     100    33.3°  23%          2015-08-11 00:38:16
fineoffset             temperaturehumidity     50     16.6°  23%          2015-08-10 22:19:55
fineoffset             temperaturehumidity     204    66.7°  23%          2015-08-10 22:07:37
fineoffset             temperaturehumidity     216    66.7°  23%          2015-08-10 22:07:58
fineoffset             temperaturehumidity     174    115.1° 12%          2015-08-09 22:45:20
fineoffset             temperaturehumidity     104    66.7°  23%          2015-08-10 22:12:30
fineoffset             temperaturehumidity     72     66.7°  23%          2015-08-10 22:21:22
fineoffset             temperaturehumidity     144    133.4° 47%          2015-08-10 21:44:05
fineoffset             temperaturehumidity     36     -34.7° 23%          2015-08-10 21:44:16
fineoffset             temperaturehumidity     96     66.7°  23%          2015-08-10 22:20:49
fineoffset             temperaturehumidity     124    -25.5° 12%          2015-08-10 21:53:35
fineoffset             temperaturehumidity     201    66.7°  23%          2015-08-10 22:16:02
fineoffset             temperaturehumidity     202    66.7°  23%          2015-08-10 22:20:49
fineoffset             temperaturehumidity     25     8.3°   98%          2015-08-10 22:01:27
fineoffset             temperaturehumidity     126    -191.5°    23%          2015-08-10 21:50:52
fineoffset             temperature             225    -26.1°             2015-08-10 21:52:24
fineoffset             temperaturehumidity     248    66.7°  23%          2015-08-10 22:22:05
fineoffset             temperaturehumidity     232    66.7°  23%          2015-08-10 22:21:16
fineoffset             temperaturehumidity     40     66.7°  23%          2015-08-10 22:03:32
fineoffset             temperaturehumidity     108    152.2° 63%          2015-08-10 21:59:17
fineoffset             temperaturehumidity     255    22.5°  63%          2015-08-11 00:50:28
fineoffset             temperaturehumidity     242    102.0° 50%          2015-08-10 22:00:06
fineoffset             temperaturehumidity     71     -192.6°    65%          2015-08-10 22:01:54
fineoffset             temperaturehumidity     8     66.7°  23%          2015-08-10 22:03:48
fineoffset             temperaturehumidity     249    51.0°  25%          2015-08-10 22:05:32
fineoffset             temperaturehumidity     63     -107.5°    31%          2015-08-10 22:05:32
fineoffset             temperature             177    199.2°             2015-08-10 22:07:42
fineoffset             temperaturehumidity     222    66.7°  23%          2015-08-11 00:40:04
fineoffset             temperaturehumidity     110    66.7°  23%          2015-08-11 00:38:32
fineoffset             temperaturehumidity     111    33.1°  23%          2015-08-11 00:39:59
fineoffset             temperaturehumidity     55     -16.7° 23%          2015-08-11 00:39:21
fineoffset             temperaturehumidity     94     66.7°  23%          2015-08-11 00:39:48
fineoffset             temperaturehumidity     225    99.9°  77%          2015-08-11 07:56:27
fineoffset             temperaturehumidity     112    -50.3° 77%          2015-08-11 01:06:21
fineoffset             temperaturehumidity     56     125.5° 77%          2015-08-11 01:03:01
fineoffset             temperaturehumidity     97     99.9°  77%          2015-08-11 01:04:11
fineoffset             temperaturehumidity     113    99.9°  77%          2015-08-11 01:06:53
fineoffset             temperaturehumidity     135    15.9°  58%          2015-08-11 00:56:04
fineoffset             temperaturehumidity     233    99.9°  77%          2015-08-11 01:05:32
fineoffset             temperaturehumidity     95     -114.9°    77%          2015-08-11 00:56:47
fineoffset             temperaturehumidity     241    99.9°  77%          2015-08-11 01:01:34
fineoffset             temperaturehumidity     229    99.9°  77%          2015-08-11 01:00:56
fineoffset             temperaturehumidity     49     99.9°  77%          2015-08-11 00:59:35
fineoffset             temperaturehumidity     227    99.9°  77%          2015-08-11 01:04:54
fineoffset             temperaturehumidity     44     44.4°  44%          2015-08-11 21:49:28
fineoffset             temperaturehumidity     22     22.2°  20%          2015-08-11 21:49:28
fineoffset             temperaturehumidity     11     11.1°  14%          2015-08-11 21:49:12


I checked with tdtool and I am getting 1-2 faulty readings each day. My sensor sends every 30 minute.

48*3 (sendcount) = 144 sendings. 2 / 144 = 1,3% faults.

EDIT: missed that you got so many errors.

Are you using a Attiny85? Is it possible that the fuses are wrong? If so, try to blink a led every second and see if the time between blinks is right,


Ok, I will try lower my interval :-)

It seems like I need to add some software logic to filter out the faulty ones.

Do you have multiple sensors? How do you seperate possible id-collisions? (One obvious way is to filter out "fineoffset" hits with id's that does not match my hardcoded id's).

Again - thanks!

I'm a newbie when it comes to this micro-controller world...

I've started to test using a Arduino Uno Rev 3 (=> ATmega328).

Perhaps I should make a better antenna on my RF-transmitter. Now, I use a ordinary wire... (have not checked the length of it). I might also try to move/isolate my Telldus (now I squeezed it into a cabinette which also contains my router, raspberry, NAS).