Rick's b.log - 2016/03/29 |
|
It is the 23rd of November 2024 You are 18.118.144.199, pleased to meet you! |
|
mailto:
blog -at- heyrick -dot- eu
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...
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.
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.
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.
Rick, 29th March 2016, 23:15 The memory map is also listed here: http://www.lavrsen.dk/foswiki/bin/view/Open2300/OpenWSMemoryMapRick, 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...
© 2016 Rick Murray |
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted. RIPA notice: No consent is given for interception of page transmission. |