This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write my own wind sensor code
#4
Thanks both for your comments!

@seandepagnier The deadband is aligned forward, so that part is ok. Also i won't definetly be saling at less than 20º AWA, so that's ok too. It's just annoying to see the wind indicator showing random number when hoisting a the sail, for example. But indeed not a bit deal. The whole question was more about understanding the "whys" and learning the "hows" of this issue, as it must be something frequent.

@sailoog. My first test was with the ESP32 builtin ADC. Indeed the noise was so heavy that even with a fixed windvane I could get readings oscillating a 10% of the whole range. That's why I went for the ADS1115, where readings are very stable.

I've tried the 20KΩ resistor. It did a good job, i didn't know that! I tried to add a second 20KΩ resistor, the readings were even better. So i put a 100KΩ. Is this too much? Can I break anything?

The current algorithm does this:

1) Read ADC every 10ms -> something between 0-17500
2) Divide the reading by 32 (I don't think I need that much precision, so this already smooth the readings). -> something between 0-822
3) Filter out anything above 812 (360º corresponds to that reading) -> something between 0-812
4) Compare the value with the last reading and discard it if it's too far from previous reading
5) Get the average of the last 10 readings -> something between 0-822
6) Store the value
-- The rest happens somewhere else when using SensESP

I still have to test a couple of things, but I think the 100k resistor did the trick.

Thanks again!
Reply


Messages In This Thread
Write my own wind sensor code - by MigGat - 2022-03-05, 09:48 AM
RE: Write my own wind sensor code - by Sailoog - 2022-03-06, 10:49 PM
RE: Write my own wind sensor code - by MigGat - 2022-03-07, 05:51 PM
RE: Write my own wind sensor code - by Sailoog - 2022-03-07, 08:08 PM
RE: Write my own wind sensor code - by MigGat - 2022-03-08, 05:35 PM
RE: Write my own wind sensor code - by MigGat - 2023-06-27, 06:48 AM
RE: Write my own wind sensor code - by ddelorme - 2023-10-06, 09:20 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)