Introduction: Join the IOT With Your Weather Station - CWOP

About: SwitchDoc Labs, LLC is a software and hardware engineering company producing specialized products and designs for the small computer industry maker movement (Raspberry Pi, Arduinos and others). The Chief Tech…

Do-Wop, Do-Wop the CWOP....

In this New Instructable by SwitchDoc Labs you will learn

  1. What is CWOP (Citizens Weather Observation Program)
  2. How to connect a Raspberry Pi based Weather Station to CWOP
  3. What Software Do You Need?
  4. How to Register at CWOP
  5. How to See Your CWOP Results

And most importantly, have fun doing it!

SwitchDoc Labs is pleased to offer 10% off all our products for Instructable Readers: Use code 6NOFQ9UW at and 672E608 at Offer good until September 3, 2015.

What is CWOP?

The Citizen Weather Observer Program (CWOP) is a network of privately owned electronic weather stations concentrated in the United States but also located in over 150 countries. Being in this network allows volunteers with computerized weather stations (like the WeatherPi - to send automated surface weather observations to the National Weather Service.

This data is then used by the Rapid Refresh forecast model to produce short term forecasts (3 to 12 hours into the future) of conditions across the United States' lower 48 states.

CWOP Observations are also re-distributed to the public. There is an extensive set of quality control software that puts your data through the ringer, assigns your data a quality rating and makes suggestions before the data is taken into the system.

The CWOP was originally set up by amateur radio operators experimenting with packet radio, but now contains a majority of Internet-only connected stations. As of July 2015, more than 10,000 stations worldwide report regularly to the CWOP network.

Step 1: Signing Up for CWOP

Signing up for CWOP is fairly simple.

1) Follow the directions to get your DW designation number on

2) Set up the values in the configuration file in WeatherPi

3) Get your station up and running with the software given in the next steps of this Instructable.


Here are a set of handy links for CWOP checking, display and other information:

CWOP Links:

Check out your station:

(replace EW7667 with your DW designation number)

CWOP Quality of Data Links:

What is known about your station:

Step 2: What Is the Solar Powered WeatherPi?

Recently, SwitchDoc Labs produced a complete instructable to build a solar powered Raspberry Pi Weather Station. That instructable is here at WeatherPi.

WeatherPi is a solar powered Raspberry Pi WiFi connected weather station designed for Makers by SwitchDoc Labs. This is a great system to build and tinker with. All of it is modifiable and all source code is included. The most important functions are:

  • Senses 20 different environmental values
  • Completely Solar Powered
  • Has a full database containing history of the environment (MySQL)
  • Monitors and reports lots of data on the solar powered system - great for education!
  • Self contained and monitored for brownouts and power issues
  • Can be modified remotely
  • Download your data to crunch it on your PC
  • Can be modified to do SMS (Text) messaging, Twitters, webpages and more
  • Has an iPad Based Control Panel
  • Easy to connect to Twitter, WeatherUnderground, etc

This Instructable will show you how to build a WiFi Solar Powered Raspberry Pi Weather Station. This project grew out of a number of other projects, including the massive Project Curacao, a solar powered environmental monitoring system deployed on the Caribbean tropical island of Curacao. Project Curacao was written up in an extensive set of articles in MagPi magazine (starting in Issue 18 and continuing through Issue 22).

The WeatherPi Solar Powered Weather Station is an excellent education project. There are many aspects of this project that can be looked at and analyzed for educational purposes:

Step 3: The CWOP Interface to WeatherPi

When you talk to the CWOP server, you use a protocol called APRS (Automatic Packet Reporting System).

APRS was originally an amateur radio-based system for real time communications of information of immediate value in the local area. Now it is used in a number of applications where data packets need to be disseminated to multiple locations.

The software that I am using in this project is based on the excellent work of Tom Hayward and his pywxtd project . We have removed the weather station parsing code and the daemon code and are just using the APRS libraries to send the data to CWOP.

Step 4: CWOP Code in the WeatherPi Software

The CWOP software reads data from the WeatherPi station and sends an APRS packet to the CWOP servers with our current weather data.

First is the post_CWOP code used to send the packet to the CWOP servers:

We install the CWOP code in the main WeatherPi loop to fire every 15 minutes.

       # every 15 minutes, build new graphs

        if ((secondCount % (15*60)) == 0):
                # print every 900 seconds
                # send our CWOP data

                # wind direction - degrees from true north
                # wind speed - integer MPH
                # wind gust - integer MPH
                # temperature - degrees F
                # rain since midnight - hundredths of inches
                # humidity - % where 100% = 00
                # pressure - 5 numbers in tenths of millibars

                CWOP.post_CWOP(wind_dir=currentWindDirection, wind_speed=currentWindSpeed, wind_gust=currentWindGust, temperature=CtoFInteger(outsideTemperature), rain_since_midnight=0, humidity=convertHumidity(outsideHumidity), pressure=int(bmp180SeaLevel*100+0.5))

Step 5: Sending the CWOP APRS Packets

Next, we have the code we use to construct the CWOP APRS packets.
#!/usr/bin/env python

# SwitchDoc Labs
# July 24, 2015
# Version 1.0

initially from Tom Hayward
builds and submits an
APRS weather packet to the APRS-IS/CWOP.
BSD License and stuff
Copyright 2010 Tom Hayward <>
import sys, os, time
from datetime import datetime, timedelta

from socket import *


# Check for user imports
        import conflocal as conf
except ImportError:
        import conf

def make_aprs_wx(wind_dir=None, wind_speed=None, wind_gust=None, temperature=None, rain_since_midnight=None, humidity=None, pressure=None):
    Assembles the payload of the APRS weather packet.
    def str_or_dots(number, length):
        If parameter is None, fill space with dots. Else, zero-pad.
        if number is None:
            return '.'*length
            format_type = {
                'int': 'd',
                'float': '.0f',
            return ''.join(('%0',str(length),format_type)) % number

    timeStringZulu = time.strftime("%d%H%M")
    return '@%sz%s/%s_%s/%sg%st%sP%sh%sb%s%s' % (
        str_or_dots(wind_dir, 3),
        str_or_dots(wind_speed, 3),
        str_or_dots(wind_gust, 3),
        str_or_dots(temperature, 3),
        str_or_dots(rain_since_midnight, 3),
        str_or_dots(humidity, 2),
        str_or_dots(pressure, 5),

def post_CWOP(wind_dir=None, wind_speed=None, wind_gust=None, temperature=None, rain_since_midnight=None, humidity=None, pressure=None):

        # post to aprs
        wx = make_aprs_wx(wind_dir=wind_dir, wind_speed=wind_speed, wind_gust=wind_gust, temperature=temperature, rain_since_midnight=rain_since_midnight, humidity=humidity, pressure=pressure)

        print time.strftime("%Y-%m-%d %H:%M:%S"), wx

        send_aprs(conf.APRS_HOST, conf.APRS_PORT, conf.APRS_USER, conf.APRS_PASS, conf.CALLSIGN, wx)


Step 6: Example CWOP Packet

I had a difficult time figuring out exactly what format of APRS to send. Here is an example of the actual packets we send:


Step 7: CWOP Results

Here is the packet and data as received by the CWOP server rom WeatherPi (our CWOP registration number is EW7667). Now we are connected to the IOT for weather stations!

Here are some of the recorded packets from




When you have collected a lot of data, will display some cool graphs as shown in the display for EW7667.