Saturday, April 18, 2009

Using the Anemometer

We are using the Vortex wind sensor from inspeed. This device has two wires and closes the connection once per rotation.

The best way I can think of to use this sensor is to power one wire and read the other wire for pulses. Use any digital pin to read the sensor other then 0 and 1 (rx and tx) because that will keep you from using the usb port.

For counting the pulses I would suggest a hardware interrupt. Anytime the port is triggered it will execute some code you choose. You can keep a counter running and use the time in between pulses to calculate the speed.

This arduino gas meter project uses a similar method.

  1. void setup() {
  2. Serial.begin(9600);
  3. attachInterrupt(0, check, CHANGE); // attach an interrupt (interrupt 0 = digital pin 2)
  4. }

  5. void loop() {
  6. }

  7. void check() {
  8. /*
  9. stop timer
  10. start timer
  11. calculate and output speed
  12. */
  13. }
ill try and get the timer code implemented and tested later

No comments: