How to Use Analog Wind Direction Sensor with Arduino
Welcome back to million, with only one l youtube channel in this video. We will learn how to use this analog wind direction sensor. This is a chinese wind direction sensor. Sometimes it is really hard to get the data sheet or we can read the data sheet in chinese, so heres the level on the sensor. I dont read chinese, but i think this mean operating voltage or voltage. Input is 12 to 24 volt and this is the output, so the output is 0 to 5 volt, so it got a connector here. Lets just plug the cable into the sensor and turn the connector several times Music. The cables output has three wires as we can guess. It is vcc ground and analog output from the color. We can guess that red for vcc black for ground and yellow is the output so heres. The wiring dagger now just connect the power cables to the 12. To 24 volt power source, i use the 12 volt power source and connect the analog output to the analog input of arduino is the analog0 Music, wow, Music, hmm and dont forget you should connect the ground of power supply to the arduino tool, so they will share The common ground, Music, Music, Music Music, once the wiring is completed now head to arduino ide. We will start by using an example sketch of arduino ide called analog, read serial. The result of this reading is adc, so i will give it the formula to get the voltage by multiplying the adc value by 5 and dividing it by 10, 23 and print the folders to serial.
Now i get the adc and voltage from the sensor. I will try to rotate the sensor and see the reading Music Music. Now we can see that the voltage is changing according to where the sensor hit Music. We can also convert the adc or the voltage value to a direction degree by mapping the value. So i map the adc value from 0 to 1023 to 0 to 360 degrees, Music and then print all the values to the serial monitor Music Music. Wait before we continue the video you can make me really happy by subscribing to this channel and tap the bell. So you wont miss new video from me Music. Now, on the serial monitor, we can also see the direction degree. Music now were able to read the direction from the sensor.