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:
- The EeePC and the Prolific PL-2303 (likely a clone) USB dongle did not get on with each other. Frequently when reading data from the weather station, XP would abort to a blue screen with the message IRQL NOT LESS OR EQUAL.
- The P4 box had a real serial port, but it chewed through about 200W (at 220V) while it was running.
- The Pi was the answer to everything, it consumed a miserly 7W (at 220V) and has a friendly OS with plenty of hack potential, only there was no way to talk to any sort of USB serial device that wasn't based upon an FTDI chip.
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.
Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.
|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...
Japanese Red Cross
Earthquake relief donations have closed.
Read about the JRC
Make a general donation
List all b.log entries
Return to the site index
PS: Don't try to be clever.
It's a simple substring match.
Last read at 18:58 on 2018/10/16.
© 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.