tiistai 6. huhtikuuta 2021

433 MHz receiver : other temperature sensor

Continuing directly from last part here.

Later addition: you can find sources here.

So last time I got one temperature sensor working, but later noted that other sensor - one I have at home that is used for outside temperature - didn't work.

Previously I had opened transmitter unit and used modulation input data to easily see what sensor is sending, but this specific sensor was closed so tightly that I could not get inside it without very likely destroying its IP rating in the process - something I didn't want to do.

After brief thinking moment I wrote simple piece of code that measures the "low" pulse durations of receiver data, puts those in a short, 12-sample FIFO and whenever new low pulse is received, it's compared against previous FIFO data; if multiple similar length samples are found in FIFO, it is very likely that I'm seeing actual received data rather than random noise. After slight fine tuning of parameters (minimum pulse length threshold, and number of similar samples that needs to be received) I managed to catch data from this sensor to scope screen.

This specific sensor also uses PPM (pulse position modulation), but unlike previous one this uses sequences half as long; 950us for 'zero' bit (other has 1800us), and 1900us for 'one' (other 3600). Also, it seemed that this transmitter uses 36 bits per word, whereas other used 32 bits per word.

Disclaimer here: This is my interpretation of modulation and data I am receiving, it might be horribly wrong too in details. It does produce data I can use, so I'm happy anyway.

I considered it unlikely that I could write sufficiently flexible receiver that it could decode both of these signals reliably at same time, so I decided to instead refactor code so that I could parametrize receiver to handle slightly different signalling.

So now I have three different state machines running in interrupt handler: One for PWM modulated 24-bit remote signal; one for first 1800/3600us 32-bit PPM; and one for 950/1900us 36-bit PPM. Latter two use same receiver code, but use different parameter block for data parsing.

Now, the actual data decode. This sensor didn't have handy display to show data it's sending, so I ended up just heating sensor (by putting it on top of scope exhaust vent), copying received data to libreoffice calc worksheet and trying to figure out what is changing between samples.

After some experimentation I determined that this one seems to have temperature data on bits 12..23. Again, negative values are twos complement so easy to decode (test method: I put it in freezer for a while). Lowest 12 bits in this case, though, appear to be relatively static - value hovering around 1800..2000 regardless of temperature (over -10 C .. +30 C range). No idea on that. 

So, one more step closer to remote cottage temperature monitoring and control system.


Ei kommentteja:

Lähetä kommentti