Measure Wind Speed And Direction Computer Science Essay


In this project, I need to construct a device that can measure the wind speed and the direction of the wind. Firstly the device's sensor will collect the data and send to microcontroller. A microcontroller will be used to compute the data. Finally the output will be display on a LCD in digital form.

Compare to traditional anemometer, it normally need two different type of sensor to measure the wind speed and direction. But in this design, it just need one type of sensor which is hall-effect to measure speed and direction.

The main advantage of using hall-effect sensor is the mechanical construction part will more simple if compare to any other anemometer that use two different type sensor. It also reduced the risk of tear and wear of mechanical problem. The cost to build this type anemometer also will be slightly lower to others since it only need single pair of sensors and simpler mechanical part.


Lady using a tablet
Lady using a tablet


Essay Writers

Lady Using Tablet

Get your grade
or your money back

using our Essay Writing Service!

Essay Writing Service

Weather station is the station that use to measure / observe the weather condition and the climate. Normally the weather station will measure temperature, humidity, wind direction, wind speed, and others. To measure wind speed and direction of speed, it need a wind anemometer to measure the speed and a wind vane to indicate the direction.

There have two type of wind anemometer which is velocity type and pressure type. For velocity type, it consist of cup, windmill, hot-wire, laser doppler, sonic and ping-pong type anemometer. While for the pressure type, it consist plate and tube anemometer. The simplest anemometer was cup type. The first was invented by Dr. John Thomas Romney Robinson in 1846. It have 4 cup which mounts in equal angle to each other cup and fixed on a shaft. When the wind blow the cup, the cup will rotate proportional to the wind. By counting the number of rotation over the time period, it can easily found the average speed of the wind.

Normally to measure wind speed and direction, they both will employ two different set of sensor to measure, eventhough both are fixed in a box. So in this project, it will only need single set of sensor but can measure both speed and direction of wind. The main advantage of this single sensor is it will make the construction simpler than those meter that used two different sensors to measure. It also can reduce tear and wear for the mechanical part.

In wind anemometer, it can employ sensors like optical sensor, reed switch or hall sensor. In this project, it will employ hall sensor because it consume less power and not produce any noise like reed switch.

For direction meter, it can use potentiometer or optical gray encoder. But with hall sensor, it can just use a single wind vane with the wind speed meter and left the mechanical construction more simple and easy to build.


Construct a circuit that has the ability to measure the wind speed and the direction of the speed.

The device has to be easy to use.

Able to display the result in digital form.

To learn more about the sensor and microcontroller


When the wind blown the wind vane, the vane will rotate according to the direction of the wind blown. So, by placing two hall-effect sensors in 90° to each others, it was possible to measure the direction of the wind by reference point of angle to the wind direction. Each sensors will be supply with a sinewave voltage.

At the beginning, it need measure the average value of each sensor for a few turn of the vane. When the wind direction have slightly changes, it also will change the average value of the sensor. By compare the changes of average value to a angle reference table, the microcontroller can determine the direction of wind in term of degree.

The wind speed can be determine by the frequency of the sensor's sinewave voltage. When the wind speed increase, it also will increase the frequency. So, the wind speed is directly proportional to the frequency.

Figure 1: Block Diagram of measure wind speed and direction

Lady using a tablet
Lady using a tablet


Writing Services

Lady Using Tablet

Always on Time

Marked to Standard

Order Now

In this design's block diagram, there will be have two sensors install in 90° to each others. Each of them will connect to a operational amplifier which will act as amplifier to convert the signal from analog to digital type. Then, the digital signal will send to a microcontroller to process. It also have a limiter that act as limit the amount of input been capture to be send to microcontroller. After the microcontroller done the calculation, it will send the data to LCD and the LCD will show the result.

Circuit Diagram

Diagram: Circuit of the Design

Circuit Analysis

In this design, the main component was the microcontroller, PIC16F876, IC1. The two input are used 10-bit Analog to Digital converter and a capture/compare module with one input are used to measure the reference signal.

Two hall-effect sensors, Q2 & Q3 will be connect to a double operational amplifier. The quartz crystal, X1, 16 MHz clock frequency, both side will connect to a small value capacitor 15 pf, C1&C2 before connect to microcontroller. The operational amplifier's signal are adjust to optimal so that the microcontroller can support. To adjust the signal, a oscilloscope has been used. The output have to be in range of 0.5V to 4.5V and the signal have to be without any distortion.

For LCD, the port like R/W, Enable and RS are connect to PIC to drive the LCD. It used 4 datalines (DB0, DB1, DB2 & DB3) rather than 8 datalines because it was operated in 4-bit mode.

The main supply voltage in this design was 9V battery. Since this design only need 5V-DC supply voltage, so it also include a regulator in this circuit to step down the voltage from 9V to 5V. A regulator chip, 7805 and three capacitor were used to step down the voltage.

Bill of Material





Resistor 5.6kΩ



Resistor 10kΩ



Resistor 1kΩ



50kΩ Turn-finger adjust potentiometer



5kΩ Turn-finger adjust potentiometer



Ceramic capacitor 15 pF



Ceramic capacitor 100 nF



Capacitor 100 uF



Capacitor 10 uF



Diode, 1N4148



NPN Transistor, BC547



Low power dual operational amplifier, LM358AN



Microcontroller, PIC16F876



Regulator IC, 7805



Hall-effect sensor, A1301EUA



Crystal, 16 Mhz



LCD, 16X2


Analysis of Design

For the wind speed, this design first will obtain the average period of one revolution of the wind vane. Then with this value, the speed of the wind can be found by the following equation: Speed = factor,K / Period, where the k been set to 35500. This speed factor was obtain by comparing the measure speed and the real speed.

For the wind direction, the hall-effect sensor, each of them will be link with a 72 values reference curve , which is 5 degree difference. So, when the sensor want to measure the direction, it will detect the average value of the wind for a few turn. It will have small changes when compare to the 72 values curve. So with this changes, the microcontroller was able to compute and shown the direction of the wind in degree. The result only can be shown in interval of 5 degree, not the exactly value.

Main Components

Hall-effect sensor

Hall effect sensor was a device that will activate when it detect the present of magnetic field. This sensor will detect the density of magnetic flux around it. When the density of magnetic flux around the sensor was exceed certain level, this will cause the sensor on and produce an output voltage called Hall voltage, VH. The output voltage, VH are direct proportional to the strength of magnetic field.

Figure 3: Diagram of how the hall-effect sensor operate

It was made by a thin rectangular p-type semiconductor material like gallium arsenide (GaAs), indium antimonide (InSb) or indium arsenide (InAs) and have continuous current flow on it. When there have the presence of magnetic field, the magnetic flux will exert force on the material and deflect the material's the charge, electrons and holes to one of the side of the semiconductor slab. Potential difference are produce between two sides of semiconductor by charge carriers. The movement of electrons through the semiconductor also will be affect by the presence of magnetic field. For generating potential difference across the semiconductor, the magnetic flux lines must be 90° perpendicular to flow of current. Normally the hall-effect sensor are in off mode when no presence of magnetic field and in on mode when exist of magnetic field.

Lady using a tablet
Lady using a tablet

This Essay is

a Student's Work

Lady Using Tablet

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Examples of our work

Normally a hall-effect sensor are build with a DC amplifier, logic switching and voltage regulator to improve the output voltage, sensors sensitivity and hysteresis. It also let the sensors can operate over a range of power supply and magnetic field conditions.

The hall-effect sensor have two type of output which is linear or digital. For linear output, the output signal will taken directly from the output of op-amp with the output voltage,VH are directly proportional to the magnetic field passing the device. It was produce continuous output voltage and will affect by the strength of the magnetic field. The output voltage can be increase to a saturate level which are the value of power supply. Further increase of the strength of magnetic field will not increase the output voltage but it will remain in saturate level. For digital output, when the magnetic flux passing through the sensor exceed a certain value, it will change the state of sensor from OFF to ON. The oscillation of output signal's problem that produce when the sensors move in & out of the magnetic field are solved by the sensor's hysteresis. So, the output for a digital are only in two states which is ON or OFF. The hall-effect sensor also can differentiate by bipolar or unipolar.

In this project, the sensor that will be used are unipolar type and the output of the sensor are analog. It need analog output because it need continuous voltage to measure the changes of average value and the frequency to measure the wind direction and the speed. The method of detection in this project will be sideways detection. The magnet are move sideways across the surface of the sensor.

Operational amplifier

Operational amplifier(op-amp) are a device that have almost all the requirement to be ideal DC amplification. It had been used widely to filter signal, mathematical operation (sum, subtract, differentiation, integration) or signal conditioning. It will have 3 terminal which is inverting input, non-inverting input and output. Normally an ideal op-amp must have the characteristic of

High voltage gain,

High input resistance,

Low output resistance,

No current flow at input,

The input voltage must equal with output voltage

An ideal of an op-amp was been labelled as a voltage controlled voltage source. The following diagram was the structure of an ideal op-amp. The output voltage can be found by the gain,A multiple by the input voltage, Vout = A X Vin . Input voltage, Vin was the difference of V2, non- inverting voltage and V1, inverting voltage while the gain, A was the amplification gain of the circuit.

Figure: Structure of ideal op-amp

A op-amp can be used in few different ways such as non-inverting amplifier, inverting amplifier, summing amplifier, differential amplifier, integrator and others. For this project, the inverting amplifier was been use. It has negative voltage gain. It mean that if the input voltage is increase, the output voltage will decrease, or vice versa according to the voltage gain value. In the circuit of inverting amplifier, the input is connect to a resistor, Rin before connect to the op-amp and a feedback resistor, Rf is connect between the output and the input. Non-inverting input are not be use in this type amplifier and just connect to ground. The following diagram was shown the circuit of inverting amplifier.

Diagram: Circuit of Inverting Amplifier

As an ideal op-amp have a very high gain. But in reality, the very high gain will cause the amplifier unstable and difficult to control. So, a feedback resistor, Rf are used to control the gain of the amplifier and make the system stable. This method is know as negative feedback. Negative feedback will send some of the output signal back to the inverting input. This feedback will make the voltage different between inverting input and the output become almost zero and formed a closed loop circuit. This closed loop circuit will change the gain of the amplifier to closed loop gain. This gain then will use the negative feedback control the overall gain accurately and the bandwidth also will be reduced. This closed loop circuit also make the voltage at the inverting input almost same with the non-inverting input although the non-inverting input was connected to ground.

When the negative feedback connect to the inverting input, it will mixed with the input voltage and form a summing point. This will cause the op-amp difficult to identify which is the feedback or input signal. To solve this problem, a resistor,Rin are used to separate the signal.


In this project, I been used MPLAB v8 to write and test the code. This program was created by Microchip, a company that produce microcontroller and was free to user. MPLAB was a integrated development environment program and integrated toolset for the development of embedded application on microcontroller.

Figure 2: Block diagram of program a microcontroller

In MPLAB, it contains text editor, MPASM assembler, PICSTART Plus software and some other functions. For the text editor, it look like a notepad but was a place that can write the code. After finish writing the code, it will save the file in "filename.asm" file extension.

After save the code, the code have to be check whether it have any problem. The assembler in this program is called MPASM. It can either generate absolute code or relocatable code. Relocatable code is the code that can combined with another assembled code by using MPLINK linker. Absolute code is the final code that can executed directly by a microcontroller. In this design, it only used absolute code. The assembler first will compile and check the assembly code for error. If the code was free from error, then the assembler will build a file in "filename.hex" file extension.

To send the hex file to microcontroller, a programmer is needed. The programmer used in this project is called USB ICSP PIC Programmer, UIC00B. It is a low cost and easy to use programmer. It been design to support most of the PIC model like 8bit, 16bit and 32bit mirocontroller. It have ICSP (In Circuit Serial Programming) connector to load program, UART tool and Logic tool. It can load the program on board or UIC-S socket board. No external power was required since it use USB to connect with computer. It aslo can supply 5V voltage to the circuit if program on-board. I was used the programmer with UIC-S socket board because it is more easy to connect if compare to on-board programming. The UIC-S socket board not just only can support 28 pins microcontroller, but it also can support 18 pins and 40 pins.

This type of programmer was come with his own software called PICKIT 2 Programming software. It will need the file that created previously by MPLAB in hex extension file to program the microcontroller. Beside it can program microcontroller, it also can read or erase the code in the microcontroller.


The main disadvantage of this design was it can't show the exactly value of the wind direction. It only can display the result in 5 degree interval. So if the measured direction value was not exactly 5 degree interval, it will round the result to the nearest. ex. 6 degree, it will shown 5 degree. So it was slightly less accurate. This can be solve if it set more values for the reference curve but this will also increase the time from measure to display the result.

Overall the components that need in this design was less therefore it was cheap to build. The usage of the hall effect sensor also reduce the mechanical part and it was free of mechanical problem.