Trying to decode my wireless temperature sensor data

498 views
Skip to first unread message

Keijo Kangas

unread,
Sep 10, 2016, 3:03:29 AM9/10/16
to rtl_433
I am trying to understand the binary data logic I have collected from "./rtl_433 -a" output to the text-file. I have added temperature values from wireless temperature receiver display to the text-file. I am trying to save temperature values to local sqlite database, but first I have to understand and convert binary data to decimal values using some kind of decoding script before saving current temperature values to sqlite database. I have noticed that last four binary bits may be random bits because they appear to be different even when the temperature values are same when reading values multiple times a day. I used command "./rtl_433 -a" to get binary values and saved them manually to this text-file.
Temperature_values.txt
rtl_433_output.png
8594_manual_306.pdf
IMG_20160910_095037.jpg
IMG_20160910_095136.jpg
IMG_20160910_095343.jpg

Keijo Kangas

unread,
Sep 12, 2016, 7:05:08 AM9/12/16
to rtl_433
First try:

{42} 18 43 fd 40 02 40 : 00011000 01000011 11111101 01000000 00000010 01    17,5C 63,5F


{42} 18 43 fd 40 02 40 : 00011000 010000 1111 1111 0101 000000 00000010 01    17,5C 63,5F

Binary:  0101   1111   1111   =   Decimal: 1535

Calculation: ( 1535 / 10 ) - 90 =  63,5

---------------------------------------------------------------------------------------------------------------------------------

Second try:

{42} 18 41 a5 40 05 c0 : 00011000 01000001 10100101 01000000 00000101 11    11,7C 53,0F

{42} 18 41 a5 40 05 c0 : 00011000 010000 0110 1001 0101 000000 00000101 11    11,7C 53,0F

Binary: 0101    1001    0110    =     Decimal: 1430


Calculation: ( 1430 / 10) - 90 = 53,0


---------------------------------------------------------------------------------------------------------------------------------

Third try:

{42} 18 41 f1 40 06 c0 : 00011000 01000001 11110001 01000000 00000110 11    14,4C 57,9F

{42} 18 41 f1 40 06 c0 : 00011000 010000 0111 1100 0101 000000 00000110 11    14,4C 57,9F

Binary:  0101   1100   0111      =     Decimal: 1479


Calculation: ( 1479 / 10 ) - 90 = 57,9


Next task is to create a script that converts binary values to decimal values and saves decimal values to local sqlite database.


Benjamin Larsson

unread,
Sep 12, 2016, 7:09:57 AM9/12/16
to rtl...@googlegroups.com
On 2016-09-12 13:05, Keijo Kangas wrote:
> First try:
>
> {42} 18 43 fd 40 02 40 : 00011000 01000011 11111101 01000000 00000010
> 01 17,5C 63,5F
>
>
> {42} 18 43 fd 40 02 40 : 00011000 010000 1111 1111 0101 000000 00000010
> 01 17,5C 63,5F
>
> Binary: 0101 1111 1111 = Decimal: 1535
>
> Calculation: ( 1535 / 10 ) - 90 = 63,5

Looks like you have it figured out. Can you follow the new device guide
and submit some signal samples ?

https://github.com/merbanan/rtl_433#supporting-additional-devices-and-test-data

MvH
Benjamin Larsson

Message has been deleted

Keijo Kangas

unread,
Sep 12, 2016, 12:58:54 PM9/12/16
to rtl_433
Added Axel test files and created a pull request: https://github.com/keonen/rtl_433_tests/tree/master/tests/axel


Keijo Kangas

unread,
Sep 12, 2016, 3:23:29 PM9/12/16
to rtl_433
Using script found from here https://github.com/merbanan/rtl_433/issues/24 I created a modified script and it seems to work:

#!/bin/bash

# bash script to decode 42 bit Axel 433 Mhz temperature sensor
# as captured by rtl_433 -a
#
# example:
# ./calculate_temp.sh "[12] {42} 18 41 a5 40 01 80 : 00011000 01000001 10100101 01000000 00000001 10"
# script has no real error checking and is not optimized
# (e.g. loops or better variable handling)
#
# 2016-09-12, keonen

# use command line argument as input
parameter=$1

# check length declaration (bits 7 and 8)
length=${parameter:6:2}
if [ $length != "42" ]
then
    echo "Length declaration not 42, exiting."
    exit 1
fi

# remove unused characters and spaces
nospace=$(echo $parameter | cut -d" " -f 10-15 | tr -d " ")

# get binary values from specific locations
bitsfrom22to25=${nospace:22:4}
bitsfrom18to21=${nospace:18:4}
bitsfrom14to17=${nospace:14:4}

# convert bin to dec
binaryvalue=$(echo $bitsfrom22to25$bitsfrom18to21$bitsfrom14to17)

decimalvalue=$(echo "ibase=2;obase=A;$binaryvalue" | bc)

fahrenheitvalue=$(echo "scale=1;$decimalvalue / 10 - 90" | bc -l)
echo "Fahrenheit = "$fahrenheitvalue

celsiusvalue=$(echo "scale=2;($fahrenheitvalue - 32 ) * 5 / 9" | bc -l)
echo "Celsius = "$celsiusvalue







Reply all
Reply to author
Forward
0 new messages