Weather Station and the Raspberry Pi

USB to RS-485 Adapter
USB to RS-485 Adapter

One of the weaknesses with my weather stations was that they did not have the ability to accept incoming connections. This made remote debug a bit difficult, if not impossible. Basically, you program the thing, and hope there are no glitches. Surprisingly, this worked for many years with the occasional reset, but I finally decided to spend some time making some improvements to this aspect of the weather station system.

Originally, my weather stations consisted of an outdoor unit, which acted as a hub for all the outdoor sensors. The hub communicated with an RS-485 to Ethernet bridge (Arduino+Ethernet shield) inside the house near the router. This allowed long runs, and the ability to easily chain multiple hubs together on the RS-485 bus. I decided to keep the RS-485 bus model, and built a USB to RS-485 bridge to replace the Arduino and Ethernet shield that I used previously. The new USB adapter uses an FTDI chip and is compatible with most Mac, Linux, and Windows computers out-of-the-box. I was really happy to avoid the use of drivers. This adapter also features transient protection and other features that most cheap USB to RS-485 adapters do not have. This was important considering the long cable run out to the weather station. And, because the weather station hub runs at 3.3V and uses little power, the entire system can be powered from the USB port which provides 5V down the line.

I took this new USB adapter and hooked it up to a Raspberry Pi. Using a Python script I whipped up in a few minutes I was able to completely replace the functionality of the older Arduino-based system. While I haven’t added any new functionality yet, the Raspberry Pi allows for a lot more possibilities with its huge memory space, and the ability to SSH and VNC into it remotely. This solves the old problem of remote troubleshooting, which was basically impossible before. Local logs are also generated using the Python script to record errors and weather data in the event of an internet outage or other failure. I’m very happy with this improvement.

Grid Dip Meter

Grid Dip Meter
Heathkit HD-1250

A grid dip meter is, in it’s simplest form, an oscillator. One function of this device is to determine what frequency, or frequencies, a particular LC circuit is tuned to. This is accomplished by placing the device in close proximity with the LC circuit under test. Inductive coupling between the meter and the circuit being tested allows the resonant frequency to be measured. When the frequency of the meter is tuned to the frequency of the LC circuit under test a dip will be observed on the meters indicator. More information about how to use this device can be found on YouTube in a video by Alan, W2AEW.

HD-1250 Grid Dip Meter
Inside the HD-1250

I thought it would be interesting to take this little meter apart and see what’s inside. While most of us are familiar with how to use one of these meters, and what they look like on the outside, I’m guessing that unless you’ve assembled one of these nifty devices yourself that you won’t be quite as familiar with the parts inside.

In the photographs you will see some familiar components. The large device with the moving interweaving plates is the variable capacitor. This capacitor, along with the inductive probe chosen sets the frequency of the oscillator. Other big ticket items include the battery on the left, the variable potentiometer to set the gain of the front panel meter seen with the small thumb-wheel attached, and the single-sided circuit board on the bottom.

Grid Dip Meter Circuit Board
HD-1250 Circuit Board

I admire the simple sheet metal construction of these Heathkit devices. Their simplicity certainly contributed to their low cost, and high availability that made the Heathkit line so popular. I found the method they used to create a tapped mounting hole in the edge of the sheet metal to be particularly clever. This is a technique I could certainly use in the future.

The single-sided pcb in this meter looks like it was likely drawn by hand. This semi-artistic method of pcb design has gone by the wayside in favor of modern CAD software, but you can still learn a lot by studying these designs. I can appreciate the quality of the work here, especially considering it was done on paper.

Lightning Sensor

Over the last year or so I’ve been working on a lightning sensor system for my weather station. I originally found a circuit published by Charles Wenzel that I thought looked interesting, and I decided to give it a try. The circuit worked quite well. So well, in fact, that it picked up lights turning on and off around the house. It also goes wild when the stove-top in the kitchen is used. I guess the stove has a noisy PWM circuit or something. I made a PCB for the circuit, and integrated it into my weather station and have let it run for a few months now.

Weather Station Data
10 Days of Weather Data

As the summer draws near a flaw in this design has presented itself. The flaw is severe temperature instability. Hotter temperatures increase the sensitivity of the system, and on hot days the thermal noise of the circuit causes a significant amounts of false triggers. This will be addressed in an upcoming design change in an attempt to reduce the number of false triggers.

The event on May 4th was an actual lightning storm and strikes were observed by persons in the area. Note the large drop in barometric pressure preceding the rise in lightning strike counts.

Ultrasonic Anemometer Part 5 – Initial Bench Testing

I received my first printed circuit board for the ultrasonic anemometer. After soldering all the parts together I began some testing to see how the design worked. There were some very successful parts, and some things that will need to be adjusted.

Ultrasonic Anemometer
First prototype powered up

The amplifier stage seems to work pretty well. However, because I forgot to order one of the capacitor values in the band-pass stage, the center frequency wasn’t right on. That, however, was not a problem with the design, but rather the designer. Oops!

The main issue with the design was not something I expected to be a problem, but in hindsight is something I should have considered more carefully. The problem lies in the 3.3V supply rail. When the micro-controller drives one of the transducers there is quite a bit of noise on the 3.3V supply rail.

Noise on the 3.3V rail
Noise on the 3.3V rail

Because everything (including the amplifier circuits) are connected to that supply the noise appears on the received signal as well. I think the best solution here is to isolate the sensitive analog stages from the digital supply. This will take a separate power supply. This is a downside because it will add components and cost, but I think the expense is warranted and will result in better performance. I also added a capacitor in the mid-supply generation circuit to help keep the bias point closer to the midway point between the two rails for the analog circuitry.

I also decided to increase the gain of both stages of the amplifier. I must have underestimated the gain requirement of the system because the output is too low at present.

While I wait for the modified circuit boards to arrive I’ll spend some time using what I have now to begin working on coding the firmware. Although the current design has some problems, there is nothing that would prevent me from getting 90% of the code finished before the new boards arrive. I’ll start to cover the C code in the next part of this series.

 

Ultrasonic Anemometer Part 4 – Envelope Detector

The envelope detector circuit will be used to detect the amplitude of the signal coming from the amplifier. The output will be fed into an analog input on the micro-controller. Here is the initial schematic that I’ll be using for this portion of the design:

Envelope Detector Circuit
Envelope Detector Circuit

The first two elements (C15 and R14) form a high-pass filter (Fc = 339 Hz) and also bias the op-amp to ground. U3D drives D6 and C16 which form a simple peak detector. The output of this peak detector is low-pass filtered by R18 and C17 to smooth the output. U3C provides adjustable amplification if needed, and buffers the output. R21 and C18 will provide a final low-pass filter to reduce any noise in the signal before it enters the microcontroller.

Now would be a good time to tell you about a little trick I’m holding up my sleeve. Often overlooked, the built-in analog comparator in many micro-controllers will be very useful in this design. I plan on using it to perform the entire function of the zero-cross detector, by way of feeding the output from the amplifier directly into a analog input to the micro-controller. I also plan on using this built-in comparator to perform the threshold detection of the envelope input which will be fed into a separate analog input. The microcontroller has a built-in multiplexer that can select the appropriate signal quickly, and perform the comparison. This comparison can also trigger an interrupt for precise time measurement. This will eliminate the need for external parts, thereby reducing cost and size, and should give the processor even more control and flexibility.

I’ve sent the PCBs off for manufacturing and next time we’ll look at results of these initial designs and see how they work.