Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

WeatherStation Anemometer,WindVane PiZeroW Pi4 HELP

1167 Views - Created 21/02/2021


Posted by: Avatar


Here we go, I am not a brilliant coder, nor an electronics expert and I take a long time to absorb new stuff (I'm 65).

I am an enthusiastic Radio Amateur. G6SGA

I am trying to do the following -- WeatherStation: I have an Anemometer and a windVane both RS485.

Idea is to connect as follows Vane/Anemometer >> RPi RS485hat/to RPizeroW -- supported via a Solar Panel>BuckConverters and a 12VLiOn battery --


Jeffergarden Signal Output Polycarbonate Wind Speed Sensor Anemometer Wind Direction Table Wind Speed
Hongzer Wind Anemometer, Pulse Signal Output Aluminium Alloyed Wind Speed Sensor Anemometer
PiHat --

Current issue: iPi3 -- talking to the RPi rs485 .... I need python code that will do this. and this is my problem - I have had these devices for over 12 months and I just can't seem to get anything to work. -- I am missing something fundamental. (Brain).

RPizeroW - seems to be setup pretty well and I can make any changes and have backups of the SDCard.

I can connect to PiZeroW via SSH or VNC and my python IDE is on a Win10-PC with a shred drive set up between PC<>NAS<>RPi Synology NAS box. .... in fact I can connect to the RPiZeroW from anywhere on my home network including an iMAC & a MacBook.

I have written (copied somebodies idea) py code that flashes an LED. Hello world with LED.

The comms for both the Wind direction sensor and the Anemometer are the same

Baud, 9600, 8,N,1 with CRC

Modbus RTU

Registers: Anemometer :

0016H [40017](plc) read-only - Wind Speed 0.1m/s

0100H [40101] R/W device address (0-252)

0101H [40102] R/W Baud(2400/4800/9600)

Inquiry Frame:

Address [0x01] --- Function [0x03] --- Start address [0x00 0x16] --- Data Length [0x00 0x01] --- CRC_L [0x65] --- CRC_H [0xCE]

Answer Frames (for example; reading a wind speed of 2.3m/s)

Address [0x01] --- Function [0x03] --- Number of valid bytes [0x02] --- Wind Speed value [0x00 0x17] --- CRC_L [0xF8] --- CRC_H [0x4A]

Calculated output speed: 0017H (hexadecimal) = 23 => Wind Speed = 2.3ms

# ==============================================

Registers: Wind Direction :

0000H [40001](plc) R only - direction 1deg

0100H [40101] R/W device address (0-252)

0101H [40102] R/W Baud(2400/4800/9600)

# ==============================================

Request Frame

Address(1 byte) --- Function(1 byte) --- Register Origin(2 bytes) --- Length(2 bytes) --- Check Code_L (1 byte) --- Check Code_H(1 byte)

0x02 --- 0x03 --- 0x00,0x00 --- 0x00,0x01 --- 0xFD --- 0x39

Response Frame

Address(1 byte) --- Function(1 byte) --- Effective byte(1 byte) --- Date1 1(2 bytes) --- Date (2 bytes) --- Date N(2 bytes)

--- Wind Direction --- Check Code_L (1 byte) --- Check Code_H(1 byte)

0x02 --- 0x03 --- 0x02 --- 0x00,0x8A --- 0xFD --- 0xA0

e.g. Wind Direction 008AH(Hex) = 138=>Wind Direction = South-southeast

So anybody tell me what python libraries to use, and even give me example code that will request data and output the responses. Just something more ideas.

If anybody wishes to talk direct to help with this please email stephen.g6sgs+abel [at]

Thanks so very much


Posted by:

andrew Avatar

United Kingdom

andrew Twitter  andrew Website  


The first thing I would suggest is you check that the UART port on your Raspberry Pi is working correctly. We have a tutorial Serial Port setup in Raspberry Pi OS which goes through the steps needed to enable the UART serial port on a Pi Zero W.

After going through the tutorial you can check if the UART serial port is working correctly using the minicom terminal program.

Install minicom using the command:

sudo apt-get install minicom

Once installed, remove the RS485 Pi from your Raspberry Pi and connect the UART TXD (pin 8) and RXD (pin 10) pins together on the Raspberry Pi GPIO header so anything transmitted on the TXD pin is echoed back to the RXD pin.

Start minicom with the following command:

minicom -b 115200 -o -D /dev/ttyAMA0

If the UART port is working anything you type into the minicom terminal should appear on the screen. If nothing appears when you type there is a problem with the UART port and you may need to go through the steps in the setup tutorial again.

Once you know that the UART port is working you can install your RS485 Pi and connect it to your weather station.

There is a python library called minimalmodbus which may help you with communicating with your weather station.

You can find it at

The website contains some sample code that may be useful to get you started. You will need to set the serial device to point at /dev/ttyAMA0 to work on the Raspberry Pi.

Hopefully, this should help get you going with your project.


Posted by: Avatar

Appreciated, and I'll let you know. :)


Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.