Go Down

Topic: Please help me decode 433Mhz temperature sensor HYUNDAI WSC 1925 (Read 7435 times) previous topic - next topic

radiusxe

Hi,
I try to write all data in columns, but the numbers live with their own life :)

Just one correction:


                           AAAAAAAAAA    BBCC    CCCC  CCCC  DD   EF
-0,1 - reset 2    010010000110   1111       1111      1111      10     10

                           AAAAAAAAAA   BBCC   CCCC  CCCC  DD   EF
0,2 - reset 2     100110000110  0000  0000  0010    10    10



A 12bits - ???? (CRC? ID?, both? or? trending?); when I send temp to station from arduino, we will have to clearly known, what is it, if is there CRC, the station will do nothing; if is there only random number or random station ID or both, the inner station will display received temp
Edit: - right, last transmit doesn't have 4 last bits and A section is same... can't be CRC!

B 2 bits - (11) freezing (00) positive temp; maybe just one bit is needed and then one of them will be with the first block

C 10bits - temp; freezing - two complement; (max +70dec = 1010111100b; min -50dec = [11]1000001100b)
http://www.exploringbinary.com/twos-complement-converter/

D 2bits - channel (1 = 01b; 2 = 10b; 3 = 11b)

E 1bit - low bat; 0b = low; 1b = OK

F 1bit - 0b = normal state; 1b = power reset (switching batteries; first measuring) OR transmit on demand (on the back is button) [1b has two functions]; probably is on first 12b trending (very easy implementation, just temp is stable, raise or fall) and this bit destroys trending and thus inner station needs this information (just theory)

Timings:
I'm going thru this step by step:
https://rayshobby.net/interface-with-remote-power-sockets-final-version/

and my timing is:
0 = 0,001859410430839   18,594 micro seconds (short signal, 82 points / 44100)
1 = 0,0044671201814059   44,671 micro seconds (long signal, 197 points / 44100)
delimiter =                            4,308 micro seconds (19 points / 44100)
first leading = delimiter + 2x long signal
n... leading = 2x long signal
ending = 2x long signal (warning, last transmit doesn't have last 4bits)

On all points I don't count first and last point on edges, maybe the true number is about +2 points higher. And our measuring is not same, who has right.


Riva:
Yes, your sketch (on the first listed thread) is on my sign and when will be more time (hope weekend), I will look on him closer.

Thanks Radius

robwlakes

Here is something to try RadiusXe,

I hope it helps you in some way, it is quite different from the one offered by Riva, just for comparison rather than as something in any way superior (not trying to start a WS flame wars  :smiley-sweat: haha).

I obviously don't have one of these Hyundai machines so I have done all this just see what happens.
I found your calculations for the timing of the waveform not the same as mine so I have used mine in the program.  However you should be able to change the delay limits (13,30,50,100) if you want to.

If you can understand my logic then , maybe this will be a way into it for you.

Cheers, Rob
Learning Flute and C++, heading for a meltdown.

radiusxe

Hi Rob,
untouched ino doesn't work.

Pin 2 attached to 433MHz Rx. Here we go.
S
S
S
S
S
S
S
S
S

Lets look where's problem...

Radius

Edit:
something have...

I change //int half_blip=350; //us
to
int half_blip=215; //us
my delim is 430,84 us

and your right
1859,41 us = 0
4467,12 us = 1

and then I get with little debuging:

< 30
Serial.println('0');

< 50
Serial.println('1');

S
1
0
0
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
S

= 28! That's ours lenght of binary string. This is 3,5 bytes.

I must print the "value" (Serial.print(value);), I can't get data from data_bytes. Seems that nosBits has only value "1".


Uf... but I see the light on the dark tunnel.

Radius

robwlakes

Hi Radius,

I have added a bit more and tried to incorporate your debugging changes as well.  Fine tuning the delays is very good as it helps also to compensate for the overheads of the CPU time used up in between the defined delays, the smaller timings like the half-blip will be the greatest effected, so well done on that one :)

I have also noticed that you are getting 8 packets in a row.  I have added a storage for the 8 packets, so they are stored in sequence in memory as they come in.  I think you will find the protocol does not bother with a checksum as it will simply rely on getting identical packets a number of times over to validate the reading and eliminate errors.  You could set the bar very high, but getting about 4 in row that were the same would be ok for me.  I have added a checking routine as well for your consideration, but it is not linked into the rest of the code.  It is near the end of the code so have a look for it as well.  It does nothing at the moment.

I am both very relieved and surprised that I supplied you a 'nearly working' program that is giving you results you can begin to work with.  Very satisfying for me to write something with no access to the hardware, yay!!

If you could attach your code next time, so I can see what you have done, and you could maybe suggest further developments, that would be very handy for me.  Anyway give my code below a try and see what it does, alter it again if need be and then maybe work out how you would like to develop your code, add them in if you can, or just suggest them, and then send me the current code your are working with at the moment.  If you don't want to do this publicly then send me a personal message with it in.  That will be OK with me.

Cheers, Rob

PS Eventually you will need to remove the '0' and '1' being printed for debug as their printing to screen times are also added into the timing loop and eventually need not be there.  Hence I prefer to get the whole packet printed at the end of the packet, though eventually you will not need any debugging at all :)
Learning Flute and C++, heading for a meltdown.

radiusxe

Hi Rob,
I leave the code open for everyone.

The code still doesn't work. I found problem, that the code resets probably too early 2 variables (nosBits;nosBytes):

packet=false; //assume packet is not ready
//nosBits=0;
//nosBytes=0;
synch=0;

//begin main packet capture loop
//Serial.println(); //start a new line for any data
while (! packet){

This ensures, that it counts in this sub "void packBit(byte value)" (not sure, that it counts good), but seems that arduino resets (see screenshot).

Unluckily, I doesn't know, how to help. I'm on my limits with C programming. If your stuck too, please probably add some debug information (that will helps you) and I will send them (result) back to you.

How to decode array and transfer to temperature is for me sci-fi on C.
On VB I will store all 8 packets to one dimensional array (0-7 positions); then compare ?randomly? 2 or 3 packets. Match... Then cut temp, channel, battery bit and on demand bit. VB has very good command "mid" - all datas have static positions :) (make it then very easy). Then convert binary temp to decimal (for now doesn't known how... google will probably say). That's all :).

How to make transmitter I doesn't know, but probably with sending 1 and 0 with sleeping? Here I will see, that the first bits are random or have another function (CRC), when the inner station will display or not the temp.


I have added some comments to the code.

Radius

robwlakes

Hi Radius,

I have attempted a major overhaul.  I know what you are saying about your VB background as I have had similar experience, but also began way back with hand assembly in the early days (1975!!), BBC Basic, Microsoft basic, Java, JavaScript, and now Python and C++ (though my style is mainly just C).  however you can play with this stuff and not lose a finger or an eye, so have a go, I will try to help. :) I put in lots of comments to help you (I hope!!)

I have tried to improve the processing by first looking for a valid 'blip' and then seeing if a valid 'Synch' pulse follows it, if that occurs then look for 28 valid bit signals (0 or 1) after that.  Should any disruption occur then it exits and begins looking all over again.  If it finds an error free packet then it should print out the last packet in hexadecimal and binary, and once again begin looking for another valid packet.

So it tries to process the whole packet logically rather than just show the packet parts as they appear. once we can get multiple packets reliably we will look at processing the data to human readable form :)

Try it an let me know how you go, send me any output you might get (fingers crossed).

Rob
Learning Flute and C++, heading for a meltdown.

Riva

 :smiley-red:  I sent the wrong version of the decoding sketch as it's designed for >32 bits.
I have attached the correct one though it looks like your doing fine without it. Hopefully I have got the correct timings already programmed for you.
Don't PM me for help as I will ignore it.

radiusxe

Hi guys,
very thanks. Free time will I have probably today and maybe on sunday.

Later, maybe next year, I wish to get something more sophisticated :), something like this:

https://www.google.cz/search?q=ws1080&safe=off&source=lnms&sa=X&ved=0CAYQ_AUoAGoVChMIyv_C4MGNyQIVwpdyCh1m2QBD&biw=1280&bih=641&dpr=1

I have looked on your Oregon station Rob, can you write exact model?

Offtopic:
Someone can drive car before he can walk and someone can't learn C programing (and bash and PHP). But still trying. I wish to can program in C, C#, python, javascript (+node.js) and PHP. But I'll be lucky for C (arduino) and python (linux, Pi). Gambas looks great, it's like Basic (but it's not Basic) and IDE looks very well. My migration to linux has green (windows 10 is on blacklist).

For me is new in C 'byte' as data type of variable. On my book 'begin C proraming' it's not this type of variable (maybe hidden later). Probably arduino specific or old book :).

Thanks for this good reference:
https://www.arduino.cc/en/Reference/Byte

Radius

Riva

Unless you need a mobile radio solution then consider something like this as when it used with SDR software is very good and very cheap.
Don't PM me for help as I will ignore it.

robwlakes

WMR-86 WS

is my weather station.  I think with hindsight I would have preferred a system that was an all in one unit and with a solar power charger as well.  However the Oregon stuff is well made ie semi-serious quality and accuracy, and given that I run my on-line weather station LTB Weather and it is in the public eye 24/7, reliability is a big factor. A bit more expensive though....

Riva's sketch looks good too, I will study it myself to see what I can learn from that approach.

I use 'byte' fairly often as I know the range of the data is very low with most weather station pre-processing, and integers and floating points really only required when converting to human readable format.  It is just an 8bit number as opposed an int which is 32bit number made up of 4 (8bit) bytes.  When I hand assembled many many years ago they were all just bytes, no easy arithmetic back then unless we programmed it ourselves.  So I am accustomed to working at that scale.  However it is probably avoided early on in 'C' programming as while it is very flexible in how it can be used, explaining that flexibility could be very confusing.  eg 'byte arrays' can/are used with 'string' functions etc etc

Taking on the weather station at this level gives you a very good goal to aim at and will help your studies no end.

Cheers, Rob
Learning Flute and C++, heading for a meltdown.

radiusxe

Hi guys,

Riva,
Have tried your sketch and doesn't work. I have edited timings, but still nothing :(. Maybe is problem, that logic 1 is long low signal and logic 0 is short low signal.
And I have Winfast DTV 1800H, probably will work.
http://www.leadtek.com/eng/product/6/315/intro.aspx#pitem=specification

and Evolve Venus
http://www.evolveo.eu/en/venus
Will not work. Only DVB-T.

Rob,
uf, still nothing. Will inspect today what's happens.For now, is there same problem, that nosBits is only 0 and 1, not counts UP (to max 8?). It is still early resetting to zero.


Radius

Riva

I think for SDR you need a DVB-T with a suitable chipset. In the case of the one I linked to the RTL2832U+R820T combination is what I was looking for.

The sketch does work for the sensor it was wrote to decode but it's probably not got the right timings for your device. I will try and get time to investigate but offer no promises.
Don't PM me for help as I will ignore it.

radiusxe

Hi guys,
have news.

1) I have made fake transmitter and works :) (sent 28,9 C)
2) while writing that transmitter, I have double checked, what is sending and it's little harder, than I wrote before... last transmit is variable, sometimes 24bit, sometimes 28bit... sometimes 15bit (variable length)... I haven't find some rule, but... with my fake transmitter I have checked, that last transmit is not needed for successful transmit to inner station = 7 transmits * 28bits is alright
3) sometimes is after last transmit "sync" and some bit(s)... I see one to twelve... probably variable lenght too; again not needed
4) CRC is presented, I have changed low bat bit to zero (low bat active) and nothing happens :(; to inspect what is changing I need automatization... by hand is a hard work

Edit:
added R2 of fake transmitter; rename glitch to blip

Radius

Riva

The sketch does work for the sensor it was wrote to decode but it's probably not got the right timings for your device. I will try and get time to investigate but offer no promises.
A bit later than hoped (I tried to give myself food poisoning) but the attached sketch is tested and working with the Audacity samples you linked in your first post.
By way of example here is the output for the 21.7 - reset 1 ch1 project.
Code: [Select]
ISR Pin 2 Configured For Input.
Pin 2 ISR Function Attached.
00001001000011100000110110010110
00001001000011100000110110010110
00001001000011100000110110010110
00001001000011100000110110010110
00001001000011100000110110010110
00001001000011100000110110010110
Don't PM me for help as I will ignore it.

radiusxe

Hi guys,

have news one more time.

First, very thanks Riva, works like a charm without touch.

Second, I have spent one day, to try to get Robs ino working, but without luck. Seems that r2 works better.

Third, I have spent 2 days of hacking the whole string of bits and hope I got It.
first four bits from left is CRC (sum of all nibbles -1); next eight bits is randomly generated sensor ID (when power is lost and renewed), next 4 bits indicates of freezing 1111 (15 Dec) or warm 0000 (0 Dec), next bits have been inspected before.

Fifth, on one server about linux was published on monday how to hack water pool sensor. And probably uses same protocol (don't have time to inspect it more deeper; but probably only timings is wrong). I have inspect, how to make CRC. I have use arrays (and many more magic...) and it was horrible (but works) :). Code on this server looks much easier and clever.

When will be time, I will inspect all of the codes. Yours Riva, Robs and the newly... when have somebody some suggestions (upgrades/patches) to codes, please share it.

http://www.root.cz/clanky/arduino-meri-bezdratove-teplotu-v-bazenu/

http://dephiox.blogspot.cz/2012/12/i-recently-stumbeled-over-433-mhz.html


Code
https://github.com/joysfera/arduino-remote-water-thermometer
https://github.com/joysfera/arduino-water-temp-receiver
https://github.com/joysfera/arduino-water-temp-transmitter

PS:
what IDE are you using guys? Arduino IDE seems to be not so good, notepad++ works better (have suggestions; function list; multiwindows etc).

Very thanks.
With best regards Radius

Go Up