These are similar to the cups that I used
I used 1/8" rod and another old Tupperware container with two ball bearings to allow the shaft to rotate freely. I actually had to sand down the shaft for it to fit in the bearings. In order to keep the shaft from sliding out, I didn't sand the ends of the shaft so that the shaft is essentially press-fitted into the bearings. I glued the magnet onto the shaft vertically and placed the hall sensor next to it on a piece of perfboard. The magnet causes the sensor to fall LOW each time it spins, and the Raspberry Pi can easily count each of these pulses.
Its easy to calculate the speed of the anemometer in rotations per unit time, but that is relatively meaningless and there is no way to simply convert from rpm to mph (or kph, kts, m/s, etc.) -- there are simply too many variables (cup size, anemometer weight, friction, etc). I need to correlate my anemometers rpm with known wind speeds. I decided the best way to do this and get a good range of wind speeds would be with my car.
I chose a mostly calm day to do the calibration so that ambient winds wouldn't harm my readings. I wrote a simple python script to log the number of pulses that the anemometer produced. I plugged the Raspberry Pi into my cigarette lighter and SSH'd into my Pi with my computer to control it. To further complicate things, I had to create a mobile hotspot on my phone in order to stay connected away from my house. Luckily, my girlfriend was happy to help out since I don't have enough hands to drive, control the Pi, and hold the sensor at the same time. I drove and held the sensor out of the window while she ran the python script. We collected data from 5 mph, 10 mph, 15 mph, etc up to 50 mph.
When we got back, I plotted and graphed the data in Excel and was surprised to find that the relationship was very linear. The linear regression equation came out to be y = 1.9757x + 0.2395, where x is in rotations/second. The R-squared statistic was good considering the crude calibration method at 0.9976.
See the finished pictures to see the anemometer.
No comments:
Post a Comment