Hey Everyone! I’m a pretty novice programmer here and I’ve been over this code a ton and can’t seen to figure this out… I’ve built a pretty cool weather station installation in my backyard following the code examples from SparkFun here:
Everything seems to be working with exception of this wind gust calculation. It does not seem to be taking only the max gust speed but adding all the stored gusts together. Here is a screen shot from Weather Underground:
You’ll notice the insanely high gust speed… I think Weather Underground is displaying the “windgustmph_10m” variable but I’m not 100% sure on that. Hopefully one of you super smart folks can take a look at my code and let me know where I went wrong?
Here is my code: https://github.com/bmutari/Particle-WeatherStation/blob/master/weather-station.ino
Thanks!
@bmutari, one thing I noticed quickly is that you declared as a byte array though you then store int
values to it:
windspdavg[seconds_2m] = (int)currentSpeed;
@peekay123 thanks, I’ve made the correction, but I don’t think that fixed the wind gust issue.
@bmutari, this was a VERY quick look. I’ll need to dive in more later.
BTW: It would be a good idea to add Serial.print()
statements to track the windspeed values at different spots in your code to see where it’s going wacky against what you expect.
Any chance you could take another look at my code? …please.
1 Like
Debouncing is a most critical issue.
Change the first 10millis ignoring time , to a least a 100millis.
“…void wspeedIRQ()
Activated by the magnet in the anemometer (2 ticks per rotation), attached to input D3
{
if (millis() - lastWindIRQ > 100) // Ignore switch-bounce glitches less than 10ms …”
nikos
Athens Greece.