This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Wind speed sensor question

I am using the C51 compiler and have code for the silabs C8051F120.

I have built a wind speed sensor with a rotary encoder but it seems to top out at 42mph. I know there have been gusts greater than that since I started using it.

I have considered calibrating the unit with an automobile and think i may be missing edges of the encoder signal because of processing overhead. I think the encoder counter routine should be interrupt driven.

My coworker Frisky suggested the circuitry is not able to handle fast counting signals coming from sensor and said that the 2nd problem circuitry should be analyzed.

Does anyone have an idea why that might happen?

Parents
  • So instead of counting # of pulses within a time interval, you are trying to integrate the average voltage, i.e. the quota between pulse high and pulse low.

    Any reason for this - in my view - more comples job? Note that every interrupt will loose you some time in your polling loop, thereby reducing the precision. Also, your counter are not guaranteeed to be able to take any value between 0 and "100%". The span are greatly affected by the pulse length, i.e. if the pulse length is fixed or is proportional to the pulse frequency.

    If you use interrupts - or a timer/counter - you must guarantee that the pulses are bounce-free.

    Another thing. You are counting # of samples at one level. The number of loop interations is an integer, so the number of high or low detections must also be integers. It isn't until you perform the division that you have to switch to floating point, or to perform fixed-point arithmetic.

Reply
  • So instead of counting # of pulses within a time interval, you are trying to integrate the average voltage, i.e. the quota between pulse high and pulse low.

    Any reason for this - in my view - more comples job? Note that every interrupt will loose you some time in your polling loop, thereby reducing the precision. Also, your counter are not guaranteeed to be able to take any value between 0 and "100%". The span are greatly affected by the pulse length, i.e. if the pulse length is fixed or is proportional to the pulse frequency.

    If you use interrupts - or a timer/counter - you must guarantee that the pulses are bounce-free.

    Another thing. You are counting # of samples at one level. The number of loop interations is an integer, so the number of high or low detections must also be integers. It isn't until you perform the division that you have to switch to floating point, or to perform fixed-point arithmetic.

Children