trouble in reading out oregon uv138 sensor *SOLVED
Moderator: b_weijenberg
trouble in reading out oregon uv138 sensor *SOLVED
hi,
i do have problems in getting the checksum right with the sensor data on my uv138 sensor.
the incoming data is:
0. 78 (record length in bits = 15 bytes)
1. ea (sensor id, high byte)
2. 7c (sensor id, low byte)
3. 10
4. 80
5. 30
6. 40
7. fe (high nibble is checksumw2 = f)
8. 43 (low nibble is checksumw1 = 3)
9. fd
10. ff
11. af
12. ce
13. 07
14. 01
15. 08
according to the documentation the checksum should be 3f.
but when i sum up the bytes 1-6 i get 3b - 0a = 31. hmmm, where is my mistake?
i do have problems in getting the checksum right with the sensor data on my uv138 sensor.
the incoming data is:
0. 78 (record length in bits = 15 bytes)
1. ea (sensor id, high byte)
2. 7c (sensor id, low byte)
3. 10
4. 80
5. 30
6. 40
7. fe (high nibble is checksumw2 = f)
8. 43 (low nibble is checksumw1 = 3)
9. fd
10. ff
11. af
12. ce
13. 07
14. 01
15. 08
according to the documentation the checksum should be 3f.
but when i sum up the bytes 1-6 i get 3b - 0a = 31. hmmm, where is my mistake?
trouble in reading out oregon uv138 sensor *SOLVED
Hi
Did you check the source code (vb.net)
this is the checksum check for the UV sensor
Hope this helps a bit!
Sub checksum7()
Dim cs As Byte
cs = (recbuf(0) >> 4 And &HF) + (recbuf(0) And &HF)
cs += (recbuf(1) >> 4 And &HF) + (recbuf(1) And &HF)
cs += (recbuf(2) >> 4 And &HF) + (recbuf(2) And &HF)
cs += (recbuf(3) >> 4 And &HF) + (recbuf(3) And &HF)
cs += (recbuf(4) >> 4 And &HF) + (recbuf(4) And &HF)
cs += (recbuf(5) >> 4 And &HF) + (recbuf(5) And &HF)
cs += (recbuf(6) >> 4 And &HF) + (recbuf(6) And &HF)
cs -= recbuf(7)
cs -= &HA
If cs <> 0 Then
WriteMessage(" Checksum Error", False)
End If
End Sub
Did you check the source code (vb.net)
this is the checksum check for the UV sensor
Hope this helps a bit!
Sub checksum7()
Dim cs As Byte
cs = (recbuf(0) >> 4 And &HF) + (recbuf(0) And &HF)
cs += (recbuf(1) >> 4 And &HF) + (recbuf(1) And &HF)
cs += (recbuf(2) >> 4 And &HF) + (recbuf(2) And &HF)
cs += (recbuf(3) >> 4 And &HF) + (recbuf(3) And &HF)
cs += (recbuf(4) >> 4 And &HF) + (recbuf(4) And &HF)
cs += (recbuf(5) >> 4 And &HF) + (recbuf(5) And &HF)
cs += (recbuf(6) >> 4 And &HF) + (recbuf(6) And &HF)
cs -= recbuf(7)
cs -= &HA
If cs <> 0 Then
WriteMessage(" Checksum Error", False)
End If
End Sub
- b_weijenberg
- Forum Moderator
- Posts: 1744
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
trouble in reading out oregon uv138 sensor *SOLVED
You have to add half bytes as in the function checksum7, subtract byte 7 and subtract 0x0A.
I have checked your in the RFreceiver with simulate and the data has a correct checksum:
Simulate: 78ea7c10803040fe43fdffafce070108
UV138 UV sensor CH 1 addr:80 UV factor:3 Level: medium bits=120
bert
I have checked your in the RFreceiver with simulate and the data has a correct checksum:
Simulate: 78ea7c10803040fe43fdffafce070108
UV138 UV sensor CH 1 addr:80 UV factor:3 Level: medium bits=120
bert
trouble in reading out oregon uv138 sensor *SOLVED
inpecting the rfreceiver source code did help. uv138 is checksummed by the following code:
unfortunately this does not match the pdf documentation. they forgot to put in the lower nibble of byte 6. Here is the text from the documentation:
Thanks for getting this one solved!
Code: Select all
Function checksumw() As Byte
Dim cs As Byte
cs = (recbuf(0) >> 4 And &HF) + (recbuf(0) And &HF)
cs += (recbuf(1) >> 4 And &HF) + (recbuf(1) And &HF)
cs += (recbuf(2) >> 4 And &HF) + (recbuf(2) And &HF)
cs += (recbuf(3) >> 4 And &HF) + (recbuf(3) And &HF)
cs += (recbuf(4) >> 4 And &HF) + (recbuf(4) And &HF)
cs += (recbuf(5) >> 4 And &HF) + (recbuf(5) And &HF)
cs += (recbuf(6) And &HF)
cs -= (recbuf(6) >> 4 And &HF) + (recbuf(7) << 4 And &HF0)
cs -= &HA
If cs <> 0 Then
WriteMessage(" Checksum Error", False)
End If
Return cs
End Function
Code: Select all
checksumw1, checksumw2
This is an 8 bits checksum and is calculated by adding all the nibbles of the bytes 0 to 5 minus (checksumw1 * hex 10 + checksumw2) minus hex A.
trouble in reading out oregon uv138 sensor *SOLVED
OK that's great, The documentation will be corrected thats for sure!
- b_weijenberg
- Forum Moderator
- Posts: 1744
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
trouble in reading out oregon uv138 sensor *SOLVED
You are right, the doc has been changed to:
This is an 8 bits checksum and is calculated by adding all the nibbles of the bytes 0 to 5, plus the lower nibble of byte 6, minus (checksumw1 * hex 10 + checksumw2) minus hex A.
This is an 8 bits checksum and is calculated by adding all the nibbles of the bytes 0 to 5, plus the lower nibble of byte 6, minus (checksumw1 * hex 10 + checksumw2) minus hex A.
trouble in reading out oregon uv138 sensor *SOLVED
HI,
i just had a look at the error log of my sw. beside other things i get information about records that cannot be decoded so far. there i found the following entries:
looks like data from the uv138 sensor, but the record length (44) doesn't match to the specified 40/78 record lengths in the documentation. however, i will give decoding these signals a try. stay tuned
what makes me wonder is that the uv138 seems to send out data in two different formats. may be they do that in order to be compatible to older weather stations? just guessing...
i just had a look at the error log of my sw. beside other things i get information about records that cannot be decoded so far. there i found the following entries:
Code: Select all
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 40 90 4d 14 14
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 90 d0 aa 94 12
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 50 40 0d 84 12
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 30 50 0e 44 1a
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 20 80 2e d4 1c
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 40 b0 6d 14 1a
wmr928d: unidentified byte sequence: 44 ea 7c 10 80 20 a0 4e d4 12
what makes me wonder is that the uv138 seems to send out data in two different formats. may be they do that in order to be compatible to older weather stations? just guessing...
trouble in reading out oregon uv138 sensor *SOLVED
Hi Docbee,
Let us know what you find out. Don't be surprised that you receive sensors from people in the neighborhood. b_weijenberg (Bert) told his neighbor that is was time to replace the battery of his Oregon Temperature sensor [:D]
I'm receiving also all the Visonic sensors in the neighborhood.
Question: Where did you place the UV sensor, I think it needs to be outside, but the UV138 does not look that weatherproof to me.
Regards Pieter
Let us know what you find out. Don't be surprised that you receive sensors from people in the neighborhood. b_weijenberg (Bert) told his neighbor that is was time to replace the battery of his Oregon Temperature sensor [:D]
I'm receiving also all the Visonic sensors in the neighborhood.
Question: Where did you place the UV sensor, I think it needs to be outside, but the UV138 does not look that weatherproof to me.
Regards Pieter
- b_weijenberg
- Forum Moderator
- Posts: 1744
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
trouble in reading out oregon uv138 sensor *SOLVED
You can ignore the bytes above 64.
The 1st 64 bits contain a valid UV138 packet.
Simulate: 40ea7c108020a04ed4
UV138 UV sensor CH 1 addr:80 UV factor:2 Level: low bits=64
I don't know why but sometimes the sensors transmit additional random data. Don't check the packet length. I think you can check the first 2 bytes (sensor ID) and if the checksum is OK process the packet.
Bert
<font size="1">(I found an error in the RFreceiver program, packets with a length not on an 8 bits boundary are not accepted as valid. I will correct this soon.)</font id="size1">
The 1st 64 bits contain a valid UV138 packet.
Simulate: 40ea7c108020a04ed4
UV138 UV sensor CH 1 addr:80 UV factor:2 Level: low bits=64
I don't know why but sometimes the sensors transmit additional random data. Don't check the packet length. I think you can check the first 2 bytes (sensor ID) and if the checksum is OK process the packet.
Bert
<font size="1">(I found an error in the RFreceiver program, packets with a length not on an 8 bits boundary are not accepted as valid. I will correct this soon.)</font id="size1">
trouble in reading out oregon uv138 sensor *SOLVED
@bwired: the uv138 got some serious rain during the last two days. it is still working... we 'll see
when doing my first tests with the rfreceiver i got a temperature signal that looks like from outside (based on the value) but was not part of my wmr928 rig. looking around the house i found a sensor from an old weather station (bought 2 years ago from aldi or so) still hanging in my car port. looks like beeing an oregon clone although it has been labled as "lifetec". however, i now use this sensor to monitor my wine cooling of course, it sends a lowbat in the meantime
when doing my first tests with the rfreceiver i got a temperature signal that looks like from outside (based on the value) but was not part of my wmr928 rig. looking around the house i found a sensor from an old weather station (bought 2 years ago from aldi or so) still hanging in my car port. looks like beeing an oregon clone although it has been labled as "lifetec". however, i now use this sensor to monitor my wine cooling of course, it sends a lowbat in the meantime
- b_weijenberg
- Forum Moderator
- Posts: 1744
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
trouble in reading out oregon uv138 sensor *SOLVED
I think I have to check your wine to see if the sensor did his job OK!
trouble in reading out oregon uv138 sensor *SOLVED
Yes Bert, your story that I told above is again reality [8D]