Is there a mathematician in the house?

russbow

Senior Member
I need some help with basic maths !!!

I have made a 3 cup anemometer, with a reed switch every 45 deg around the circle.
The COUNT command gives me excellent results when the unit rotates. I thus get 8
pulses per rev.

I need to "calibrate" this. I accept the limitations that any calculations are
theoretical and no allowanace is made for losses in the mechanical design. I also
wish to use MPH, not Km per sec / hour.

The radius of the circle 7.25 inches, hence circumference is 45.5 inches.
( Not bad for half a century out of school! )

So, 1 pulse = 45.5 divided by 8 = 5.7 inches

If I count for 1 sec, I think my speed is number of pulses, N, times distance ( 5.7 ), all
divided by time ( 1 sec )

Thus speed = ( N*5.7 )/ 1, inches per sec

There are 63,360 inches to mile, 3600 secs in hour

How do I :-


1. Convert this to MPH

2. Change calculation if I change COUNT time to less than 1 sec

Honestly, this IS a Picaxe question.


The code so far is:-

Code:
' Picaxe 18A
init:
high 7
serout 7,T2400,(254,1,254,1) 'clear screen
 
main:

posn:
readadc 1,b5 ‘ read value into b1
'Returned values 25 48 70 94 120 152 193 253
 

pause 50
 
If b5<30 then
 let b12=$4e:b13=$20  'N_
ElseIf b5 < 55 then
 let b12=$4e:b13=$45  'NE
ElseIf b5 < 80 then
 let b12=$45:b13=$20  'E_
ElseIf b5 < 99 then
 let b12=$53:b13=$45  'SE
ElseIf b5 <130 then
 let b12=$53:b13=$20  'S_
ElseIf b5<160 then
 let b12=$53:b13=$57  'SW
ElseIf b5<200 then
 let b12=$57:b13=$20  'W_
Else
 let b12=$4e:b13=$57  'NW
EndIf
'end of position select


speed:
let w1=0
count 2, 1000, w1 ‘ count pulses in 1 seconds on i/p 2
'end of speed count

temp:
readtemp 0,b8 'read value into b8 from i/p 0
let b8=40	'NOTE dummy value for b8
'end of temp read
 
display:
serout 7,T2400,(254,128,"Wind ",#w1," MPH ") 
serout 7,T2400,(254,192,"Direction ",b12,b13)
serout 7,T2400,(254,148,"Temp ",#b8,$df,"F") 
'end of display
 
goto main
Thanks to forum members for getting me thus far.

Russ
 

Dippy

Moderator
I'm afraid I'm a bit rough on angular velocity, but your 'calibration' assumes your cups are at the same 'speed' as the wind acting upon them and in a linear way - is that likely?

Jeremy should be out of bed soon. He likes knotty puzzles like this.
 

russbow

Senior Member
No Dippy, suspect not, but can accept these losses. Not sure angular velocity is relevant. If it goes round once, then 45.5 inches have passed.

I should be able to do this with a "Grammar School" education but can't find my log tables !!!!!
 

Dippy

Moderator
Oh, what's angular velocity then?
I'll stick to string theory as i can make it up as I go along :)

Come on Jer, I know you're watching...
 

Jeremy Leach

Senior Member
Cheek Dippy ! I'm no mathematician, but yep I do like these problems ...

Russ, I made an anemometer a few years ago (but with fewer reeds). I doubt it's as simple as you're suggesting ....there will be drag from the back of each cup etc, but I guess it's a good starting point! Calibration using car/brave passenger holding out of window, is the method I'd use, then draw graph of counts againt MPH and either create a formula to 'best fit' the graph or use a lookup table !

1 inch per second = 1/63,360 miles per second = 3600/63,360 miles per hour

If you change the count interval, then ...
As you say, speed = ( N*5.7 )/ 1, inches per sec
= ( N*5.7 )/ S, where S is the count interval in seconds.

I haven't looked at your code ;)
 
Last edited:

slurp

Senior Member
Ignoring any losses you might have (friction, wind resitance, etc) and presuming that your cups are on the raduis I would have suggested that you are simply multiplying by 3600 to give inches per hour and dividing by 63360 to make it miles/hour.

This will give the relative speed of a point on the radius, but given the losses, not necessarily the wind speed. It might be easier to calibrate to the Beaufort scale (http://en.wikipedia.org/wiki/Beaufort_scale) over a period of time than actual wind speed unless you have another animometer. The observations described should help you place the wind speed in a suitable band.

Best regards,
Colin

Missed Jeremy's post, I like the method... if you can hold on!
 

BCJKiwi

Senior Member
Yep, if it goes round once then 45.5" of cups have passed but how many inches of wind have passed?

Get the math working for the actual rotations than calibrate it against a known anemometer and apply a factor (or two or three) for different wind speeds.

if there are 63360 inches per mile and 3600 secs / hr
then
1 MPH = 63360/3600 = 17.6 = 176/10 ''/sec.
If the time is halved, the count is halved for the same rotational speed.
 
calibrate

When you get to needing to calibrate, i suggest you do so against a sat nav device. I found that my car at 70mph i was only doing 64mph. Not very impressive speedo. I checked it against a couple of other cars. Im just glad it was on the down side. I could have ended up with loads of tickets.
 

adub

New Member
I need some help with basic maths !!!

I have made a 3 cup anemometer, with a reed switch every 45 deg around the circle.
The COUNT command gives me excellent results when the unit rotates. I thus get 8
pulses per rev.

I need to "calibrate" this. I accept the limitations that any calculations are
theoretical and no allowanace is made for losses in the mechanical design. I also
wish to use MPH, not Km per sec / hour.

The radius of the circle 7.25 inches, hence circumference is 45.5 inches.
( Not bad for half a century out of school! )

So, 1 pulse = 45.5 divided by 8 = 5.7 inches

If I count for 1 sec, I think my speed is number of pulses, N, times distance ( 5.7 ), all
divided by time ( 1 sec )

Thus speed = ( N*5.7 )/ 1, inches per sec

There are 63,360 inches to mile, 3600 secs in hour

How do I :-


1. Convert this to MPH

2. Change calculation if I change COUNT time to less than 1 sec

Honestly, this IS a Picaxe question.
Russ
You have all the numbers you need.

1 mph = ? in/sec is what you want to calculate.

1 mph = 6330 inches / 3600 sec = 17.6 inc/sec

So calculate the inches traveled in 1 sec and divide by 17.6 to get mph. Easy peasey.

If you want to measure for 250 ms the thats 1000ms/250ms = 4 so just take the above answer times 4....

Takes longer to type it than to do it!
 

slurp

Senior Member
When you get to needing to calibrate, i suggest you do so against a sat nav device. I found that my car at 70mph i was only doing 64mph. Not very impressive speedo. I checked it against a couple of other cars. Im just glad it was on the down side. I could have ended up with loads of tickets.
From days when I was working on a kit car... the UK Legal requirements has a tollerance on speedometers of -0 to +10%. Thus never read under the actual speed but may read up to 10% more than actual speed. Thus 64mph is within the specified limits!

As I recall, when you take your car for certification this is one of the specified tests.

regards,
colin
 

Jeremy Leach

Senior Member
Another point ... 8 reeds seems a bit excessive and perhaps has the possibility of errors? :

A reed will need a certain amount of time to open and close, and so at high wind speed you might get to the point where the pulses blur into one.

Also, at really low wind speeds where there are only a few pulses per second, the accuracy of your reed spacing will come into play. I expect it's difficult to get really even spacing - which would give a wobbly result as pulses from different reeds are measured.

For this reason I only used one reed on my anemometer. Ok, there is then the danger of the count command timing out at very low wind speeds - but I think you could detect this time out in code and account for it.

Just my thoughts though, and if you've already made it then I wouldn't alter what you've got.

I'm also interested to know how you made your cups etc.
 

BeanieBots

Moderator
Forget the maths. It's a waste of time unless you know and take into account the two (forward & reverse) drag coefficients of your cups how it vaires with the incident angle to the wind. It quite simply does not work the way you think it does. It's not even close.

Unless your cups have been analysed in a wind-tunnel and you know the drag at every angle for every wind speed, you won't be able to calculate.

As mentioned above, the only option is calibration against a known wind velocity. Either using Jermy's suggestion of moving at a known velocity in still air or against a calibrated anenometer.
 

boriz

Senior Member
This is what I’d prolly do:

Set up your bicycle speedo accurately (chalk mark on wheel, mark the road ten wheel revs while sitting on bike, measure and divide by ten)

Fix the anemometer to the handlebars and on a reasonably still day, and a straight flat road, measure RPM at two speeds (say 5 mph and 20 mph), then again immediately on the same road in the opposite direction at both speeds. Average the two direction readings to eliminate ambient wind effects.

The two speeds (5 and 20) should give you a straight-line graph of RPM to wind speed.

EG:


From this you can derive a simple factor that will convert RPM into MPH or vice versa. In this simplified demo, the factor would be MPH = RPM / 10.

The true relationship might not actually be a straight line, but it will be close enough I expect.
 

BeanieBots

Moderator
Good tip Boriz.
Might be worth doing a few other speeds just to prove/disprove the linear relationship and/or any repeatability issues.
Better to have a good data set and KNOW the accuracy/spread of your system than to discover two years later that it was all miles out and non-linear and none of your measurements mean anything.
 

russbow

Senior Member
Thanks for all your input chaps. The project is for a bit of fun, and to learn about the Picaxe. I accept all inaccuracies.

Cost so far? Nil. Reeds "liberated from the local TXE 2 exchange 35 years ago.
Chose 8 reeds because the original direction vane was no good. Can always take some out. Bearing from a dead HDD, minus field coils. Spacers scrap 4mm acrylic turned up. Cups from wife's detergent bottles. Case is a CD "cake" tin. Did buy the picaxe though.

Shall go with the theoretical calibration first. Then compare with the rolling car, though I expect different inaccurcies there - slipstreams / vortices.

Whatever the results, better than looking out the window and saying "bit blowy out there"

Some pics attached
 

Attachments

BeanieBots

Moderator
Shall go with the theoretical calibration first. Then compare with the rolling car, though I expect different inaccurcies there - slipstreams / vortices.
Don't want to labour the point too much because you'll find out soon enough.
You are assuming the angular velociy will be equal to to air speed.
It won't.
Consider your cup design. (OK, it wasn't designed as such..).
Consider a simple flat disc. It wouldn't even spin in a hurricane.
A "cup" is somewhere (about halfway) between a disc and fictitious ideal which has no resistance in one direction and 100% resistance the other way.
To add to the fun (of calculating it), consider what happens when the "cup" is side on to the wind. Which way do you think the forces act? It's not obvious until you consider aerofoils and 'lift'. It actually helps to spin the 'correct' way.(air is faster hence less pressure on curved side) In fact, the aerofoil force can (depending on cup shape) be larger than the difference in force between facing and non-facing cup forces.

Anyway, you'll find all that out when you calibrate against a known wind speed.
 

Dippy

Moderator
Oooh, I got told off for saying 'angular velocity'. See post #2.

Stick it on a five foot stick, poke it out yer sunroof, get someone to take notes and get driving.
 

slurp

Senior Member
Stick it on a five foot stick, poke it out yer sunroof, get someone to take notes and get driving.
Better still there's another picaxe project to read your cars speed and automatically calibrate agains't windspeed.... working off a GPS rather than tinkering with the car and getting a more accurate calibration while your at it ;o)

regards,
colin
 

boriz

Senior Member
I also recommend you disconnect all but one reed and use two magnets, one 180deg from the other, for better balance and two pulses per rev.

(I don't think you'll have much joy trying to calibrate at 5 MPH in a car)
 

manuka

Senior Member
Park those log tables & slide rule -number crunching alone is not enough for an anenometer, as they need calibrating against a known good standard (pitot tube/hot wire/ car + GPS etc). Due to turbulence & friction the spinning cups of course rotate somewhat slower than you may calculate. Stan
 

russbow

Senior Member
I was interested in a recent thread about anemometer efficiency. I havn't got to the "moving car" calibration yet, but will report back when I do.

The code so far is as follows, I am grateful to forum members for the improvements suggested so far.

Code:
' Picaxe 18A

main:

posn:
readadc 1,b5 ‘ read value into b5
'Returned values 25 48 70 94 120 152 193 253
 

pause 50
 let b5=95
If b5<30 then
 let b12=$4e:b13=$20  'N_
ElseIf b5 < 55 then
 let b12=$4e:b13=$45  'NE
ElseIf b5 < 80 then
 let b12=$45:b13=$20  'E_
ElseIf b5 < 99 then
 let b12=$53:b13=$45  'SE
ElseIf b5 <130 then
 let b12=$53:b13=$20  'S_
ElseIf b5<160 then
 let b12=$53:b13=$57  'SW
ElseIf b5<200 then
 let b12=$57:b13=$20  'W_
Else
 let b12=$4e:b13=$57  'NW
EndIf
'end of position select


speed:
let w1=0
count 2, 1000, w1 ‘ count pulses in 1 seconds on i/p 2
'end of speed count
let w1=300	'dummy for testing

temp:
readtemp 0,b8 'read value into b8 from i/p 0
'end of temp read
let b8=40	'dummy for testing
 
SerOut 4, T600, ("UU")
Pause 10
SerOut 4, T600, ("XY", b8,b12,b13,w1 )
sleep 15
goto main
My problem now is how to display a minus temperature. I am using the sensor from rev-ed, and I understand that bit 7 is set if reading is below zero. I have looked at this, from I think Manuka's excellent gizmo, and have got nowhere.
Code:
negtemps:'DS18B'subzero negative temps routine + flashing -ve alert
for b3 = 1 to 2:pins=%10000000:pause 200:pins=%00000000:pause 200:next b3
b0 = b0 - 127:return		 'b0 now correctly able to show subzero temps
Of course, I dont need the flashing bit.

Seems I need to detect bit 7 set and enable a variable that will be sent in the serout line. I can then crunch this variable at "base" to display a negative sign.

Can't quite get my mind round the process. Any suggestions?

Thanks, Russ
 

hippy

Ex-Staff (retired)
My problem now is how to display a minus temperature. I am using the sensor from rev-ed, and I understand that bit 7 is set if reading is below zero. I have looked at this, from I think Manuka's excellent gizmo, and have got nowhere.
How exactly do you want to 'display' the temperature ? From your ...

SerOut 4, T600, ("XY", b8,b12,b13,w1 )

You seem to be sending a mix of variables which contain ASCII characters and raw binary values ( note w1 will only have its lsb's sent as an 8-bit byte ). From the earlier "UU" being sent it looks like this is output to be sent via a radio transmitter and it's not clear where you want to do the conversion of temperature, before sending or after receiving.
 

eclectic

Moderator
Ruus.

Have a look at Manual 2 for more ideas.

Code:
;Modified from Manual 2
;page 155

main:
readtemp 1,b1 ‘ read value into b1
if b1 > 127 then negative ; test for negative
serout 7,N2400,(#b1) ; transmit value to serial LCD
goto main

negative:
let b1 = b1 - 128 ‘ adjust neg value
serout 7,N2400,("-") ‘ transmit negative symbol
serout 7,N2400,(#b1) ‘ transmit value to serial LCD
goto main
e
 

russbow

Senior Member
Thank you both for the replies.

Hippy, don't know why I used a word variable initially. I will do the maths within this routine when I have I have ""calibrated"" it!

You are right, RF link to the house. Most impressed with the modules. ten quid a pair from Maplin. Listening on my scanner, there is a lot of crud on 433mhz. The "UU" and "XY" certainly prevents operation to unwanted data.

E.C. Smashing thanks. Now understand. Presumably I can sent the raw variable via the RF link, and do the conversion at "base". Seems easier for any LCD manipulation.
 
Top