mailto: blog -at- heyrick -dot- eu

Navi: Previous entry Display calendar Next entry
Switch to desktop version

FYI! Last read at 18:29 on 2024/05/04.

Weather station online!

It is all very well having a smart weather station, such as the one I picked up in a vide grenier two weeks ago; but... you know... if it has sockets and you have plugs and connectivity, it's only a matter of time before you really want to join the two together.

The main impediment to this was three-fold:

Enter Colin Granville to the rescue. Within a week a serial driver was born, and two weeks later there was one capable of running at the serial speed that I wanted (2400 baud) and setting the control lines that I needed (DTR low, RTS high).

After testing that Colin's module did allow basic send-reply communications with the weather station, I decided that I was going to watch a DVD or two and not bother writing any code. I mean, come on, it's Easter. I should be able to pig out on chocolate and watch bad horror flicks and anything at all that has Zooey Deschanel in it...

So this was the result of not coding anything:

 

In use, the WS-2300 runs at 2400 baud. It has no serial data generation capabilities, so you will need to set DTR low and RTS high. The device will switch between these logic levels in order to fake a serial signal. Clever huh? Unfortunately the microcontroller inside the weather station is not very powerful and pretty much everything else has priority. So serial communications code must be written on the expectation that it will fail. My code is rudimentary and will just keep on retrying until it works.

The protocol is based upon nibbles. So you send an &06 byte to reset the command sequence, and you expect to see &02 back. Then you send the address with each nibble as an individual word, encoded. For each byte, the station will reply with a check byte. Finally you send the number of bytes you want to read. The station will reply with &3x where 'x' is the number of bytes that will be send. These bytes are then sent all at once. Actually, the bytes are nibbles. It's a bit confusing. I looked at a lot of hex to see what was being asked for and what was being given...
Full details are at Open2300. The page itself documents the protocol used, but you'll need to download the source code archive in order to see the memory locations file.
My implementation was written using the protocol document and the memory locations document. I didn't look at the source code. I probably should have, it might have made it a lot simpler, but I wanted to keep a separation between whatever I came up with and Open2300, due to the GPLness of Open2300.

Here's the weather station mounted on my wall. It is in an "odd" position in order that it can read from the wireless transmitter the other side of the driveway.

And here's the PL-2303 with the Pi:

 

The software, at the moment, is pretty horrible. I was playing around with different things to get stuff working. It really needs a rewrite. This will come, in time. Along with proper logging (it currently logs every 30 minutes but never reads back that data) so it can also generate "trend" graphics for temperature and atmospheric pressure.

Still, it isn't bad for something knocked up on a whim over the holiday. And it is 100% RISC OS!

 

If you want to take a look - point your browsers at http://heyrick.ddns.net/. Don't be surprised if it is a little slow. It is being served by WebJames from the Pi itself and it's a weak WiFi signal.

 

 

Your comments:

Rick, 29th March 2016, 23:15
The memory map is also listed here: http://www.lavrsen.dk/foswiki/bin/view/Open2300/OpenWSMemoryMap
Rick, 29th March 2016, 23:38
Don't panic if you see the wind is blowing at ~183.6km/h. Things like that happen when the signal from the sensor was not received correctly. The station can inform me of this situation, but I don't check it yet...

Add a comment (v0.11) [help?]
Your name:

 
Your email (optional):

 
Validation:
Please type 31294 backwards.

 
Your comment:

 

Navi: Previous entry Display calendar Next entry
Switch to desktop version

Search:

See the rest of HeyRick :-)