# Wind direction visualization

Hello,
I have an analog wind direction sensor that has an output of 0 - 5 V for 360° representing the position of the arrow from the north pole. Which is actually 5V divided by 8 resistor values giving me the output voltage value for each azimuth.
But those wind sensor azimuth is actually the opposite of the wind flow…

When it has the arrow toward the North [0°] it is meaning that the wind is flowing from the north to the south. So opposite is what is needed to visualize.
Arrow into 45° > meaning the wind going towards 225 ° > SW .

Or how do you visualize that arrow of the wind direction? Because if I will make it the same as the compass then it will be confusing…

Please anyone can you share your solution ?

Like this:

``````  - type: custom:compass-card
header:
title:
value: Wind
indicator_sensors:
- sensor: sensor.ksat_wind_direction
indicator:
type: arrow_inward
value_sensors:
- sensor: sensor.ksat_wind_speed
compass:
north:
show: true
offset: 20
``````

Where the wind is coming from…

1 Like

Use a lambda filter on your sensor to calculate the inverse angle:

``````filters:
- lambda: return (x + 180) % 360;
unit_of_measurement: "degrees"
``````

If you want to display in HA - an example is given above. For display on an attached display there are some examples about - let me know and I’ll point you to one.

I didn´t make research on the problem before i ordered the sensor.
But because resistance is not raising linear to easily calculate the angle because it is changing voltage in steps represents ± 50 - 55°… so i had to correct them by some if conditions to the real comass

``````  - platform: ads1115
multiplexer: 'A3_GND'
gain: 6.144
name: "ADC_3"
id: A3_GND
update_interval: 5s
filters:
- lambda: |-
if( (x * (360.0/5.0)) >= 10.0 &&  (x * (360.0/5.0)) <= 70.0  ) return x = 45;
if( (x * (360.0/5.0)) > 70.0 &&  (x * (360.0/5.0)) <= 120.0  ) return x = 90;
if( (x * (360.0/5.0)) > 120.0 &&  (x * (360.0/5.0)) <= 170.0  ) return x = 135;
if( (x * (360.0/5.0)) > 170.0 &&  (x * (360.0/5.0)) <= 215.0  ) return x = 180;
if( (x * (360.0/5.0)) > 215.0 &&  (x * (360.0/5.0)) <= 262.0  ) return x = 225;
if( (x * (360.0/5.0)) > 262.0 &&  (x * (360.0/5.0)) <= 330.0  ) return x = 270;
if( (x * (360.0/5.0)) > 330.0 &&  (x * (360.0/5.0)) <= 355.0  ) return x = 315;
if(((x * (360.0/5.0)) > 355.0 &&  (x * (360.0/5.0)) <= 360.0) || ((x * (360.0/5.0)) >= 0.0 &&  (x * (360.0/5.0)) <= 10.0)) return x = 0;

``````

I am not a good coder so I am using usually hard invented solution which is possible to do simpler, but it works

And yes I will be glad if you will help me with the visual solution.

Bdw question 2, the best way to store those data into influxdb ? I am planing to make grafana dashboards as my primary source data from the sensors what i am creating now.

When will use something like this:
InfluxDB2 custom component for ESPHome

Can i control for example write temperatures every 10 minutes, and and wind speed every minute ?
Or what is the best metod to store wind related data ? Some avarage / and maximum values every 10 min ?

You don’t have a supervised install? Because if you do influxDB and Grafana are standard add-ons.

No, I have everything like separate docker containers.

After all research, pros, and cons I decided to keep the original approach and visualize that original sensor output. Thank for the compass hint.