Shop OBEX P1 Docs P2 Docs Learn Events
Anemometer/Frequency Counting — Parallax Forums

Anemometer/Frequency Counting

JiggsJiggs Posts: 26
edited 2006-07-10 17:03 in General Discussion
Hi all

I'm trying to use the Javelin to read wind speed data from an old anemometer I found laying around. As the device spins, a small magnet moves past a magnetic switch, thus closing a circuit. This happens once every rotation. Running five volts through it and hooking it up to a frequency counter, I found that speed of about 27mph registers 10Hz. (I verified these readings by using a frequency generator to emulate the anemometer and seeing the result on the original base unit.) As you might imagine, I've tried counting these pulses on the Javelin. I tried using both the count() function and the pulseIn() function. However, because of the low frequency, the Javelin returns very course data. 8.68us units seem to be designed to read much faster pulses. Any suggestions?

PS- I have a BS2sx as well, so if anyone thinks that device would be better suited to this task, let me know.

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
~Jiggs

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-08 22:10
    How do the pulses look like:
    small high(low) period + large low(high) period or is dutycycle about 50% ?

    regards peter
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2006-07-08 22:12
    Jiggs said...
    Hi all

    I'm trying to use the Javelin to read wind speed data from an old anemometer I found laying around. As the device spins, a small magnet moves past a magnetic switch, thus closing a circuit. This happens once every rotation. Running five volts through it and hooking it up to a frequency counter, I found that speed of about 27mph registers 10Hz. (I verified these readings by using a frequency generator to emulate the anemometer and seeing the result on the original base unit.) As you might imagine, I've tried counting these pulses on the Javelin. I tried using both the count() function and the pulseIn() function. However, because of the low frequency, the Javelin returns very course data. 8.68us units seem to be designed to read much faster pulses. Any suggestions?

    PS- I have a BS2sx as well, so if anyone thinks that device would be better suited to this task, let me know.

    Thanks

    Could you measure the frequency at the maximum wind velocity that you would read?
    You might also write a subroutine that looks at an input to see if it's high or low, and match the data to a lookup table.
    You could carefully add some more magnets to decrease trigger interval...
    Also I would count the pulses and take the latest count and subtract the previous count to get a total count per time interval "60 seconds or RPM"..
    Then use this value to calculate the mph wind speed..
    If you look at a 1-wire weather station, they use 2 magnets with a counter chip to do this very thing...

    Bob scool.gif
  • JiggsJiggs Posts: 26
    edited 2006-07-09 05:18
    Peter Verkaik said...
    How do the pulses look like:
    small high(low) period + large low(high) period or is dutycycle about 50% ?

    regards peter
    I think it's a bit of a stretch to call it a duty cycle, but the circuit is closed for about 25% of the anemometer's rotation.
    And just in case it helps, I wired it up with a pullup resistor, so that when the circuit is closed, the input pin goes to 0v. I then used this code:

    while(true) {
          count = CPU.count(32767,CPU.pin15,false);
          System.out.println(count);
          CPU.delay(500);
    }
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~Jiggs
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-09 09:47
    Try this and see the double pulsecount (it counts edges within a timeout period).
    regards peter
  • JiggsJiggs Posts: 26
    edited 2006-07-10 00:34
    Peter,

    static ScaledTimer16 t = new ScaledTimer16(100,1000);
    



    I've never heard of this class, and neither has my compiler. Do I need to load an external class?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~Jiggs
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-10 01:04
  • JiggsJiggs Posts: 26
    edited 2006-07-10 03:53
    OK, I loaded that code, and now I'm getting data at a higher resolution. However, I'm not entirely sure what the code is doing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~Jiggs
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-10 06:05
    The program counts edges within a time interval.
    With the values given, the time interval is 1 second.
    So for your 10 Hz (windspeed 27 mph as you said) you
    should get 20 displayed every time interval.
    20 edges equals 10 pulses (your 10 Hz) because each pulse has two edges.

    regards peter
  • JiggsJiggs Posts: 26
    edited 2006-07-10 17:03
    OK, that's fantastic. I'll play around with this. Thanks for your help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~Jiggs
Sign In or Register to comment.