Weather Station Build

This is a series of notes for a weather station project idea.

Outline – Why build a weather station ?

Because the available units are either far too expensive or low cost, limited and unreliable.  I have run a series of Fine Offset weather stations for years.  The early units were pretty good but the more recent ones have had USB lockup issues which makes them pretty much useless for data collection, although OK if you just want a desktop LCD panel.

The lower cost units are limited in that they have fewer sensors and are less well suited to data collection.  The ones that connect to PC for data collection run proprietary Windows only software which combined does not produce a stand-alone, long-term reliable system.

I am not interested in anything that connects to an on-line “service” or data storage.

So, What’s The Plan

At this stage, I’m just tossing about ideas.  There are a few basic requirements:

  • standalone sensor unit, not relying on a PC or single-board-computer to operate
  • self contained data collection and storage
  • defineatly no remote services or off-site cloud storage required
  • full set of sensors with sensor upgrade options
  • long term battery backup with solar power
  • no console – web based interface only
  • wired ethernet – for MQTT
  • possibly a wireless data link –  alternative to ethernet
  • a full set of sensors and some extras

At this stage to build only a sensor unit that collects data, storing it internally, but with a ethernet interface and the option to upload via MQTT to a broker and database.

Data Presenation

This is not important at the moment – a future project.  Once the data has been collected and stored doing something with it can happen later.


The sensor controller can be Arduino compatible on a custom pcb.  A ethernet port connects back to wherever the data goes.  The sensor controller has several functions:

  • to monitor all of the sensors in real time
  • to format a data message containing all of the sensor data
  • to store the data messages – SD card
  • to forward the data messages as required – via MQTT
  • to operate stand-alone long-term – battery backup with solar panel
  • Arduino compatible for open source


  1. GPS receiver for station location, altitude and time keeping – UART
  2. input for wind speed – pulse input
  3. input for wind direction – analog input
  4. rain gauge – pulse input
  5. humidity-temperature sensor – AM2320 – I2C
  6. pressure-temperature – BMP280 – I2C
  7. UV – GUVA-S12SD – analog
  8. solar radiation – solar cell – analog
  9. ambient light – BH1750 – I2C
  10. lightning detector – AS3935 – SPI
  11. air quality – several sensors – I2C and analog – to be determined
  12. battery voltage – analog

The wind and rain sensors can use the Fine Offset type of individual units for wind direction, wind speed and rainfall.  These are cheap and quite reliable.  Being individual units allows for easy replacement or upgrade.  Other sensors are mostly just small pcb mount units.  Solar and UV sensors must face the sky, others can be enclosed with airflow.

The sensor controller consists of a main pcb and two separate sensor pcbs – one for the outward facing sensors and one for the enclosed sensors.  This allows the core of the controller to be well protected without sealing in the sensors – and easy replacement of the sensors if damaged (water etc.).

By defining a full set of sensors and data message record initially, it doesn’t have to change as sensors are added –  additional data just becomes available.


The only fast time critical data gathering is reading the wind speed and direction sensors.  Splitting the electronics into two CPUs should simplify the software development and testing – the Sensor Processor (SP) and the Main Processor (MP).

This leaves the main Arduino (main processor) to concentrate on managing the SD card and ethernet without loosing pulses or requiring very time critical processing.  It also splits the IO so that one Arduino doesn’t fall short or need to be upgraded to a Mega.

Main Board

This is a relatively simple motherboard supporting the two processors and ethernet module and SD card.  It provides I/O connections, filtering and protection on external connections and power supplies.

SP to MP link

The SP (slave) links by SPI to the MP (master).  To keep the MP in sync with the SP and avoid having the MP waste time polling, the SP controls a manual indication, a sort of interrupt to let the MP know a new data is available.  The MP initiates the transfer as soon as it is free.  The SP must respond to the master (SS) and keep the SPDR loaded with the next byte.  This is time critical when sending data to the main processor and keeps the SP busy during the transfer.

Data transferred – regular data message

  • time-date – 00:00,00-00-0000,
  • wind speed – 000,
  • wind gust – 000,
  • wind direction – 000,
  • rain – 00.00,
  • humidity – 00,
  • pressure – 0000,
  • UV – 00,
  • solar radiation – 0000,
  • ambient light – 0000,
  • air-qual-d – 00,
  • air-qual-d – 0000,
  • air-qual-d – 0000,
  • battery voltage – 00.00,

Data transferred – special data message

  • lat –
  • lon –
  • alt –

Sensor Processor – SP

Basically an Arduino Nano on the main board, to take sensor data, pulses and analog inputs then pass what is most of the final data record to the MP.

The wind speed sensor can pulse very rapidly and is time critical.  Using the T1 pulse capture counter (PD5) will reduce software overhead – a periodic read of the count to calculate wind speed – maybe every 1-second to catch gusts, longer and it will naturally average gusts into the wind speed.  The rain input can be an interrupt on change – one count = 0.3mm (fine-offset).

Several sensors are I2C connected but are not time critical.  Several sensors are analog requiring ADC use but are not time critical.

The GPS receiver is attached to the SP as it generates and time stamps the initial data message.  The SP can power-down the GPS receiver if lower power draw is required.  Leaving the GPS on will allow long term more accurate position data – although probably not needed as this type of weather station doesn’t normally move.  If the GPS is powered-off, a RTC is able to maintain timekeeping.

Arduino Nano IO allocation – pins 1 to 30:

Arduino pin function Weather station function
PD1 – PCINT17 – TXD GPS Receiver serial data RXD
PD0 – PCINT16 – RXD GPS Receiver serial data TXD
2 – PD2 – PCINT18 – INT0 Rain Gauge pulses
3 – PD3 – PCINT19 – OC2B – INT1  
4 – PD4 – PCINT20 – T0 GPS power control – use pin as digital output
5 – PD5 – PCINT21 – OC0B – T1 Wind speed pulse counter using T1
6 – PD6 – PCINT22 – OC0A Indicator LED
7 – PD7 – PCINT23 – AIN1 BH1750 – may need a reset control ???
8 – PB0 – PCINT0 – CLK0 – ICP1 Air-Quality digital
9 – PB1 – PCINT1 – OC1A Data-Ready signal to main processor
10 – PB2 – PCINT2 – OC1B – SS SPI Link to main processor
11 – PB3 – PCINT3 – OC2A – MOSI SPI Link to main processor
12 – PB4 – PCINT4 – OC1A – MISO SPI Link to main processor
13 – PB5 – PCINT5 – SCK – led SPI Link to main processor
— – AREF  
PC0 – ADC0 – PCINT8 Wind Direction
PC1 – ADC1 – PCINT9 UV sensor
PC2 – ADC2 – PCINT10 Solar Radiation
PC3 – ADC3 – PCINT11 Battery Voltage
PC4 – ADC4 – PCINT12 – SDA I2C-data – AM2320 – BMP280 -BH1750 – RTC – air-quality
PC5 – ADC5 – PCINT13 – SCL I2C-clock – AM2320 – BMP280 -BH1750 – RTC – air-quality
ADC6 – analog input only Air-quality-analog 1
ADC7 – analog input only Air-quality-analog 2


Main Processor – MP

This is also basically an Arduino Nano on the main board with an ethernet module and SD card.  The SPI is quite busy, connecting to the SP as well as the lightning detector, SD card and ethernet interface.  The lightning detector is a slave of the MP – it does have a I2C interface but apparently the support is not as good.  The MP SPI is busy.

The SP formats a lot of the raw data then sends a large ascii text message string to the MP.  The MP adds lightning and aux data to create the complete data message.

Arduino Nano IO allocation – pins 1 to 30:

Arduino pin function Weather station function
PD1 – PCINT17 – TXD  
PD0 – PCINT16 – RXD  
2 – PD2 – PCINT18 – INT0 Ethernet interrupt
3 – PD3 – PCINT19 – OC2B – INT1 AS3935 interrupt
4 – PD4 – PCINT20 – T0 SS for SD Card (matches ethernet/sd shield)
5 – PD5 – PCINT21 – OC0B – T1 AS3935 chip-select
6 – PD6 – PCINT22 – OC0A Indicator LED
7 – PD7 – PCINT23 – AIN1  
8 – PB0 – PCINT0 – CLK0 – ICP1  
9 – PB1 – PCINT1 – OC1A Data ready signal from sensor processor (SS)
10 – PB2 – PCINT2 – OC1B – SS SS for Ethernet controller (matches ethernet/sd shield)
11 – PB3 – PCINT3 – OC2A – MOSI Link to sensor processor – SD card – Ethernet – AS3935 (lightning)
12 – PB4 – PCINT4 – OC1A – MISO Link to sensor processor – SD card – Ethernet – AS3935 (lightning)
13 – PB5 – PCINT5 – SCK Link to sensor processor – SD card – Ethernet – AS3935 (lightning)
— – AREF  
PC0 – ADC0 – PCINT8 Aux-Analog-1
PC1 – ADC1 – PCINT9 Aux-Analog-2
PC2 – ADC2 – PCINT10 Aux-Analog-3
PC3 – ADC3 – PCINT11 Aux-Analog-4
PC4 – ADC4 – PCINT12 – SDA  
PC5 – ADC5 – PCINT13 – SCL  
ADC6 – analog input only  
ADC7 – analog input only  


Misc Notes: