Skip to content

ohiomichael/WeatherOS

Repository files navigation

Raspberry Pi Pico W WeatherOS

WeatherOS is a MicroPython-based operating system for the Raspberry Pi Pico W designed to run a wireless outdoor weather station for collecting localized climate data.

Features

  • Collects temperature, humidity, pressure, and rainfall data
  • Wireless data transmission to your own server
  • Customizable data collection intervals
  • Easy configuration through JSON files
  • Flexible sensor configuration (all sensors are optional)

Supported Sensors

  • Adafruit SHT41: Temperature and humidity (uses I2C)
  • Adafruit BMP280: Barometric pressure (uses SPI)
  • Rain sensors: Basic contact-based detection (water completes circuit, requires ADC pin)
  • Coming soon: Solar/light intensity sensing

Hardware Requirements

  • Raspberry Pi Pico W
  • Sensors (Optional):
    • Adafruit SHT41
    • Adafruit BMP280
    • Rain sensor connected to an ADC pin
  • Stable power source for the Pico W
  • Server running MySQL (8.0+) and Apache2 with MySQLi

Installation Steps

1. Hardware Setup

  1. Connect your desired sensors to the Raspberry Pi Pico W:

    • SHT41 via I2C
    • BMP280 via SPI
    • Rain sensor to an ADC pin
    • Custom pin configurations can be defined in config.json
  2. Provide a stable power supply to your Raspberry Pi Pico W

2. Software Setup for Pico W

  1. Install MicroPython on your Raspberry Pi Pico W
  2. Download the WeatherOS files from this repository
  3. Transfer all files to the root directory of your Pico W
  4. Create a config.json file based on the provided example_config.json
  5. Create a secrets.py file based on the provided example_secrets.py

3. Server Setup

  1. Install and configure Apache2 web server with MySQLi enabled
  2. Set up MySQL server (version 8.0+)
  3. Create the database schema by running the provided create_schema.sql file
  4. Install the WeatherOS API software from the WeatherOS API repository

Configuration

The repository includes example configuration files:

  • example_config.json: Template for sensor configuration and data collection settings
  • example_secrets.py: Template for storing sensitive information like WiFi credentials

Create your own config.json from the example to customize:

  • Which sensors are enabled and their pin assignments
  • Data collection intervals
  • Server connection details

Create your own secrets.py from the example to store:

  • Network credentials

Example configuration:

{
    "system":{
        "wireless": true,
        "log_level": "WARNING",
        "log_file": "weatheros.log",
        "web_server": "example.com",
        "pull_rate": 30
    },

    "status_leds":{
        "enabled": false,
        "red_pin": 2,
        "yellow_pin": 3,
        "green_pin": 4
    },

    "SHT41":{
        "enabled": true,
        "precision": "high",

        "mode": "i2c",
        "sda": 0,
        "scl": 1,
        "freq": 100000
    },

    "BMP280":{
        "enabled": true,

        "mode": "spi",
        "sck": 10,
        "tx": 11,
        "rx": 12,
        "csn": 13
    },

    "DSK":{
        "enabled": true,
        "pin": 0
    }
}

Accessing Your Weather Data

Once set up, your weather station will automatically collect and transmit data to your server. You can access this data through:

  1. The WeatherOS API
  2. Custom applications that connect to your MySQL database
  3. Direct database queries

Troubleshooting

  • If sensors aren't being detected, verify your wiring connections and pin configurations
  • For connectivity issues, ensure your Pico W is within range of your WiFi network
  • Check server logs for API and database connection problems
  • Verify your ADC pin configuration if the rain sensor isn't working properly

Enjoy your new weather station!

Releases

No releases published

Packages

No packages published

Languages