Introduction: A Self-Contained Data Logging Anemometer

Picture of A Self-Contained Data Logging Anemometer

I love collecting and analyzing data.  I also love building electronic gadgets.  A year ago when I discovered the Arduino products, I immediately thought, "I'd like to collect environmental data."  It was a windy day in Portland, OR, so I decided to capture wind data.  I looked at some of the instructables for anemometers and found them quite useful, but needed to make some engineering changes.

First, I wanted the device to run self-contained, outdoors, for a week.  Second, I wanted it to be able to record very small gusts of wind, several of the designs here required rather strong winds to get going.  Lastly, I wanted to record the data.

I decided to go for a really lightweight rotor design with as little inertia and resistance as possible.  To accomplish this, I used all plastic parts (including threaded vinyl rods), ball bearing linkages, and optical sensors.  Other designs used magnetic sensors or actual DC motors, but both of those slow the rotor down, optics use a little more power but offer no mechanical resistance.

The data logger is simply an Atmega328P with an 8 mbit flash chip.  I thought about going SD, but I wanted to keep the cost, power consumption, and complexity low.  I wrote a simple program that logged two-byte rotation counts every second.  With 8 megabits I figured I could collect about a week's worth of data.  In my original design, I figured I would need 4 C cells, but after a week they were still fully charged so I must have been off by an order of magnitude in the power consumption.  I didn't use linear regulators, I drove all voltage rails to 6V (even though some of the parts were rated 3.3V. Yay overdesign!).

To download the data, I had a complex system that read the flash and dumped it to the arduino serial monitor, and I cut and pasted into Excel. I didn't spend time trying to figure out how to write a command line USB app to dump the flash to standard out, but at some point I will need to figure this out.

The result was rather surprising, I was able to observe some very interesting trends, which I am saving for another report.

Good luck!


Step 1: Build the Rotor

Picture of Build the Rotor

I tried a number of different ideas for the rotor cups: easter eggs, ping pong balls, plastic cups, and empty Christmas tree ornament balls.  I built several rotors and tested them all with a hair dryer, which provided a range of wind speeds.  Of the four prototypes, the ornament shells worked the best.  They also had these little tabs that made affixing easier, and were made out of a rigid plastic that worked well with polycarbonate cement.

I tried a few different shaft lengths, small, medium and large (about 1" to about 6") and found that the larger sizes torqued too much and didn't respond well to low wind speeds, so I went with the small size shafts.  Since everything was clear plastic, I made a handy little printout to help alight the three blades.

Materials:

The ornaments came from the Oriental Trading Company, item "48/6300 DYO CLEAR ORNAMENT", $6 plus $3 shipping.  The plastic shafts and the structural disk came from a local TAP Plastics store, about $4 more in parts.

Step 2: Build the Upper Base

Picture of Build the Upper Base

To reduce rotational inertia, I used a threaded nylon rod from McMaster Karr.  I wanted to use bearings, but machine bearings are packed in rotor-slowing grease, so I bought some cheap skateboard bearings that had none.  They just happened to fit inside CPVC inner diameter 3/4" pipe adapter..  It wasn't until I assembled the structure that I realize skate bearings handle planar load, and I was applying vertical load, so I should have used a thruster bearing, but they worked just fine, and probably helped manage friction from precession torque.

I planned to attach an optical sensor to the bottom of the shaft, so I mounted the CPVC coupling into a larger base.  Home Depot is a fun place to mix and match CPVC/PVC fittings.  Ultimately I was able to stuff the 3/4" threaded CPVC coupling into a PVC 3/4" to 1-1/2" reducer.  It took a lot of playing around to make everything fit, but it left enough room for electronics. 


Materials:

98743A235 -- Black Threaded Nylon Rod (5/16"-18 thread)
94900A030 -- Black Nylon Hex Nuts (5/16"-18 thread)
Cheap skateboard bearings
3/4" threaded CPVC adapter
3/4" to 1-1/2" PVC reducer to threaded 3/4" pipe

Note: PVC and CPVC coupling dimensions are not the same, probably to prevent accidental misuse; so swapping in a plain PVC 3/4" regular adapter won't work, however, the THREADS of a threaded adapter are the same, which is totally weird.  The CPVC coupling threads into the PVC adapter bushing.  Adapter... bushing... coupling... I'm probably mixing up all of these terms, but 15 minutes in the Home Depot plumbing aisle will set you straight.


Step 3: Optical Interrupter

Picture of Optical Interrupter

As the rotor turns, its rotation is counted by an optical interrupter.  I thought about using a disk, but that meant I'd have to attach the illumination source and the detector vertically, which would be very challenging to assemble.  Instead I opted for horizontal mount and found some little cups that go on the bottom of chairs to protect hardwood floors.  I painted and taped off six segments, which would give me twelve (nearly) uniform edges, or 12 ticks per revolution of the rotor.  I thought about doing more but wasn't very familiar with the speed of the detector, or the field-of-view of its optics.  That is, if I went too narrow, the LED might creep around the edges and activate the sensor.  This is another area of research I didn't pursue, but would be good to explore. 

I glued the painted cup to a nut and fastened it to the end of the shaft.

Materials:
Chair leg protector cup thing from the Home Depot
Black paint

Step 4: Attach the Rotor!

Picture of Attach the Rotor!

At this point it was starting to look pretty cool.  The nylon nuts are really slippery, so I had to use many locknuts (in case you didn't notice from the previous pictures).  I also had to make a special flat wrench to fit into the cap beneath the rotor so that I could lock both nuts down.


Step 5: Build the Lower Base

Picture of Build the Lower Base

The lower base houses the batteries and provides a support structure.  I found a pretty cool waterproof box online from a company called Polycase.  It's a really slick case that seals tight, and the screws are wider at the base so they don't easily fall out of the top.

I used a PVC mate to the upper PVC bushing.  This lower base mate is just a threaded 1-1/2" PVC coupling.  The upper rotor base pressure fits into the lower base via this coupling.  As you'll see later, I didn't glue these pieces together because I wanted to be able to open it up and make adjustments if necessary, plus the assembly is easier when attaching the circuit boards.

Materials:
Waterproof box from Polycase, item # WP-23F, $12.50
Threaded 1-1/2" PVC coupling

Step 6: Build the Optical Sensor

Picture of Build the Optical Sensor

The sensor mechanism is a 940nm LED and a Schmitt-trigger receiver.  I love love love the Schmitt trigger circuit, it takes care of all my debouncing needs and sends out a CMOS/TTL compatible signal.  The only downside?  5V operation.  Yes, I over-drove the entire design to 6V, but I could have gone to 3.3V if it weren't for this part.

The idea is that this circuit mounts underneath the rotor cup, which interrupts the beam as it turns, generating logical transitions for each edge.  I don't have a good picture of how this was mounted.  I basically glued two plastic offsets into the lower base PVC coupling, and screwed it into them from above.  I had to grind down the edges of the board to make it fit neatly.

I don't even have a schematic for this, it is really easy: just run a 1k resistor from Vin and wire it up so that the LED Is always on and the output of the detector is on its on pin.

Materials:
1 940nm LED
1k resistor
1 OPTEK OPL550 sensor
1 three-pin plug (female)
1 1.5"x1.5" circuit board
Various lengths of wire
Heat-shrink tubing if you like your wires bundled


Step 7: Build the Data Logger

Picture of Build the Data Logger

The Arduino prototyping board was way to big to fit into the chassis. I used EagleCAD to lay out a smaller circuit board, and lost pulled off a single layer ... there are four ugly wires I needed to bridge a few gaps.

(I thought I measured this at ~50mW operating power, and based on the Watt-Hours of the batteries, I thought i would drop below 5V in a week, but either my power measurement or my math was wrong because 4 C-cells kept going for a long time.)

Fairly straightforward layout: just a resonator, the ATmega328, a flash chip, a debug jumper, a debug LED, power supply cap, and that's about it. There's something called DorkBoard which I could have used too, it's basically everything needed for an ATMega328 dev board in the size of DIP socket. I considered buying one but my discrete approach was about 50% cheaper. Here is the dorkboard link: http://dorkbotpdx.org/dorkboard_assembly_tutorial

Here's the basic idea (source code will be included later on) how the board operates:

Jumper set to "debug" mode: attach a change-value interrupt to the optical sensor output, and flash the test LED in unison with the detector. This was very helpful for debugging.

Jumper set to "record" mode: attach the same interrupt to a counter, and in the main loop, delay 1000 msec. At the end of the 1000 msec, write the # of edge counts to a 256-byte flash page, and when the page is full, write it out and reset the count.

Simple, right? Pretty much. I really like the Winbond flash devices, I used to design flash back in the 90's, so it was fun to program them again. The SPI interface is brilliant. So simple to use. I'll let the schematics and source code speak for themselves.

Did I mention EagleCAD is awesome? It really is. There are some great tutorials on YouTube.

Step 8: Attach the Electronics

Picture of Attach the Electronics

Again, I don't have many good pictures here, but if you imagine two plastic standoffs glued to the inside of the PVC, both boards are screwed into it.  Here's a shot of the logger board connected to the bottom.  The detector board is up inside the housing. 

Step 9: Calibration

Picture of Calibration

I made a test rig to calibrate the beast so that I could convert raw rotor counts to MPH.

Yes, that is a 2x4.  I attached the anemometer to one end, and a debug Arduio to the other.  The LCD displayed the rotor counts.

The process went like this:

1) Find a long straight road with no traffic.
2) Hold the 2x4 so that it pokes as far out the window as possible
3) Turn on voice recording on your iPhone or Android
4) Turn on a digital GPS speedometer on your handheld device of choice
5) Drive steadily at several speeds and announce to your recorder the speed and average rotor counts
6) Don't crash
7) ?
8) Later on, when not driving, replay your phone message and enter the data into excel and hope a linear or an exponential or a polynomial fits with an R-squared value greater than 99%

This conversion # will be used later on.  The device only captures raw data, I post-processed it to MPH (or KPH) in Excel.

(Did I mention I applied a badass coat of olive drab paint?  I would have called this a "Tactical Data Logging Anemometer", but then I remembered that "Tactical" means "black".)

Step 10: Go Collect Some Wind Data!

Picture of Go Collect Some Wind Data!

That's pretty much it. I think a few pictures are missing, e.g. not shown are the four C-cells crammed into the lower base. I couldn't fit a spring-loaded holder so I ended up soldering leads to the batteries themselves. I'm writing this instructable a year after I built it, and in revision #2, I used AA batteries because I grossly overestimated the power consumption. Using AA allowed me to add an on-off switch and really freed up some space inside, otherwise it was pretty tight.

In all I was pretty satisfied with the design.

The graph below shows one week's worth of averaged data. The batteries started to die on day seven. I could have improved battery life by running the LED at a lower duty cycle at about 1kHz and I wouldn't have lost any edges due to the comparatively low the angular velocity of the rotor.


Have fun! Let me know if you see any room for improvement!

Step 11: Source Code

Attached is a single Arduino source file. I GPL'd it because, hey, GPL.

EDIT: I'd like to point out that my implementation of using a 1s delay() is a terrible idea! The amount of time required to write to the flash and read the sensor may seem small, but over the course of 7-10s it adds up to some significant drift. Instead, use 1Hz timer interrupt (Timer #1 on the 328P can be calibrated to 1Hz perfectly). To be safe you should code in a fence in case the page write & sensor read for some reason takes longer than 1 second (handle dropped samples), but a timer interrupt is THE way to do stuff that needs to be, well, time-accurate. Cheers!

Comments

RomanS63 (author)2017-10-08

very cool!. How did you drill 1 1/2" hole for the PVC pipe coupler so cleanly?

BikerRay (author)2017-08-31

I made one some years ago; still working. For cups I used split fishing floats. The bearings are from an old hard drive. IR optical sensor going to an Arduino on an old laptop running VB6 plotting program. Sample plot: https://www.dropbox.com/s/kghsegnbp0wbsbh/Plot.bmp?dl=0

cheekygeek (author)2017-02-14

This is terrific! I have an unused Vector Instruments A100LM anemometer that I would like to turn into a wind speed logger on a mobile mesonet (my car). Info here (if it lets me add links): http://www.windspeed.co.uk/ws/index.php?option=displaypage&op=page&Itemid=52 Would I be able to make this work with your homebrew data logger? Thanks for any reply!

ptorelli (author)cheekygeek2017-02-14

Hey that's cool, I want one! It even clearly details the calibration procedures for mapping slopes to windspeed. Very cool.

I couldn't see any schematic info beyond the wiring diagram, so you'll probably have to probe all of the pins and see what kind of output is generated. The spec claims it is a PWM output, but I don't know if the windspeed is encoded as PWM, or if it is sending a waveform that needs to be decode (or if it is just sending a pulse per X-degrees of rotation).

If I were you I'd probe all the pins on a logic analyzer and mount multi-speed hairdryer in front of it, and see how the outputs change. :)

Then you can either use a PWM lib on another GPIO, or just count to rotations using the existing interrupt.

Also note, I recommend using a timer interrupt to record the data instead of my delay() call. I think I mention that in the instructable, as over time the minute amount of time to write the flash leads to accumulated error.

Cheers!

diy_bloke (author)2016-01-02

Looks great. I like yr minimal Atmega board. Just a question (I might have overlooked it), how do you download the data as i dont see any interface. Do you just pull out the memory chip?

ptorelli (author)diy_bloke2016-01-03

yes, i just pull the chip!

diy_bloke (author)ptorelli2016-01-03

tnks :-)

diy_bloke (author)2016-01-02

7) Don' t get caught by the police

wamartin (author)2015-09-25

Can you tell me where I might find a schematic of you optical sensor?

wmartin

ptorelli (author)wamartin2015-09-26

http://www.mouser.com/ds/2/414/OPL530-44000.pdf

ptorelli (author)ptorelli2015-09-26

Unless you meant the above image, which is just an LED in series with a resistor. Power the sensor, and send the sense pin to the Atmega. It's really quite simple.

wamartin (author)ptorelli2015-09-26

Thank you, that helps a lot.

wamartin

agulesin (author)2015-05-26

Nice project, I think I'll be trying it somewhen.

Just a note about the bearings; I don't think the minimal vertical force will be a problem. After all, the main force is rotational, and you're only supporting the weight of the cups and rotor, not really a force AFAIK. Only time will tell!

j.whitson (author)2015-01-14

Easy way to lock down the nylon nuts: fingernail polish. You can use the clear kind for neat appearance, but I tend to use obnoxious neon colors, so that I know where I put it (the same reason Loctite puts opaque blue dye in their product). Nylon is quite nearly a "synthetic protein" (very similar to fingernails, in fact), so it sticks reasonably well, and reduces nut slippage.

kcarlos (author)2014-07-07

sir what arduino board is needed in this project thank you sir :)

ptorelli (author)kcarlos2014-07-08

It seems the website ate my lengthy reply.

I used an ATMega328 in the design because I had a bunch lying around, but you can use any embedded processor that provides three digital I/O pins and interrupts, which is almost all of them larger than an 8-pin DIP! The source code relies on the Arduino IDE's library functions to make the code more compact.

kentek (author)2014-01-18

Greetings,

I am trying to digest your anemometer plan but got lost trying to find source for what you are calling an "Optical Interrupter".

Can you give source as part of your parts list?

kaw

ptorelli (author)kentek2014-01-22

Hi Kaw,

The "optical interrupter" is a fancy word for "plastic cap with black squares painted on it". The plastic cap is hardwood floor protector from Home Depot, you put these on the bottom of chairs so that they slide around easily. I painted it and clued a nut to it, and then screwed it on the threaded rod. Then I aligned the height so that the black squares interrupt the gap between the IR LED and the Optek sensor.

Does that help you?

-Peter

kentek (author)ptorelli2014-01-23

So, they are in stock @ Home Depot? :-)

Love it.

Some days I'm pretty dense.

Thanks. And keep smiling...

kaw

flubbersaurus (author)2013-10-29

Why didn't you use halves of pokéballs?

ptorelli (author)flubbersaurus2013-10-29

Ever tried to get the smell of Charizard out of plastic? Not easy...

Bill_Smith (author)2013-10-26

I found out my problem with the OPL550 it needs at least 5V on Vcc to operate !


thanks for such an inspirational instructable !

ptorelli (author)Bill_Smith2013-10-26

Hello!

I'm glad you figured it out, that OPL is a very useful component, too bad it doesn't come in a 3.3V version or I would have not used 5V at all. (I'm sure there is a similar 3.3V part out there, but sometimes searching Mouser and Digikey gives me a headache.).

Cheers,
Peter

Bill_Smith (author)2013-10-26

Hello, I am trying to use the OPL550 set up like you have done here but I can't seem to get the circuit to work. Is there any ways you could show me how to wire the OPL550 sensor? does it need an external pull up resistor ? Just can't seem to get any output. I have been using 3v for VCC and gnd and I have a 940nm IR diode for the light source.

thanks

diy_bloke (author)2013-10-11

I am officially impressed

Shilinski (author)2013-10-09

Great work. Wish I could just buy one. I am a data junkie too but not great with boards or solder.

hvaldivia (author)2013-10-08

Hey, good work men!!

audreyobscura (author)2013-10-07

Rad! This would have been perfect for the kite contest that just ended!

About This Instructable

46,412views

250favorites

License:

Bio: I'm a 20-year Intel vet with all sorts of design experience, both hardware and software. I enjoy making electronic gadgets, and I'm really ... More »
More by ptorelli:How to String Your Bass Like a CelloArduinolyzer.js: Turn your Arduino into a Logic AnalyzerDesigning with Discrete SPI Flash Memory
Add instructable to: