Monday, 16 January 2017

Automated capture of radio communications

PART 2
(see also earlier blog post about this)

Aim: to log lake temperature

Method: similar to before, but with new device.

Device:
 * "SODIAL(R) New Wireless Digital Floating Swimming Pool Thermometer Bath Spa Temperature" bought from Amazon
 * Example result for 13.0degC was 01011000 01111010 00010010 10011111 10101111 00110011 1

Other notes on message:
 - there's a 'calibration' set of 8 before the main message
 - Then a long time at "1"
 - Then a long time at zero
 - Then main message
 - The start of each bit jumps from 0 to 1
 - After each bit there is a jump from 1 to 0
 - The 0 "on" is longer than the 1 "on"
 - The bits seem to be of different widths for "1" and "0"


Decoding:
  * Calibrated from 4 temperatures between 3 and 31degC. A linear relationship found between temperature and bits 15-24 (T = mx + c, where T is temperature (degC), m=0.1, c=-40, and x is the message in bits 15-24).

In Linux or Windows (or even Raspberry Pi):
    rtl_sdr -s 1e6 -n 3.2e7 -f 433.85e6 -g 40 output.dat
This should create a 32-second data sample at 433.85 MHz with a gain of 40dB and save the file to "output.dat".


In Octave:
  fid = fopen('output.dat','rb'); 
  y = fread(fid,'uint8=>double'); 
  y = y-127.5; 
  y = y(1:2:end) + i*y(2:2:end); 
  plot(abs(y));

Then many lines of Octave code to interpret and clean signal,
and then writes result to data log file with each row as follows: Year,Month,Day,Hour,Minute,Temperature(degC)



Helpful websites included:
  • http://electronics.stackexchange.com/questions/145714/what-encoding-is-used-in-this-signal
  • http://sdr.osmocom.org/trac/wiki/rtl-sdr
  • http://aaronscher.com/wireless_com_SDR/RTL_SDR_AM_spectrum_demod.html