Introduction: Join the IOT With Your Weather Station - CWOP

Picture of Join the IOT With Your Weather Station - CWOP

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 Amazon.com and 672E608 at Tindie.com. 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 - https://www.instructables.com/id/Create-Your-Own-Solar-Powered-Raspberry-Pi-Weather/) 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

Picture of Signing Up for CWOP

Signing up for CWOP is fairly simple.

1) Follow the directions to get your DW designation number on http://wxqa.com/SIGN-UP.html

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.

Links

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

CWOP Links: http://www.wxqa.com

Check out your station: http://www.findu.com/cgi-bin/wxpage.cgi?call=EW766...

(replace EW7667 with your DW designation number)

CWOP Quality of Data Links: http://www.wxqa.com/aprswxnetqc.html

What is known about your station: http://weather.gladstonefamily.net/cgi-bin/wxsite....

Step 2: What Is the Solar Powered WeatherPi?

Picture of 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

Picture of 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

Picture of 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
                sampleWeather()
                sampleSunAirPlus()
                doAllGraphs.doAllGraphs()
                # 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

Picture of 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 <tom@tomh.us>
"""
import sys, os, time
from datetime import datetime, timedelta

from socket import *

sys.path.append('..')

# Check for user imports
try:
        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
        else:
            format_type = {
                'int': 'd',
                'float': '.0f',
            }[type(number).__name__]
            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' % (
        timeStringZulu,
        conf.STATIONLATITUDE,
        conf.STATIONLONGITUDE,
        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),
        conf.STATION_TYPE
    )

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)


        return

Step 6: Example CWOP Packet

Picture of 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:

EW7667>APRS,TCPIP:@251954z4739.22N/11705.11W_158/004g006t076P000h49b01015IOTWeatherPi

Step 7: CWOP Results

Picture of 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 findu.com:

EW7667>APRS,TCPXX*,qAX,CWOP-3:@252056z4739.22N/11705.11W_045/009g013t075P000h46b10147IOTWeatherPi

EW7667>APRS,TCPXX*,qAX,CWOP-3:@252116z4739.22N/11705.11W_045/010g036t077P000h44b10146IOTWeatherPi

EW7667>APRS,TCPXX*,qAX,CWOP-3:@252135z4739.22N/11705.11W_045/008g006t077P000h42b10143IOTWeatherPi

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

Comments

About This Instructable

5,403views

94favorites

License:

Bio: 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 ... More »
More by SwitchDocLabs:GroveWeatherPi - Solar Raspberry Pi Based Weather Station - No Soldering Required (Updated October 24, 2016)Build a Solar Powered ESP8266Using XML on the Raspberry Pi with Python
Add instructable to: