Hi
I have a 6410 davis equipement with DIY ESP Home weather station.
My question is about the compute of wind direction with the internal 20k pots.
Is my formula is correct and linear value too ? I read the ADC is bad at the bottom and up the 0 and 3.3V.
# Girouette - Direction du vent - Wind Direction
- platform: adc
id: source_sensor
pin: GPIO34
attenuation: 11db # to mesure 3.3V
#internal: true
unit_of_measurement: '°'
name: 'Vent Direction'
update_interval: 1s # avant 5 secondes... On passe à 1 pour test
accuracy_decimals: 0
filters:
- multiply: 0.846153 # 3.9 -> 3.3V
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.1 -> 0
- 3.2 -> 360
- offset: 90 # set offset for physical calibration of the arm of anemometer. Si arm on North (0°) offset should be 0.
- lambda: |-
// Modify offset to not going up than 360°
if (x >= 360) {
return (x - 360.0);
}
else
return x;
on_value:
- if:
condition:
sensor.in_range:
id: source_sensor
above: 348.75
below: 11.25
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "N"
Thanks. Yes I know
But my interogation is about the ADC input of the ESP32 which is so quiet bad between 0 and 0.1V and 3.2 and 3.3V.
So the pots souhld change tension between 0 and 3.3V…
Hello I have been using the Davis 6410 for about 12 months with ESP32 (originally ESP8266)
It has been calibrated against two marine shipping weather stations which are within 1 km of my coastal house.
The ESP32 is indeed not linear (and if you google you will find specific data on this); however for a wind vane which swings by around 10 - 20 degrees, you will never notice it. What is more important is the location of the vane/ wind cups. I urge you to read the Davis manual on placement. My direction matches both of the professional stations.
The ESP32 breaks down ADC into 4095 increments; I use the raw data and convert that into direction. I then created a template which gives a cardinal. This all works perfectly for me.
Hi again
Thanks to your response
I think it’s a great idea to mask voltage and then use raw data. This is quite good now.
Yes and ok for the non linear and ends limit (for north direction only).
So just for information in my case, I use offset because the arm can’t be installed to north.
I’m using a lambda to correct the exceeding of 360°.
Here’s my code inspired of yours.
Too my sensor is a bit much reactive as yours but I have an other template with 10 min throttle average
Thanks a lot for your help
Hello yes … that is a very unusual wind direction for me! I am on the South Coast England with Atlantic depressions bringing in regular SW winds. (what3words: prosper.sued.snowballs) We have no mountains around!
My vane was installed with a compass but 8m high it was quite tricky. Even if it is correct, I have set an offset to keep my wind direction in line with the harbour weather station. We are all windsurfers …
I am not sure you need the lambda because the reading will never be above 4095, which maps to 360 anyway. HOWEVER, I am aware that 4095 will correspond to the 3.3v; it might be that the vane never receives 3.3v and so therefore the sensor never gets to 4095/360 degrees. I had this on my to do list; i will short the pins and see what voltage/ increment I get. This number then becomes the linear mapping number for 360. Also I have a suspicion that somewhere it is possible to recalibrate the linear mapping for ESP32. If you want to get super accurate
Yes but if you look about my last code, after the reading of the adc esp (between 0 to 4095), whichvis convert with filter linear value, i add an offset. So in this case my direction can be over 360.
My offset is my position of the arm of anemometer wich is Est and not north
Hi Julian
Your Text Sensor and Cardinal Wind Direction Lambda solution are fantastic!
Exactly what I needed to make a little more sense of the readings from my Ultrasonic Wind Direction Sensor which outputs 0-360°.
Thanks very much for posting this and I would highly recommend it to others here as well.