Shop OBEX P1 Docs P2 Docs Learn Events
Question about computing windspeed using... — Parallax Forums

Question about computing windspeed using...

denodeno Posts: 242
edited 2007-07-22 00:30 in BASIC Stamp
Fascinating Electronics anemometer cups (that they sell this in kit form) and the BS2.· By the way, this is a nice simple design, mechanically.·

The data that comes with the cups gives a formula for computing the wind speed in MPH.· I am calculating a windspeed alright, but it appears to be about double of actual windspeed.· I am testing for windspeed· by driving down a "deserted" road and watching the speedometer on the car, and the readout on the LCD.·

Now,the formula given on the data sheet is:
················· MPH = OFFSET + (SCALE * COUNTS/TIME)
··················OFFSET = 1.758· 'given on data sheet..donot know how derived
···················SCALE = 2.121·· 'given on data sheet..donot know how derived
First question that comes to my mind, is the COUNTS / TIME.· There is 2 magnets in the rotating cup housing, that pass over the microswitch.· This, produces 2 counts per revolution (2 high pulses), not one.· Could this be where I am almost doubling the windspeed as compaired to the cars speedometer.· The TIME is set to 2 seconds, and the duration of my COUNT command is 2000 (units of duration for BS2 is 1 msec which equals 2 seconds).

It was suggested by the supplier of the anemometer cups to measure the length of a pulse to determine windspeed, but at slow windspeeds, the PULSIN command times out. (max pulse width for BS2 = 131msecs).

Has anyone written any code for the above anemometer from Fascinating Electronics, and do you think I should divide the above COUNTS command because of 2 magnets passing the pickup head. Why doesn't this 2 pulse per revolution show up on the data sheet formula...or am I just missing something here?

Thanks to all...

deno
·

Comments

  • JonathanJonathan Posts: 1,023
    edited 2007-07-20 18:24
    I haven't used the sensor you are talking about. However, it seems that it is intended to output a pulse length as apposed to a number of counts per revolution.

    From what you say, I would guess that yes indeed you need to divide by 2. I took and old wind sensor and did what you have done to test it's speed. One thing I found was I needed to raise the sensor well above the car to get accurate readings. The disturbance cuased by the car was messing with the readings. Also, make sure its is completely calm when you calibrate, so the wind isn't adding or subtracting from your readings.

    I suppose you also might try a scheme where if the PULSIN command times out, you imediatly issue another PULSIN comaand. Then add the two readings together, minus the small amount of time it takes to issue the command. However, I dont see why reading the number of pulses wont work. It might not have quite as good resolution, but the accuracy should be just as good.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-07-20 18:29
    I'd expect the fact that there are two magnets to be already accounted for in the scale factor of 2.121. How about contact bounce? I'd use a pullup resistor of about 10k in parallel with around 0.1 uF, and a 100 ohm resistor out to the reed switch, and a 220 ohm protection resistor to the stamp pin.

    If you count for 2121 milliseconds, the reading should (apart from the offset) come out directly in mph:
    COUNT 0, 2121, mph

    I'm suspicious of the offset factor. There are two offset factors to consider in wind cups. One is the starting threshold, due to the static friction. The other is the formula offset, which you would get from extrapolating the readings you get at higher speeds back through zero. That formula offset is almost always less than the starting threshold, especially in cups with good ball bearings like the Fascinating unit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • denodeno Posts: 242
    edited 2007-07-20 23:35
    I made a mistake when I posted the above formula.· It should be this....
    ·MPH = OFFSET + (SCALE * COUNTS/TIME)
    ··················SCALE = 1.758· 'given on data sheet..donot know how derived
    ··················OFFSET = 2.121·· 'given on data sheet..donot know how derived
    I accidently reversed the SCALE and the OFFSET numbers.

    I should think that the·SCALE would be divided into the·COUNTS to take into account 2 rotating magnets, thus producing 2 pulses per rev?

    Anyway, driving around looking like a storm chaser, I have come close to the indicated speed on the speedometer by dividing the counts per unit of time, first,·by 2 then using the above formula.· Does anyone have a further thoughts on this, or does anyone have one of these anemometers from Fascinating Electronics that they have used with a Stamp?· Again, I think the anemometer is well made, it is just a question of getting the numbers right.

    Thanks again to all readers...

    Deno

    PS...Tracy, I did have all the components in place that you mentioned in your post, but had to remove the .1ufd, as it was causing a clicking sound in the speaker that I have hooked to a LM386 which inturn is connected to the stamp for a FREQOUT tone for a "high gust" alert.· I am assuming this was the discharging of the .1 getting back into the power supply?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-07-21 02:23
    Well, I don't know why the 0.1uf would cause a clicking sound in the speaker. It shouldn't (red flag!!). In my experience, debounce is very important when dealing with reed switches and the Stamp COUNT command. The Stamp very efficiently counts multiple bounces as the switch opens and closes.

    Matt Parnell, who used to be very active on these fora, had a project he called the weatherstamp, using the Fascinating parts. He does not seem to be active in that area now, but his project and Stamp code are still to be found on the Wayback machine...
    web.archive.org/web/20030208043443/http://www.weatherstamp.com/

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • FranklinFranklin Posts: 4,747
    edited 2007-07-21 03:06
    If you count for two seconds you would use (1.758 * counts/2) + 2.121 or you could count for 1.758 seconds and then use counts + 2.121 At slow speeds this introduces an error but as the speed climbs the error deminishes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • denodeno Posts: 242
    edited 2007-07-21 18:36
    Tracy...it is interesting that the removal or addition· of the .1ufd across the 10K to the 5 volts will reduce the count of pulses by about 1/2 respectively.· Looking at the scope, I can see no difference in the waveform.· I set the windspeed up with a fan blowing on the cups, and regulated the airflow to produce a 50 msec pulse.· No change in the pulse duration with or without the .1ufd, however, the Stamp itself must be seeing something different, as the windspeed drops by about 1/2 as well.

    Are these bounces without the .1ufd so short that the scope will not see them, but the stamp does.· Maybe I have asked and answered my own question, as the scope is set up to see a 50 msec pulse, and the bounch pulses are much faster??

    Anyway, I think I am reasonably close on the windspeed now, using the formula that came with the data sheet...listed above.· Thanks for everyones expertise...

    Deno
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-07-21 22:18
    I'm gonna go out on a limb and guess that that clicking sound is coming from the FREQOUT command being nested in a·FOR NEXT·or a DO LOOP.· That's common.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • denodeno Posts: 242
    edited 2007-07-22 00:30
    Yes, it is comming from the FREQOUT pin, thru a LM386, which is set at the mimimun gain (minimun component count). However, the FREQOUT command·is not in a FOR/NEXT or DO/LOOP routine.· The clicking sound is being caused by the reed switch in the anemometer, because, when I stop the anemometer from spinning, the clicking (very faint) stops.· There is no clicking at all when I remove the .1ufd which is in parallel with the 10K pullup resistor to 5 volts and the anemometer is spinning.

    I suspect, that the problem (a small problem) is being caused by one of two things:· Thru the 5 volt power supply (even though I have proper filtering on the 7805) or because I managed to run the anemometer trace and the LM386 input trace right next to each other on the PCB, not knowing this would happen.

    Thanks again for the input....deno

    ·
Sign In or Register to comment.