Wetterstationen.info Startseite - Impressum  

 
Komplette entschlüsselung für WS-2300?
Gehe zu Seite zurück  1, 2, 3, 4, 5, 6, 7, 8  weiter
Lavr

1




Anmeldung: 17.04.2003
Beiträge: 60
Wohnort: Glostrup, Denmark

Beitrag Verfasst am: 29.04.03 - 15:13    Titel: »Zitat  

Time for some wrap-up.

The WS2300 does not really have an API. All you can do is read memory cells as BYTES, write NIPPLES (4bit) and set/unset bits.
It is really very primitive.
So all you need is a good "map" of the needed memory areas and knowing the simple communication.

ALL commands (except the "resync" or "reset" command which is just 0x06) start by sending 4 address bytes.
The address is the physical address of a 4-bit nipple inside the station.
You send the most significant first and end with the least significant. Addresses are 4 bytes long. First address byte is either 0 or 1.

Address command bytes are coded like this.
Matematically it is address_command = 0x82 + hexdigit*4
Or seen more visually.
<pre>
1 0 0 0 0 0 1 0
+
0 0 A3 A2 A1 A0 0 0
=
1 0 A3 A2 A1 A0 1 0
</pre>
 
WS2300 returns 0S, 1S, 2S and 3S where S is a check digit calculated as (command-0x82)/4.
I.e. S is the hex digits of the address.

The last command bytes is as follows.

WHEN READING you ask for N bytes. Note that data is read a bytes - two nipples at a time. If you need 5 addresses you have to read 6 by asking for 3 bytes.
So the last command byte is the number of databytes requested.
It is coded as 0xC2 + N*4. Max value is 15.

Or visually
<pre>
1 1 0 0 0 0 1 0
+
0 0 N3 N2 N1 N0 0 0
=
1 1 N3 N2 N1 N0 1 0
</pre>
 
The station returns the acknowledge 3X where X is the number of data bytes to follow (excl checksum byte).
The station then sends all the requested databytes and ends with an extra checksum byte which is calculated as the sum of the N data bytes. Only the least significant 8 bits are used.

Writing nipples is similar.
Addressing is the same 4 address command. You then follow with 1 and up to 15 data command bytes.
They are coded as data_command= 0x42 + (data_nipple*4)
<pre>
0 1 0 0 0 0 1 0
+
0 0 D3 D2 D1 D0 0 0
=
0 1 D3 D2 D1 D0 1 0
</pre>
 
The station will acknowledge every written nipple write command by returning (0x10 + hexdigit).
After the last data byte is written you send can either send 06 init command (acknowledged by 0x02) or a new read/write address (0x82/0x83) which is then acknowledged by 0x00/0x01. It is probably a good idea to end the writing in some controlled way so that no more data is written to the station.

Setting/resetting bits.
Same method as for writing nipples except data command have the following format.
Command for setting a bit (numbered from 0 to 3) is 0x12+ (bit_no*4) and the acknowledge is 0x04+bit_no. Command for resetting a bit is 0x32+(bit_no*4) and the acknowledge is 0x0C+bit_no.
<pre>
SETTING
0 0 0 1 0 0 1 0
+
0 0 0 0 B1 B0 0 0
=
0 0 0 1 B1 B0 1 0

UNSETTING
0 0 1 1 0 0 1 0
+
0 0 0 0 B1 B0 0 0
=
0 0 1 1 B1 B0 1 0
</pre>
 
That was the basics. It has been posted before in this thread but I thought it would be nice to have it all at one place.
To get the history data you only need the read command.
First read 10 bytes (20 nipples) from address 06B2 and get current history settings.

HISTORY SETTINGS
06B2 History saving interval: Binary nipple 0 [minutes] Coded as minutes - 1.
06B3 History saving interval: Binary nipple 1 [minutes]
06B4 History saving interval: Binary nipple 2 [minutes]
06B5 Countdown to next saving: Binary nipple 0 [minutes] Minutes left - 1
06B6 Countdown to next saving: Binary nipple 1 [minutes]
06B7 Countdown to next saving: Binary nipple 2 [minutes]
06B8 Time last record, minutes BCD 1s
06B9 Time last record, minutes BCD 10s
06BA Time last record, hours BCD 1s
06BB Time last record, hours BCD 10s
06BC Date last record, BCD day 1s
06BD Date last record, BCD day 10s
06BE Date last record, BCD month 1s
06BF Date last record, BCD month 10s
06C0 Date last record, BCD year 1s
06C1 Date last record, BCD year 10s
06C2 Pointer to last written Record: Binary nipple 0 [Range 00-AE]
06C3 Pointer to last written Record: Binary nipple 1
06C4 Number of Records: Binary nipple 0 [Range 00-AF]
06C5 Number of Records: Binary nipple 1

The address area 06B4-06B2 is the interval. You can change this using the write command if you want. Remember -1.
The address area 06B7-06B5 is time till next data record. The station counts from the time set in 06B4-06B2.
When it reaches zero another minute passes and then the data is taken and the value put back to the start value.
This value can also be set by your program.

The 06C1-06B8 area is the time stamp of the last record.
Your software will need to use this and the interval to calculate how many data points you need to read to catch up with where you were last.

06C5-06C4 counts the number of valid data records. You can set this to zero when you start - you do not have to.
When it reaches AF is stays at this value indicating that the entire ring buffer is full.

The 06C3-06C2 is a pointer to the LAST WRITTEN data record. It can have values from 00 to AE. When it reaches AE it goes to 00.

Each record is 19 nipples. So you must read 10 bytes at a time and throw the last nipple away.
If you want to limit data transfer you can read 15 at a time and make the software smart. That is up to you.

The first record 0 is at address 0x06C6. Record 1 is 0x0C6 + 19= 06D9. Last record is record 0xAE.
So you calculate the last data record the formular is 0xC6C + N*19 where N is the pointer in address 06C3-06C2.
The rest is simple programming.

Note. If you set both pointer and number of records to zero, the next record become 1. The pointer points to the last record written. Not the next to be written.

A summary of the data records nipple 0 to 18. (It is easier to do address calculation when you start with 0 - it is not only because I am a nerd.

4,3,2,1,0: Indoor and outdoor temperature
Tindoor = (value % 1000)/10 - 30 [C]
Toutdoor = (value - (value % 1000))/10000 - 30 [C]
Where % is the modulus operator.

9,8,7,6,5: Air Pressure and Indoor Humidity.
Pressure= 1002.2 + (value % 10000)/10. If pressure is greater than or equal to 1502.2 then you subtract 1000.
Indoor humidity =(value-(value % 10000))/10000

11,10: Outdoor Humidity in plain human readable BCD

14,13,12: Rain. (RAINCOUNTn)
The value is binary and steps 0.518 mm/step.
The absolute value does not seem to be related to anything else than an internal "household" value inside the station.
Every period the current 12-bit rain count value is stored as history data.
You use it by keeping a reference total rain value RAINref, the corresponding reference count RAINCOUNTref.
RAINtotal = RAINref + (RAINCOUNTn - RAINCOUNTref)*0.518 [mm]

17-16-15: Windspeed = value in binary / 10 [m/s]

18: Wind direction = value * 22.5 degrees. North is 0 and degrees are clockwise on the circle.

Hope this long posting was useful.

Kenneth

<font size=-1>[Small correction made: Lavr am 2003-04-29 15:21 ]</font>


Zuletzt bearbeitet von Lavr am 12.03.04 - 04:49, insgesamt ein Mal bearbeitet
»Profil   »Private Nachricht   »E-Mail   »Website
Lavr

1




Anmeldung: 17.04.2003
Beiträge: 60
Wohnort: Glostrup, Denmark

Beitrag Verfasst am: 30.04.03 - 01:27    Titel: »Zitat  

Open2300 Linux program library and examples version 0.5 has been uploaded to my website.

Latest improvements.
Small improvements to existing programs open2300 and dump2300.
readwrite.c has been extended with a new read_safe function which
does the hard work of retrying while reading. It is also renamed to
rw2300.
Three new programs have been added which mainly shows the use of
the rw2300 library. They are however also quite useful when exploring
the station and its data.
dump2300 will write out all the data in a given area to the screen
and to a file.
bin2300 does the same as dump2300 but the fileformat is kind of
binary. Each 4-bit nipple in the station is written as one byte in
the file. If you use start address 0 the file can be viewed in a
binary file viewer and the addresses will match 1:1. Output to screen
is human readable.
history2300 read out a selected range of the history records as raw
data to both screen and file.
log2300 is the most useful new tool. It read all the current data
from the station and add the information to a log file in plain
ASCII and human readable format. The idea is that this file can
be used to pick up data from a perl CGI program or PHP page.

Added a memory map file with all the known data areas inside the
station. This is also useful for those that are working on Windows programs!!!

URL
http://www.lavrsen.dk/sources/

When I purchased my WS2300 a little more than two weeks ago I thought that there would be a simple and documented interface available for my Linux machine. I learned something different. The WS2300 does not have an API. It is simple collection of raw weather data directly out of its memory - encoded but not encrypted or in any way protected. So it took a little more than two days. It would however have taken two months if it was not for the wonderful jump start I got through this Forum. It is wonderful that we can help each other like this. And I have had good fun and learned some more C. And a small refreshment of my German
I also like to promote the open source idea and the fact that there is an alternative to Windows.
And this is also good for the manufacturer and retailers of the WS2300. Just compare with the Velleman K8000 PC interface which now has a large Linux community and standard Linux library. That did not hurt sale of the K8000. On the contrary.
Now that I have a good library and know all the things I need, I will now continue with next step which is to get the weather data on my homepage.

Kenneth
»Profil   »Private Nachricht   »E-Mail   »Website
DeSi





Anmeldung: 21.04.2003
Beiträge: 2

Beitrag Verfasst am: 30.04.03 - 19:57    Titel: »Zitat  

Hi Kenneth,


Zitat:

Lavr schrieb am 2003-04-29 15:13 :
Time for some wrap-up.


many thanks for all this information. I am very much impressed by the excellent work you have done exploring the interface of the WS-2300.


Zitat:

Hope this long posting was useful.

Kenneth

[ Diese Nachricht wurde geändert von: Lavr am 2003-04-29 15:21 ]


For sure it was helpful.

Thanks again,
Detlef.
»Profil   »Private Nachricht   »E-Mail   »Website
Brian Hamilton

2




Anmeldung: 19.12.2002
Beiträge: 134

Beitrag Verfasst am: 30.04.03 - 21:02    Titel: »Zitat  

Hi
Yes, I agree.
Kenneth, you are one very talented individual!.
Thanks very much
I am still struggling with what you have there for the data history (i,.e the commands I need to sent, i.e $82 .. .. .. ..
etc , but I will get there slowly..
any pointers anyone?
Thanks
Brian
»Profil   »Private Nachricht
mpu

2




Anmeldung: 14.01.2003
Beiträge: 107
Wohnort: Minden

Beitrag Verfasst am: 01.05.03 - 09:03    Titel: »Zitat  

hallo,
it was a great pleasure to follow this discussion.
I remember, it started with Centauri's discovery.
Earlier I loaded Claude's source code, but I'm not familiar with perl. Nevertheless it wasn't wasted time to study some French and the program structure.
Now I looked at your, Kenneth, C-code and all seems to be so clear and easy ...

thanks to all Bernd
»Profil   »Private Nachricht   »Website
anonymous





Anmeldung: 07.02.2003
Beiträge: 16

Beitrag Verfasst am: 03.05.03 - 17:05    Titel: »Zitat  

Hello all,
Hello Bernd

>>it was a great pleasure to follow this discussion.
>>I remember, it started with Centauri's discovery.
Yes me too I started with Centauri's discovery I think what he understood, was the most usefull thing of the protocol.
>>Earlier I loaded Claude's source code, but I'm not familiar with perl.
>>Nevertheless it wasn't wasted time to study some French and the program structure.
Thank's Bernd.
So since 22/03 you could have on your linux box addresses, ws-2300 values read, min max bit read set and reset, alarms read. I just added a few Perl lines to Centauri's discovery.
A word to Brian who shows me the high nibble for wind speed i missed.
Thanks to all,
Claude.
»Profil   »Private Nachricht   »E-Mail   »Website
Brian Hamilton

2




Anmeldung: 19.12.2002
Beiträge: 134

Beitrag Verfasst am: 04.05.03 - 10:11    Titel: »Zitat  

Hi

I have everything working now for the history except the baromete is a little jumpy!

and I am not sure about the wind direction...I have a raw number greater than 16....

maybe i need to divide it by 16...first

anyway, with the help of my brother, I am nearly finished ...

and thanks to the people who have helped me on this forum
Brian
»Profil   »Private Nachricht
anonymous





Anmeldung: 07.02.2003
Beiträge: 16

Beitrag Verfasst am: 04.05.03 - 10:15    Titel: »Zitat  

Hi, Kenneth
I read on your web site (nice site)
Zitat:

But it is as live as you can get it. The maximum wind is always showing 25 m/s. This is because the sensor that measures wind is not very well made by La Crosse.

I think it is not so bad!
I me too had have speed 98,1 km/h very often. They all disapear when i moved my wind sensor about 10 meters far away, strongly fixed it on a PVC mast, and strongly fixed cables.
It is kown as "interferences" with iron mast, so I use an iron mast + one meter PVC on top.
But i had to move the outdoor temp humidity sensor, and then get more spikes with temp humidity and pressure ! There are none using HF transmission so it shoud be wire interferences
Trying to solve that ..
Regards,
Claude,

_________________
Claude Ocquidant
»Profil   »Private Nachricht   »E-Mail   »Website
Brian Hamilton

2




Anmeldung: 19.12.2002
Beiträge: 134

Beitrag Verfasst am: 04.05.03 - 13:39    Titel: »Zitat  

yes!
I have the barometer working correct now
I was out by 1 in the my linining up of the nibbles

wind direction i think i have now too (i was looking too far along by 1 again in the data)

the next trick:
after getting 64 records, I come unstuck

claude, you have it on your web site protocol info something about having to send a $86 ??
Do i have to do that, then carry on?
thanks
Brian
»Profil   »Private Nachricht
Lavr

1




Anmeldung: 17.04.2003
Beiträge: 60
Wohnort: Glostrup, Denmark

Beitrag Verfasst am: 04.05.03 - 14:59    Titel: »Zitat  

I think what confuses many is that in the beginning we all through that the first command was ALWAYS 0x82 (or $82 in the Pascal world).
It is not. The first 4 commands sent are in fact the address.
Since the address area is from 0 to around a little less than 0x1400 and only history data is found above 0x1000 the first command is in practice always 0x82 for anything else than fetching history data.

The first command is the first address digit which can be either 0 or 1 and this gives first command being either 0x82 for 0 or 0x86 for 1.

So to wrap it up once again.
First four commands is the ADDRESS of the first nipple you want to read from or write to. An address like 031A is sent in the sequence 0, 3, 1 and last A.

The address is coded as 0x82 + 4 * address_digit.

Examples
Address 031A becomes 82 8E 86 AA
Address 0001 becomes 82 82 82 86
Address 1000 becomes 86 82 82 82
Address 12B9 becomes 86 8A AE A6

The best you can do is stop thinking about 'commands'. Think "From address 041B I want to fetch 7 nipples (3.5 bytes which means 4 bytes in practical)" and then code that into

82 92 86 AE D2

The D2 is the coding for "I want to read 4 bytes".

Kenneth
»Profil   »Private Nachricht   »E-Mail   »Website
Lavr

1




Anmeldung: 17.04.2003
Beiträge: 60
Wohnort: Glostrup, Denmark

Beitrag Verfasst am: 04.05.03 - 22:43    Titel: »Zitat  

I just tried to look inside the wind sensor to see if there was anything I could do to fix it.
It is a real problem doing anything.
It has two IC's unmarked and the kind that is bonded directly to the PCB and with black epoxy on top.
Very few components besides this.
The electrical interface is 4 wires. Ground, +3V, An Enable wire and a serial data wire. It seems the outdoor humidity/temperature sensor sends an enable signal and get a short serial message back later. The rest of the time there is 50 Hz mains noise on the data wire.

I was not able to do anything.

I put it up again using a wooden mast instead. It got much worse. I now get a 25.5 m/s reading every 2 minutes. There is only very little wind.

The wind sensor is GARBAGE. Useless piece of junk.
I am close to regretting spending so much time on something that I doubt will ever work properly.
The sensor is as far from my house or any noise source as I can get it. If it cannot be made to work where it is now it will never ever work.

The fact that I am not the only one with this problem tells me that this sensor has a major design problem and that it is a matter of luck whether it works or not.

The crazy thing is that when I have the sensor indoors close to all the noise sources you can think of like 30 cms from my computer monitor and close to computer, lamps it never shows 25.5. The minute I put it outside and let the a very mild wind spin it I get one 25.5 m/s reading after the other. And always with the direction NW.

It is a piece of garbage. I will NOT recommend the WS2300 to anyone!!

Kenneth
»Profil   »Private Nachricht   »E-Mail   »Website
Brian Hamilton

2




Anmeldung: 19.12.2002
Beiträge: 134

Beitrag Verfasst am: 05.05.03 - 00:19    Titel: »Zitat  

Hi Kenneth
Sounds like you are having a bad day.
We all have that!
I am doing it the way you suggested, i.e the first $82 is determined by
historycount2:=(historycount1 shr ;

data:=$82+((historycount2 shr 4)*$4);



But after 65 reads (i have put in a counter), i get the command not understood...
The wind sensor
Now that I am checking the value just prior to the windspeed, to check for bad readings, loss of signal, it does not seem to be a very good thing to do
I now have someone with that value set to 8 (decimal) but valid windspeeds, and becuase i started to check to make sure it was always a zero, it stoped his wind from updating
what are the possible values for this status flag?
Anyone?
Thanks
Brian
»Profil   »Private Nachricht
Lavr

1




Anmeldung: 17.04.2003
Beiträge: 60
Wohnort: Glostrup, Denmark

Beitrag Verfasst am: 05.05.03 - 01:04    Titel: »Zitat  

Bad day?
Yes and no. My wifes chocolate cake, nice sunny weather and a good bottle of wine made the overall impression of no too bad.

I always get very upset when a manufacturer knows about a problem, gives silly suggestions that often will not work, and keep on shipping the garbage to customers. This station has been on the market for something like 6 months as far as I can see. They should have fixed that problem.

What really makes me wonder is why is it always 25.5. It is value FF as hex. That must be a connection. Is it a software bug? After I put it on a wooden mast it is also 2 m higher and spins more but is more stable in direction. At the moment the direction is between east and south with windspeed round 0-2 m/s. And then suddenly I get a NW and windspeed 25.5. It makes no sense. My feeling is that it is a communication problem and that the sensor sends garbage back which happens to be interpreted as 25.5. But why does it only happen outside? Why only when it is not on my test bench? Why not when I place it close to noise sources?
Can it be RF interference? I use wire interface. Not the wireless the feature. But radio signals can be caught my the wires. I know that weel being a radio amateur also (and a professionel radio engineer). Can it be some radio transmitter that does it?

I may try to decouple the hall element with a small capacitor. I am also thinking about replacing the cable by a shielded cable. Or put ferrite clamps on the cable at both the sensor and the temperature sensor that works as a hub for the two others. I have to be carefull at the wind sensor end with ferrites though as they may disturb the magnetic field from the rotating propeller.

About your reading history data.
65 reads??? Hex or decimal.
You should not reach the address range starting with 1 until record number 7D / 7E hex or 124/125 decimal.

The addresses for the records in this area are:

7A - 0FD4
7B - 0FE7
7C - 0FFA
7D - 100D
7E - 1020
7F - 1033
80 - 1046

Maybe you still have a calculation bug somewhere in your code?
It is hard to get right because the addresses are nipples and you read bytes. I had a couple of iterations before I got it right

About the wind data bytes.
Centauri wrote a posting on April 15th and I made some additional observations here. But since the whole wind thing is a piece of garbage from LaCrosse we may see different value. It can also be connected to whether you display m/s or something else. It is too late for me to experiment with that now. Warm bed is waiting and AAARGH it is Monday.

Kenneth
»Profil   »Private Nachricht   »E-Mail   »Website
Brian Hamilton

2




Anmeldung: 19.12.2002
Beiträge: 134

Beitrag Verfasst am: 05.05.03 - 06:21    Titel: »Zitat  

All your ideas on fixing the wind are good.
I knew of a station that got false rain only when connected to the PC
All these sorts or problems are shared by some other weather stations too.

Yeah, I will put into a list the address command I am sending to see where it goes belly up...

(I would like to finish this project, so I can spend more time on finishing other projects!)
Brian
»Profil   »Private Nachricht
anonymous





Anmeldung: 07.02.2003
Beiträge: 16

Beitrag Verfasst am: 05.05.03 - 23:39    Titel: about wind "interferences" and a not so bad statio »Zitat  

Hello,
I finally think that what has been called "interferences" was for me rather wires vibrations with wind, specially near connexions , wind sensor bad alignment with N/S and horizontal, and also bad stability for the station itself.
It has been said that station with a version number > V11 has less trouble. I cant confirm that.
The protocol seems very hard and "primitiv" but it is also full open if undocumented .It may be could allow fonctionnality rarelly found on other station like having a date for each rain click if we could know a lot more
on memory areas for sensors and dates.

Not documented and may be not working how to get a Min wind speed > 0 ?
Not much wind here so i don't know if min for wind works after 1 min 1 hour or a thousand years of blowing ? It could be usefull to make stats
Has somebody any observations about that ?

Has somebody tried to read very high memory (ROM). If it is flash Rom and why not, we may dream, that could be flashed with RS232, may be the customers could help with updating and solving all that. I can't say if release V12 is just different by its ROM ? Who knows ?
I found in low addresses (<0x19) with set unset bit we could get a new item in the set menu , item called DST for daylight saving time which can be set on or off increasing Time by 1 Hour for summer time. Is it a garbage of US release EPROM or has it a function for people without DCF ?
Time to bed for me,
So I think ws-2300 is cheap and very open, That remembers me the times of the 1st IBM PC but in this times it came with a lot of doc !!!!
I think all the guys working on this forum, if customers would give some information, could make the ws2300 re-elected !!!

_________________
Claude Ocquidant
»Profil   »Private Nachricht   »E-Mail   »Website
Gehe zu Seite zurück  1, 2, 3, 4, 5, 6, 7, 8  weiter



Impressum / Datenschutz | Disclaimer / Haftungsausschluss | powered by phpBB, © 2001, 2002 phpBB Group
© 1999-2010 Tobias Gerstmaier. Alle Rechte vorbehalten. Alle Angaben ohne Gewähr.