-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fine Offset windspeed sensor may produce 4 ticks per revolution, not 2 as you assume. #176
Comments
I've been looking at the code for the wind speed, looking to improve it, and to try and work out why it makes my board fall over some times, and I may have found something. I switched it so that it was only logging the ticks, and found the following:
Sometimes, I suspect when the wind is very low, the anemometer seems to sit and flick the reed switch really fast. I'm rewriting my code so that if ticks(-1) == ticks(0) it will return a wind speed of zero, but this will have implications for how wind speed is measured overall. As above, I'm now wondering if the code that we have counts the switch opening as one change, and it closing as another? If this is the case, can we tell the difference? Is this something that @Gadgetoid or @sjefferson99 know? |
So, looking at the above, I've realised that this line:
would also cause the average wind speed to be incorrect. This would give (3469-2810)/5, when it should give it (3469-2810)/3. I've rewritten my code to remove the duplicates, and it's still working. I'm currently certain that my code isn't giving the correct speeds, so I'm not ready to share it in public yet. |
I'm interested in how you got on with trying to debug wind speed calculations? Digging about, I have found that the max speed recorded was 253mph -> 113.101m/s I am therefore going to make my code look for an average_tick_ms of above 4 I'm also wondering if the tick while statement should ignore ticks where tick is the same time...? |
Fine Offset windspeed sensor may produce 4 ticks per revolution, not 2 as you assume.
It has a cunning magnet placement that operates reed switch twice per rev as discussed in.
https://cumulus.hosiene.co.uk/viewtopic.php?p=35990#p35990
Gina says:- I have now carried out the definitive test. The answer is TWO pulses per revolution. I was wrong. :oops: I hadn't actually done the test carefully enough - I had assumed 1 magnet and 1 reed switch meant 1 pulse per rev.
I think your tick means a state change, i.e low to high or high to low, So one pulse is 2 of your state changes. 2 pulses will be 4 of your state changes.
Your WIND_FACTOR also seems optimistic if it is intended to be the anemometer factor, it should be closer to 0.03. Though your low WIND_FACTOR currently compensates for the factor of 2 error in ticks per rotation as it effectively is 0.0436 (probably too high).
Ideally the anemometer factor should be measured by someone with a known wind.
scaling factor for wind speed in m/s
WIND_FACTOR = 0.0218
Your code in weather.py says:-
work out rotation speed in hz (two ticks per rotation)
rotation_hz = (1000 / average_tick_ms) / 2
The text was updated successfully, but these errors were encountered: