Zambretti Forecaster

The Zambretti Forecaster is a weather forecasting tool in the form of a circular slide rule introduced in 1920.  It claims to accurately predict near-term weather based on barometric pressure, the trend in the pressure (rising, steady, or falling), and wind direction. It relies on the fundamental meteorology of pressure fronts. Watch any TV weather forecast and you will see high- and low-pressure areas prominently displayed on the map. The boundaries between pressure areas are strongly associated with wind and precipitation. Additionally, high-pressure is usually associated with fair weather while low-pressure is associated with cloudy, rainy, or snowy weather.

The are many interesting things about the Zambretti Forecaster. First, there was no Mr. or Ms. Zambretti, rather, it was a trade name used by Negretti and Zambra, a famous London instrument-making company from the mid-19th Century through 1999. Second, there was a modern reproduction on sale in the mid-aughts of the 21st Century though it does not appear to be currently available.

Kevin Scott, Ph. D. has reverse engineered the modern reproduction in very fine work reported at He derived an algorithm that is easily implemented in computer code.

Since the D1M-WX1 weather stations accurately monitor barometric pressure, it is easy to apply the Zambretti Forecaster technique to a ThingSpeak channel. My adaptation of Dr.  Scott’s algorithm is provided below as a snippet for a MatLab visualization. To see this in action, open The Zambretti Forecast is at the bottom of the Current Values display.

Next steps:

  1.  Consider including the rate of barometric change in the forecast.
  2. Track the Zambretti Forecast against weather service predictions.
  3. Publish a pdf with instructions for making your own Zambretti Forecaster.

MATLAB code snippet:

Sending APRS Analog Telemetry – The basics

The amateur radio Automatic Packet Reporting System (APRS) is typically used for position and weather reporting. It can also handle eight digital and five analog telemetry channels. The IoT Kits© solar-powered weather stations have four APRS analog telemetry channels for LiPo cell voltage, time awake, WiFi signal strength, and light intensity. Four digital channels are used for warning alarms: low cell voltage, low signal strength, and sensor failures.

Analog telemetry is transmitted as an 8-bit word, therefore, the analog signal must be mapped to a range of 0 to 255. A good example is the mapping of LiPo cell voltage. An obvious mapping strategy would be to map voltage from 0 to, say, to 5 Vdc. This would quantize the results in steps of about  20 mV (5 V / 255) but it is unnecessary to report voltages below about 3 V because the D1 Mini will stop working.  If we map the range of 2.5 V to 5 V we will cut the quantization step in half to 10 mV, twice the precision of the first approach.  The weather station measures the cell voltage, subtracts 2.5 and divides the result by 10 mV. Say the cell voltage is 4.2, the mapped value is (4.2 – 2.5) ÷ 0.010 = 170.

The telemetry receiver must reverse this process by multiplying the received byte value by 0.010 and adding 2.5 like this: (170 × 0.010) + 2.5 = 4.2 Volts.

How does the receiver know that it must perform this operation to interpret the voltage? Two approaches are possible: we can send the telemetry “blind” since WE know how to interpret it, or we can send instructions so that anyone can understand our telemetry. The IoT Kits weather stations use the second method by sending instructions every two hours so that APRS services such as can correctly plot our data.

It actually takes four messages to completely define the analog telemetry:

T – T is the APRS symbol for telemetry. It is followed by a three-digit sequence number. Earlier versions of the D1M-WX1 weather stations sent a sequence number from 000 to 999 derived from UNIX time obtained fron an NTP server. Current versions send a number from 000 to 255 stored in the ESP8266 RTC memory and incremented on each wake cycle.

PARM – Defines the name of the parameter. APRS limits the name to three to six characters depending on the particular channel. The weather station transmits Vcell, RSSI, Light, and time awake.

UNIT – Defines the units for each channel with the name limited to 3 to 6 characters:  Vdc, dBm, lux, sec.

EQNS – Each analog channel has a quadratic equation that tells listeners how to interpret the 8-bit value associated with each channel.

A quadratic equation is a polynomial of the second order. That means that it is a polynomial function in one or more variables in which the highest-degree term is of the second degree. APRS uses this quadratic equation to interpret the received telemetry data: a · x2 + b · x + c where x is the received byte value.

The EQNS message transmits a set of three coefficients for each analog channel: a, b, and c

For the Vcell channel, the EQNS message looks like this: 0, 0.01, 2.5 meaning a = 0, b = 0.01, and c = 2.5. The receiver understands this to mean Vcell = 0 · x2 + 0.01 · x + 2.5

Let’s try it with a byte value of 163 as shown in the received telemetry data following:

Vcell = 0 ·1632 + 0.01 · 122 + 2.5

Vcell = 0 + 1.63 + 2.5 = 4.13 Volts

This is exactly what we had planned! This is how engineering and applied mathematics work in the real world.

Here is a sample of telemetry definitions from a D1M-WX1 weather station:

2018-10-09 15:53:32 EDT: W4KRL-15>APRS,TCPIP*,qAC,T2DENMARK:T#144,163,078,013,080,,1111,Solar Power WX Station
2018-10-09 15:53:32 EDT: W4KRL-15>APRS,TCPIP*,qAC,T2DENMARK::W4KRL-15 :PARM.Vcell,RSSI,Light,Awake,,BME28,BH17,loV,loS
2018-10-09 15:53:32 EDT: W4KRL-15>APRS,TCPIP*,qAC,T2DENMARK::W4KRL-15 :UNIT.Vdc,dBm,lux,secs,,OK,OK,OK,OK
2018-10-09 15:53:32 EDT: W4KRL-15>APRS,TCPIP*,qAC,T2DENMARK::W4KRL-15 :EQNS.0,0.01,2.5,0,-1,0,1,0,0,0,0.1,0
2018-10-09 15:53:32 EDT: W4KRL-15>APRS,TCPIP*,qAC,T2DENMARK::W4KRL-15 :BITS.Solar Power WX Station

Temporary Station using DIY Solar Shield

It has rained since we arrived at Bethany Beach, Delaware for vacation so it has not been able to test how well the DIY solar radiation shield performs in sunlight. It is hung on a small twig of a tree in the backyard.

ThingSpeak feed:

APRS Feed: https://aprs-fi/W4KRL-13

DIY Instrument Shield

An instrument shelter provides a flow of air around weather sensors while protecting them from direct sunlight and rain. Without a shield, the sun can heat the temperature sensor giving a false high-temperature reading.

Professional weather stations use a large louvered box called a Stevenson Screen that is built to specific dimensions for standardized weather measurements. Smaller plastic shields can cost $100 or more. My station uses an AcuRite Radiation Shield that sometimes sells for as little as $10. Making your own instrument shelter can be an easy and fun project that may cost less than $6.

These instructions will give you a general idea how to build a shield. You can easily adapt the design to the materials you can find. The basic item is a shallow dish with nearly vertical straight sides. Dishes made as plant saucers are an excellent choice. The dishes are stacked on top of each other separated by beads and held together by wire ties. It makes a surprisingly sturdy design.

Here are suggested items. Any reasonable substitute will work if you can’t find these exact items:
• Dotchi 4-in Clear Plastic Plant Saucer – Lowe’s #606062 – $0.34. Buy six and maybe a few spares.
• Valspar White Spray Paint – Lowe’s #282255 – $0.99.
• Nylon Wire Ties – 6 to 11-inches long – Dollar Tree $1.00 or Harbor Freight $2.00
• Plastic or wood craft beads of the “large hole” variety. The hole must be large enough to allow the wire tie to pass through – Dollar Tree or Michael’s

You need to have at least six small saucers with flat bottoms and steep shallow sides. Plant saucers of 4 to 6-inch inch (100 mm – 150 mm) diameter work well. They are very thin so larger saucers are not strong enough. Paint them white with spray paint inside and out.

After the paint is dry, cut a hole in the flat bottom of five of the saucers leaving a ring at least 1/4-inch (6 mm) wide. The sixth uncut saucer will be the top of the shield. The holes should be a little larger than the width of the weather station printed circuit board, say 1.75-inches (45 mm). Cut three small slots wide enough to pass the tail of a wire tie in the flat bottom ring of each saucer. The slots must all line up. One way to do this is to make three equally spaced guide marks on the top saucer with a permanent marker. Place each of the other saucers over the top one and put marks in the same places. You can see the guide marks by holding them up to a light. Cut short slots at all the marks with a craft knife.

Look at how wire ties work: one side of the tail is smooth, the other side has ridges that engage with a tongue in the head of the tie.

Place the tail of a wire tie through each of the slots in the top saucer with the ridged side facing the center of the saucer hole. Put at least two beads over the tails of the wire ties coming out the other side of the saucer and thread them through the holes in the next saucer. Do this for each saucer.

You should now have a loose stack of saucers with three wire ties sticking out the bottom. Place a bead on each of the wire ties, then carefully press the head of another wire tie over each tail. You can tighten these up by hand to hold the stack firmly together. The tails of the new wire ties will cross more-or-less in the center of the bottom saucer. Cut three small slots in the side of the bottom saucer opposite from each wire tie. You can gently pry up the tails and insert the LiPo cell and weather station PCB into the hole with the solar cell outside. Pass the tails through the slots to secure the weather station in the shield.

Mounting the station is up to you. One possibility is to pass wire tie tails through the heads in the top of the shield and fasten them to some convenient bracket. For a few dollars more, buy a set of magnetic hooks like the ones Harbor Freight sells as item # 98502. Before you put your station inside the shield, drop a 1-1/2-inch (40 mm) steel (not stainless) washer into the shield. Place the magnetic hook on the other side so that it attracts the washer.

Solar Radiation Shield under test

The D1M-WX1 and D1S-WX1 solar-powered weather stations heat up in direct sunlight giving an incorrectly high-temperature reading. Early results from testing an Acurite solar radiation shield are very good.

The shield is available from several online vendors. Check around for a good price as the same item sells for $10 to $60 from different vendors.

I inserted a D1S shield-type station into the Acurite product and hot-melt glued the solar panel to the side of the solar shield. The shield comes apart by carefully prying small plastic tabs between each layer. This makes it easy to run wires into the shield.

On sunny days, the unshielded sensor heats up by more than 20ºC (36ºF) compared to the sensor in the AcuRite shield.

Since product availability is problematic, I am going to look into the possibility of building a DIY solar shield with dollar store components.

Important Weather Kit Update 16 June 2017

Applies only to kits purchased before May 2018
Some builders have noted that the markings on the XH 2-pin connector leads do not conform to the instructions.  It appears that every pair has a different set of markings. Getting the polarity of the connectors wrong, particularly for the LiPo cell connector, can damage the TP4056 charger and D1 Mini microcontroller.
It is important to note the markings on the leads and identify the positive and negative leads when the connectors are mated. It is best to write down the markings and refer to your notes when soldering the leads to the solar panel and LiPo cell. You may wish to take an extra step and use a DMM to confirm that the positive and negative connections are correct before mating the connectors.
The latest assembly manual (Version 2.2 16 June 2017) has revised instructions for the cell and panel connectors:

Power supply measurements

Most electronic projects operate on low voltage direct current. This is often provided by a USB connection or a battery. There are several possibilities to power a project from the 120 Vac power line. A common way is to use a wall adapter (wall wart) and feed low voltage direct current to your project through a power connector. A good feature of this approach is that the project enclosure is smaller because it does not need to house a power supply.

If you have a project that controls line power, like a Wi-Fi controlled receptacle, it is more convenient to incorporate the power supply in the project enclosure so that you do not need to connect to both the power line and a wall adapter. The solution is to include the guts of a wall adapter into the project enclosure.

Rather than taking apart a wall adapter, you can buy a phone charger kit from eBay vendors. Try searching for “diy training phone charger kit”.

According to the eBay listings, the specification is 5 Vdc at 350 mA to 500 mA with an input of 100-220 V 50//60Hz 0.3 A. This would be adequate for many Arduino and ESP8266 projects, sadly, the supply can barely meet 170 mA.

Next step is to modify the circuit to see if the output can be raised. Short out R7 and play around with R2, R3, and C2.

ThingSpeak Addins

Here is a selection of MATLAB Visualizations tailored to the IoT Kits Weather Stations:

HacDC/W3HAC Meeting Presentation Announcement – April 12, 2017 at 7:30 pm

Some of our members recently purchased a solar powered, Arduino programmable, weather station kit from Karl, W4KRL at the Winterfest in Annandale, VA. Due to the popularity of this kit, I invited Karl to come to our next club meeting to give a presentation all about its development, how the station works, etc. Karl has graciously accepted the invitation.

You may be surprised to learn that this is a new venture for Karl. For most of his career, as an electrical engineer, he designed large power electronics converters for rapid transit car propulsion systems. The Arduino project is the crossover between these two ventures. Planned areas of discussion include a presentation that focuses on the origin of the development of the kit, the challenge of designing a circuit board, and some of the unique technical issues involved with the design of this project.

Because of the content of this meeting, this should be of interest to not just the members of the HacDC Amateur Radio Club, but also to the general “Hackerspace”, “builder” and “maker” communities as well. All are invited and encouraged to attend.

As is the case with all of our events, there is no cost to attend. We look forward to seeing you at the meeting.

Posted on by jeff dahn

Di Mini (ESP8266) Wi-Fi Status Codes

The ESP8266 using the Arduino Core reports Wi-Fi status with the WiFi.status() function. The D1M-WX1 Weather Station attempts to connect to Wi-Fi every 250 milliseconds until the “Connect” status is found. If this does not happen after 15 attempts, it prints the status to the Serial Monitor.

Normally, the LED on the ESP8266 flashes five or six times until the connection is made. The LED will be dark during the six or seven seconds it takes to post the weather data on the Internet.  It will flash three times before the station goes to sleep for 10 minutes. The code is in the logonToRouter() function of the weather station sketches.

If a Wi-Fi connection can not be made, the LED will flash 16 times and the exit code will appear on the Serial Monitor. The status codes are:
0 = Idle Status – WiFi.begin() is called and remains active until the number of attempts expires (resulting in CONNECT_FAILED) or a connection is established (resulting in CONNECTED)
1 = No SSID Available – Unit is too far from the Wi-Fi access point, the SSID and/or password is incorrect, or the SSID is for a 5GHz-band access point.
2 = Scan Completed – Scanning for available networks is completed.
3 = Connected – Success.
4 = Connection Failed – The opposite of success.
5 = Connection Lost
6 = Disconnected
255 = No Shield – Used for compatibility with the Arduino WiFi Shield – not relevant to the ESP8266.