Anemometer Pulse Counting Dilemma

Dear all,

I have a cheap plastic 3-cup anemometer from Maplin that I'd like to 'calibrate' somewhat, as I reckon it won't have a linear response. Now, Sparkfun sell kit that looks identical to Maplin's only they're a bit more generous with information these days! Their kit here states that a full revolution equates to a wind-speed of nearly 1.5 mph.

Inside the one I have it's simply a magnetic reed switch and a basic magnet.

So, for most of the time I'm only going to be getting an 'imperial handful' of pulses per second. If it gets up to 50 then it's a storm! We plan to compare wind speeds with a digital hand-held anemometer to get calibration-ish data. The goal is to stick a couple in the garden to measure the wind speeds over several weeks / months, before building a tiny wind-turbine!

My main query is wondering whether to count pulses per second, or the period between pulses, with suitable de-bounce code for the reed switch.

(Or the third option; use optical or hall-effect electronics. In reality though, I'm not looking for scientific measurements and I could buy something already calibrated for around £50 that's more robust. I think this thing will disintegrate if I try to change its innards!!)

I've read through many posts about rpm counters, pulse counters, speedometers etc. but I'm still undecided on measuring duration between pulses or pulses per duration. I'd just like some guidance and thoughts please, especially if there's something else I've not considered..?

Thanks as always,
Craig & Family (and next door neighbour whom also fancies building a wind-turbine!)
 

techElder

Well-known member
So, assuming there is some wind accumulation criteria that will make or break this project, what would that criteria be?
 

Jeremy Harris

Senior Member
I calibrated an anemometer by sticking it on top of the car, fixed to a short pole on the roof rack. At the time I had access to an airfield, out of hours, so could drive up and down the runway, averaging the GPS measured speed in both directions. Mine was pretty linear, so after a bit of playing around I ended up just doing a three point calibration, at 10, 20 and 30 mph.

If you can find a bit of straight, quiet, road, that's pretty flat and without trees around, then you may well be able to do something similar. It helps a lot to have a passenger noting down the indicated wind speed and the GPS speed. Doing the run in two opposite directions cancels out most of the wind-induced variation. It should be possible to knock up a Picaxe system to both log the GPS data and the wind speed data, allowing some averaging and number-crunching back home.
 

hippy

Technical Support
Staff member
My main query is wondering whether to count pulses per second, or the period between pulses, with suitable de-bounce code for the reed switch.
My feeling is that it's better to time the period of the pulse or between the pulses as that gives an instantaneous reading as soon as the timing completes. That's likely to be most responsive with the highest resolution and best accuracy.

You may be able to get by with PULSIN and various system clock speeds to cater for a range of wind speeds but, if not, the PICAXE 28X2 has an on-chip gated timer which should be configurable to give highly accurate timing between pulses. The M2's also have that but you may have to battle against the firmware using that timer for 'time' control.

First step would probably be determining what range of wind speeds you are likely to see and how many pulses per second those would generate.
 

AllyCat

Senior Member
Hi,

I think you will find that the anemometers sold under the "Maplin" and "Sparkfun" brand names are identical, manufactured by a Chinese company named "Fine Offset". They contain a simple magnetic reed switch which closes twice per revolution. The FO Transmitter counts the number of pulses in two seconds (for the "gust" value) and 48 seconds for the "average", so their Console (LCD display) shows the speed (resolution) in steps of 0.7 mph (or strictly 0.75).

Cup anemometers are normally considered to be quite linear, but the absolute calibration of the FO is questionable. One problem is that strictly the windspeed should be measured at a height of 10 metres above an "open field", which is almost impossible for most amateur stations. The best information I've found suggests that the FO anemometer over-reads by perhaps +20% which may well compensate for the reduced height and wind-obstructions that are likely to occur with almost any non-professional station. There's more information on this forum but I can't find their thread reference to +20% over-reading.

In principle, you could measure either the pulse-period or the number of pulses in a fixed time. But normally even a "gust" should be averaged over a few seconds (I believe the Met Office use 3 seconds) and for slow speeds you need to consider that the PULSIN timeout of a PICaxe is typically only 0.6 second. Note also that the waveform from the FO is nearer a "square wave" than sharp "pulse" so you need to measure both + and - polarities with PULSIN (which cannot be consecutive) and sum them for a nominal period.

Cheers, Alan.

PS: BTW, don't have any thoughts of getting a worthwhile amount of energy from a wind turbine in an urban environment. :(
 
Last edited:
Ha haa Jeremy!

That's very close to my initial idea (although I no longer live beside an airfield, and that one was quite active anyway :eek:) but my neighbour suggested using his leaf-blower instead!

Probably better than driving up and down the M1 or A57 hanging out of the window :)
 
Hi Alan,

Thanks for the info.
I couldn't imagine those devices not coming out of the same factory in China!
Turns out there are two marker-pen marks on mine from when I first bought it and probed it with the multi-meter, just like you have suggested, thanks.

My location in a suburb of Sheffield is far from ideal for a wind-turbine which is the main motivation for this: to measure the wind in our gardens, rather than the local area. It's all just for fun anyway and I haven't used a PICaxe in anything for a while ;)

'Roughly linear' is good enough for this purpose, and what you say about the averaging has answered the question for me, thank-you!! :cool:
 
Hi Hippy,

From the info @AllyCat provided, it looks like I'd be better counting the pulses over a few seconds. Obviously this won't be as 'nice' in terms of display update rate, but it makes sense. And I'm not doing anything critical!

I'm going to look into the timer on the 28X2 out of curiosity though — thank-you for the help!

Craig.
 

AllyCat

Senior Member
Hi,

Another factor concerning wind speed measurement for energy generation is that (IIRC) the energy produced is proportional to the cube of the windspeed. So anything less than about 7 mph (or probably nearer to 10 mph for the more "friendly" vertical-axis type) is of no real interest, and anything above 30 mph can get positively dangerous (to itself and maybe human safety).

Also, you can use the "Timer1 Gate Control" feature in M2 devices (even an 08M2) to directly measure the period of a single cycle, if you want a highly responsive display.

Cheers, Alan.
 
Hi Alan,

Thanks for this: Just to reassure you, we're looking to generate a few watts to maybe power some LED lights or possibly charge a mobile phone!
I don't know if a VAWT will be feasible due to start-up issues, which is a shame as they can look magnificent.

I don't need up-to-the-second speed readings as I'm just wanting to measure what the average wind-speeds are at the bottom of our gardens. The glittery plastic rainbow windmills my kids have in the garden might be the limit, lol! :D I might only be able to generate enough power to supply the PICaxe which measures how much power I'm generating...

(Incidentally, Penny Hill Wind Farm is a few minutes from where I live, and there's a Hydrogen Windmill where I work! )

Thanks,
Craig.
 

neiltechspec

Senior Member
I used one on those anemometers from Maplins.
Extract from my weather monitor below:


For the Maplin anemometer (reed + single magnet), they claim one pulse per second
is a wind speed of 2.4 Km / hr (1.4913 MPH), so wind = wind *149 /100.

The reed has been replaced with SS411P & 4 magnets for reliability,
this gives the same number of pulses as the standard reed unit.

Code:
windspeed:	;read average windspeed

	pause 500
	serout ip_out,baud,("Windspeed over 5 sec",cr,lf)
	count wsens,1000,wind1	;1st count of pulses in 1 sec
	serout ip_out,baud,("*")
	count wsens,1000,wind2	;2nd count of pulses in 1 sec
	serout ip_out,baud,("  *")
	count wsens,1000,wind3	;3rd count of pulses in 1 sec
	serout ip_out,baud,("  *")
	count wsens,1000,wind4	;4th count of pulses in 1 sec
	serout ip_out,baud,("  *")
	count wsens,1000,wind5	;5th count of pulses in 1 sec
	serout ip_out,baud,("  *")
	pause 1000
	serout ip_out,baud,(cr)
	
	winda = wind1+wind2+wind3+wind4+wind5
	winda = winda *10 /5 *149 /100
		
	bintoascii winda,b3,b4,b5
	
	if b3 = 48 then
	 serout ip_out,baud,("Average:  ",b4,".",b5," Mph",cr,lf,cr,lf)
	endif
	
	if b3 >48 then
	 serout ip_out,baud,("Average:  ",b3,b4,".",b5," Mph",cr,lf,cr,lf)
	endif
	
	return
Neil.
 

westaust55

Moderator
As Alan has previously mentioned, 10 meters above the ground is the standard height for "official" weather station anemometers and wind vanes.

Be aware of your council regulations for erecting structures even just a mast in your back yard.
Here in Australia (western third at least) it can be a task to get a permit these days with new regulations coming into effect since 2016.
I am looking to erect a 6 metre mast for my weather station.
Anything over 3 metres requires a building permit.
I already have council approval for the height, location l, etc, so aesthetically all is good but for anything over 3 metres I need certified Calculations and drawing at a scale of 1:100 with mast and foundation details by a registered structural engineer for a Class 10a structure (masts, etc) and pay a council fee of around $150.
 

neiltechspec

Senior Member
Stick it on the roof of the house (assuming two storey) on a TV aerial pole (with the aerial).
Wont be far off 10m then.
 

westaust55

Moderator
While the roof may sound like a good idea, you need to consider:
1. Need to access occasionally to clean away spiders webs (seemingly a common problem that slows anemometer)
2. Wind turbulence
3. Allowable height above ridge (7ft / 2 metres in my case) - if tooo high how to clean even if one does Climb onto roof.
 
Last edited:
Thanks Westhaus55,

This isn't for meteorological purposes, but the entire guidance behind placement of anemometers is my motivation!

Wind turbines should ideally be located at least 3 times the height of the nearest structure, in horizontal distance. To make it worse, our back gardens slope downwards from the houses!!

So, this is more about local windspeed in a 10 m radius.

Sorry to hear about all the ref tape you have to endure though — oof!

Craig.
 

AllyCat

Senior Member
Hi,

Incidentally, Penny Hill Wind Farm is a few minutes from where I live,
Ah, it's a different ball-game if you can get your wing tips up to a height of 433 feet. That's only 10 feet less than the top of the London Eye. ;)


Code:
	[B]winda = winda *10 /5 *149 /100[/B]
	bintoascii winda,b3,b4,b5
	if b3 = 48 then
	 serout ip_out,baud,("Average:  ",b4,".",b5," Mph",cr,lf,cr,lf)
	endif
	if b3 >48 then
	 serout ip_out,baud,("Average:  ",b3,b4,".",b5," Mph",cr,lf,cr,lf)
	endif
	return
Beware that that formula will overflow at 65.5 mph, probably not encountered very often, but annoying if it does happen. ;)

The following should work to 131 mph and is rather more compact:

Code:
	winda = winda * 149 / 50
	b4 = winda / 10
	b5 = winda // 10
	serout ip_out,baud,("Average:  ",#b4,".",#b5," Mph",cr,lf,cr,lf)
	return
Or you could change the measurement period to 993 ms (or whatever calibration suggests is a suitable figure) and use winda = winda * 3 , with absolutely no risk of a numerical overflow.

Personally, I would adapt the "measuring" part to a simple loop, each pass recording a "gust" speed over a period of 1 - 3 seconds and maintaining "maxumum gust" and "average wind" values. Then devise a "running average", and/or reset the loop and the maximum gust value every 1 - 10 minutes.

Cheers, Alan.
 
Hi,


Ah, it's a different ball-game if you can get your wing tips up to a height of 433 feet. That's only 10 feet less than the top of the London Eye. ;)
Well, I was up by those turbines last week and they were spinning at about 14 rpm. I went on the London Eye once and I reckon it'd be an entirely different attraction at that speed!! :D

Thanks again for the code tips, I'm looking forward using some PICaxe chips again :)

Craig.
 
Hi all,

Thanks again very much for all your help, suggestions and examples!

I opted to use a couple or three of my AXE133Y modules, and I'm waiting for some IP65 enclosures with clear lids to arrive. I plan to 'collect' the outputs from each of these to something else for logging the data (haven't decided yet but I have a nice stock of PICAXEs). This means that we'll be able to see the current wind-speed when we're in the garden, which is nice :D

Here is my arrangement of the examples you guys provided which seems to be working:

Code:
; *******************************
;    Filename:         Windspeed Monitor
;    Date:             2017-04-16
;    File Version:     vii
;    Written by:        Main functions by 'neiltechspec' & 'AllyCat'
;    Function:          Anemometer    
;    Last Revision:     2017-04-17
;    Target PICAXE:     18M2+ with OLED (AXE133Y Module)
; *******************************

#picaxe 18M2

SYMBOL Line1   = 128
SYMBOL Line2   = 192

symbol line_length = 16    ; change to 20 for displays with 20 character lines

symbol spare0     = C.0   ; spare i/o 0
symbol spare1     = C.1   ; spare i/o 1
symbol wsens     = C.2   ; used for reading anemometer pulses
symbol RX        = C.5    ; input (the serial receive pin)
symbol enable     = C.6    ; LCD enable
symbol rs         = C.7    ; LCD RS 
symbol lcddata  = pinsB
symbol winda    = w2
symbol wind1    = w3
symbol wind2    = w4
symbol wind3    = w5
symbol wind4    = w6
symbol wind5    = w7

; :::::::::::::::::::::::::::: Set up the display :::::::

init:

gosub initialise                        ; run subroutine
    
    low rs                                ; command mode
    lcddata = Line1 : pulsout enable,4  ; Move to Line 1
    high rs                             ; Char mode
    B0 = 0
    for B0 = 0 to 15                    ; Loop through 16 iterations
        lookup B0,("   Wind Speed   "), lcddata   ; SHOW FUNCTION!
        pulsout enable,1
            pause 200                   ; 'fancies' it up!
    next
    
        
    low rs                                ; command mode
    lcddata = Line2 : pulsout enable,1  ; Move to Line 2
    high rs                             ; Char mode
    B0 = 0
    for B0 = 0 to 15                    ; Loop through 16 iterations
        lookup B0,("    Monitor     "), lcddata   ; SHOW FUNCTION!
        pulsout enable,1
            pause 200
    next
    
low rs                                  ;cmd
lcddata = Line2 : pulsout enable,1      ;line 2
high rs                                 ;char mode

; :::::::::::::::::::::::::::: Clear Function Line ::::::: 

pause 2500
    low rs : lcddata = Line2 : pulsout enable,1  ; Move to Line 2
    high rs                             ; Character mode
    B0 = 0
    for B0 = 0 to 15                    ; Loop through 20 iterations
        lookup B0,("                "),lcddata   ; Clear the 'intro'!
        pulsout enable,1
        pause 200                       ; create fancy typing effect
    next
    goto main
    

main:    ;read average windspeed

    low rs : lcddata = Line1 : pulsout enable,1 : high rs
    B0 = 0 : for B0 = 0 to 15 : lookup B0,("Windspeed / 5 s "), lcddata 
    pulsout enable,1 : next
    
    count wsens,1000,wind1    ;1st count of pulses in 1 sec
    ;serout ip_out,baud,("*")
    count wsens,1000,wind2    ;2nd count of pulses in 1 sec
    ;serout ip_out,baud,("  *")
    count wsens,1000,wind3    ;3rd count of pulses in 1 sec
    ;serout ip_out,baud,("  *")
    count wsens,1000,wind4    ;4th count of pulses in 1 sec
    ;serout ip_out,baud,("  *")
    count wsens,1000,wind5    ;5th count of pulses in 1 sec
    ;serout ip_out,baud,("  *")
    
    
    winda = wind1+wind2+wind3+wind4+wind5
    winda = winda * 149 / 50
    w12 = winda / 10     ; divide by 10
    b5 = winda // 10    ; remainder of modulo 10
    
    bintoascii w12, b16, b17, b18    ;hundreds, tens, units (WORD!)
    bintoascii b5, b19, b20, b21    ;hundreds, tens, units
    
    low rs : lcddata = Line2 : pulsout enable,1 : high rs
    B0 = 0 : for B0 = 0 to 15 : lookup B0,("Avg: ",b17,b18,".",b21," Mph  "), lcddata 
    pulsout enable,1 : next    
            
    goto main   ; is 'return' better?

    
 ; :::::::::::: power on OLED initialisation sub routine ::::::::::::
    
    initialise:
    
        ; Winstar OLED Module Initialisation
    ; according to WS0010 datasheet (8 bit mode)

    pause 500             ; Power stabilistation = 500ms

    let dirsB = %11111111    ; PortB all outputs for display
    let dirsC = %11000000    ; PortC 6,7 all o/p - C.2 is pulse counter
    
    let pinsB = %00111001 : pulsout enable,1    ; 8 bit, 2 line, 5x8, West_Euro table1
    let pinsB = %00001100 : pulsout enable,1     ; Display on, no cursor, no blink
        
    lcddata = %00000001 : pulsout enable,608    ; Clear display
    
    setfreq m16                                    ; now change to 16Mhz

    let pinsB = %00000010 : pulsout enable,4    ; Return Home
    let pinsB = %00000110 : pulsout enable,4    ; Entry Mode, ID=1, SH=0 don't understand!!
    return
Thanks again!
Craig.
 

AllyCat

Senior Member
Hi,

w12 = winda / 10 ; divide by 10
b5 = winda // 10 ; remainder of modulo 10

bintoascii w12, b16, b17, b18 ;hundreds, tens, units (WORD!)
bintoascii b5, b19, b20, b21 ;hundreds, tens, units
Actually, the first line below should do exactly the same thing, but you might like to follow it with the second line to suppress the "leading zero" (e.g. Avg: 05.0 Mph would become Avg: 5.0 Mph on the LCD).

Code:
bintoascii w12, b17, b18, b21    ; tens, units, decimal   (WORD!)
if b17 = "0" then : b17 = " " : endif
Cheers, Alan.
 
Top