Microcontroller Based Wind Direction Measurement System

Similar documents
νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

6. HARDWARE PROTOTYPE AND EXPERIMENTAL RESULTS

EEE3410 Microcontroller Applications Department of Electrical Engineering. Lecture 10. Analogue Interfacing. Vocational Training Council, Hong Kong.

IGBT based Multiport Bidirectional DC-DC Converter with Renewable Energy Source

INTERNATIONAL JOURNAL OF ELECTRONICS AND COMMUNICATION ENGINEERING & TECHNOLOGY (IJECET)

Microcontroller Based Electric Expansion Valve Controller for Air Conditioning System

The University of Texas at Arlington Lecture 10 ADC and DAC

International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering. (An ISO 3297: 2007 Certified Organization)

REACTIVE POWER COMPENSATION IN DISTRIBUTION SYSTEM

Design and Fabrication of High Frequency Linear Function Generator with Digital Frequency Counter using MAX038 and a PIC microcontroller

GSM BASED PATIENT MONITORING SYSTEM

Design and Implementation of Microcontroller Based Programmable Power Changeover

CCK Encoding with PIC Based Microcontrollers For The RF Wireless Communications

MICROPROCESSORS A (17.383) Fall Lecture Outline

Embedded systems. Exercise session 1. Introduction and project presentation

GF of 9 THE GADGET FREAK FILES CASE #165. Analog Clock Measures Time in Meters

SUNSTAR 传感与控制 TEL: FAX: Humidity and temperature measurement system using a

I. INTRODUCTION II. LITERATURE REVIEW

Microprocessors A Lab 4 Fall Analog to Digital Conversion Using the PIC16F684 Microcontroller

Modeling, Simulation and Implementation of Speed Control of DC Motor Using PIC 16F877A

Speed Rate Corrected Antenna Azimuth Axis Positioning System

Design & Development of Digital Panel Meter

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester

INTELLIGENCE HOME AUTOMATION SYSTEM USING LDR

DESIGN AND DEVELOPMENT OF A LOW-COST MICROCONTROLLER BASED SINGLE PHASE WATER-PUMP CONTROLLER

Unit level 5 Credit value 15. Introduction. Learning Outcomes

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Testing and Stabilizing Feedback Loops in Today s Power Supplies

Wednesday 7 June 2017 Afternoon Time allowed: 1 hour 30 minutes

PART 1: DESCRIPTION OF THE DIGITAL CONTROL SYSTEM

Fast IC Power Transistor with Thermal Protection

The PmodIA is an impedance analyzer built around the Analog Devices AD bit Impedance Converter Network Analyzer.

Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

Last Time. P and N type semiconductors Diode internals Transistors NPN PNP

Analog I/O. ECE 153B Sensor & Peripheral Interface Design Winter 2016

Embedded Systems. Oscillator and I/O Hardware. Eng. Anis Nazer First Semester

PIC ADC to PWM and Mosfet Low-Side Driver

A Simple Microcontroller-Based 4-20 ma Current Loop Receiver for Sensors with Current Transmitters

INTEGRATED CIRCUITS. AN109 Microprocessor-compatible DACs Dec

Design and Implementation of AT Mega 328 microcontroller based firing control for a tri-phase thyristor control rectifier

Learning Objectives:

Design of a Microcontroller-Based Push-Pull Inverter with Automatic Voltage Regulator

Seminar Report Railway Gate Control 1. INTRODUCTION

Imaging serial interface ROM

SIMULATION OF TRANSFORMER PROTECTION USING MICROCONTROLLER BASED RELAY & MONITORING USING GSM

FRIDAY, 18 MAY 1.00 PM 4.00 PM. Where appropriate, you may use sketches to illustrate your answer.

MAS.836 HOW TO BIAS AN OP-AMP

EEE225: Analogue and Digital Electronics

Figure 1.1 Mechatronic system components (p. 3)

1 Second Time Base From Crystal Oscillator

Electrical, Electronic and Communications Engineering Technology/Technician CIP Task Grid

Implementation of Microcontroller Based Sensing Unit in Transmitter for Wireless Weather Station

A 7ns, 6mA, Single-Supply Comparator Fabricated on Linear s 6GHz Complementary Bipolar Process

SGD 70-A 7 PanelPilotACE Compatible Display

MICROPROCESSORS AND MICROCONTROLLER 1

ANALOG TO DIGITAL CONVERTER

User friendly tobacco barn heat controller for use by upcoming farmers

Design of 1.8V, 72MS/s 12 Bit Pipeline ADC in 0.18µm Technology

b b Fig. 1 Transistor symbols

LM125 Precision Dual Tracking Regulator

CHAPTER 6 IMPLEMENTATION OF FPGA BASED CASCADED MULTILEVEL INVERTER

Appendix 1. Basic Electronics. The PIC Hardware. Using Transistors (Basic Electronics)

9 Feedback and Control

Technical Brief FAQ (FREQUENCLY ASKED QUESTIONS) For further information, please contact Crystal Semiconductor at (512) or 1 (800)

EE ELECTRICAL ENGINEERING AND INSTRUMENTATION

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

High Frequency Mesh Network for Control and Sensor Arrays

Driving LEDs with a PIC Microcontroller Application Note

The Skiidometer. Hardware Description By: Adam Lee ; Etec474; Prof. Morton; WWU

Fan in: The number of inputs of a logic gate can handle.

Specifications.

8-Bit, high-speed, µp-compatible A/D converter with track/hold function ADC0820

The Guitar Chord Learning System

QUASAR PROJECT KIT # /24 HOUR GIANT CLOCK

CHAPTER 7 HARDWARE IMPLEMENTATION

Simulation Of Radar With Ultrasonic Sensors

To Measure Dielectric Constant of Liquid By Using PIC Microcontroller

International Journal of Advance Engineering and Research Development. Wireless Control of Dc Motor Using RF Communication

Contents. Acknowledgments. About the Author

bhi bhi DSP Noise Cancelling Products DSP Noise Cancelling Products NEDSP1061-PCB bhi ltd PO Box 318 Burgess Hill West Sussex RH15 9NR

Analog CMOS Interface Circuits for UMSI Chip of Environmental Monitoring Microsystem

EMBEDDED SYSTEM DESIGN FOR A DIGITAL MULTIMETER USING MOTOROLA HCS12 MICROCONTROLLER

MICROCONTROLLER BASED BOOST PID MUNAJAH BINTI MOHD RUBAEE

CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 8: I/O INTERFACING QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS

University of Jordan School of Engineering Electrical Engineering Department. EE 204 Electrical Engineering Lab

High Efficiency AC Input 12A 12V Laser Driver

An Analog Phase-Locked Loop

OCR Electronics for A2 MOSFETs Variable resistors

DESIGN ANALYSIS AND REALIZATION OF MICROCONTROLLER BASED OVER CURRENT RELAY WITH IDMT CHARACTERISTICS: A PROTEUS SIMULATION

Chapter 2: Your Boe-Bot's Servo Motors

Embedded Systems Lab Lab 7 Stepper Motor Application

DESIGNING A POSITION REGULATOR FOR AN ACTUATOR POWERED BY A CONTINUOUS CURRENT MOTOR USING THE PIC16F73 MICROCONTROLLER

NZQA registered unit standard version 1 Page 1 of 6

SGD 70-A 7 PanelPilotACE Compatible Display

Chlorophyll a/b-chlorophyll a sensor for the Biophysical Oceanographic Sensor Array

Fuel Cell Based Interleaved Boost Converter for High Voltage Applications

Design and Implementation of Economical Power Factor Transducer

Application Note. Low Power DC/DC Converter AN-CM-232

Dedan Kimathi University of technology. Department of Electrical and Electronic Engineering. EEE2406: Instrumentation. Lab 2

Sensor based Automated Irrigation System with IOT

Transcription:

National University of Science and Technolgy NuSpace Institutional Repository Applied Physics http://ir.nust.ac.zw Applied Physics Publications 2016 Microcontroller Based Wind Direction Measurement System Muchono, Blessed ResearchGate GmbH. Muchono, B., Chifamba S., and Kamunda C. (2016). Microcontroller Based Wind Direction Measurement System. Int'l Journal of Computing, Communications & Instrumentation Engg. (IJCCIE) 3. (1): 148-152. http://ir.nust.ac.zw/xmlui/handle/123456789/841 Downloaded from the National University of Science and Technology (NUST), Zimbabwe

Microcontroller Based Wind Direction Measurement System Blessed Muchono 1, Saymore Chifamba 1 and Caspah Kamunda 2 Abstract This paper reports on a microcontroller based wind direction measurement system that displays wind direction in real time. A W200P wind direction sensor manufactured by Vector Instruments Ltd was used to measure the wind direction. The microcode assembler (MCASM) assembly language was used to write the program that was then blown into the peripheral interface controller (PIC) 16F872. The PIC 16F872 processed the wind direction signal from the sensor and displayed the real time azimuth angle, from 0 to 358 o on the seven segment displays, while single LEDs were used as cardinal and primary inter-cardinal direction indicators. This system successfully displayed wind direction in real time and managed to respond to very fast changes in wind direction at a resolution of approximately 2 o. II. HARDWARE DESIGN Fig. 1 shows the block diagram of the circuit used for the design and construction of a wind direction system. An elaborated circuit diagram of the system is shown in Fig. 3. Keywords Assembly Language, PIC16F872 microcontroller, seven segment displays, wind direction sensor. W I. INTRODUCTION IND direction reports from the meteorological stations are generalised for a large area. Certain companies e.g. those that manufacture toxic chemicals like acid and pesticides need very accurate wind direction data specific to their area of location. If a leakage or spill occurs these companies need to know the direction of wind for evacuation purposes and also to map the affected area [1]. Also included are airports where highly accurate wind direction data is required to enhance the safe landing of aeroplanes. A very popular instrument, the wind vane is used to serve this purpose. The proposed system is smaller and portable as compared to the ones locally available at meteorological stations in Zimbabwe. This augers well with the current trends of the design of electronic systems where the focus is on the miniaturisation of systems. The system being locally made saves the country the scarce foreign currency that would be needed to import such systems. The design and construction of the system develops the capacity and expertise to manufacture intelligent electronic systems for commercial purposes thus opening channels for the creation of employment. The design and construction of the electronic wind direction system was done in two stages, the hardware and software design. Blessed Muchono 1 is with the Department of Applied Physics, National University of Science and Techology, P. O. Box AC939 Ascot, Bulawayo, Zimbabwe. Saymore Chifamba 1 was with the Department of Applied Physics, National University of Science and Techology, P. O. Box AC939 Ascot, Bulawayo, Zimbabwe. Caspah Kamunda 2 was with the Department of Physics, Chancellor College, University of Malawi, P.O.Box 280, Zomba, Malawi. Fig. 1 Block diagram of the circuit for the electronic wind direction system. A W200P wind direction sensor manufactured by Vector Instruments Ltd [2] was used for this research work. This sensor incorporates a precision wire wound potentiometer as shaft angle transducer, enabling wind direction to be accurately determined using suitable electronic circuits. The force of air molecules striking the flat plate causes the shaft to rotate, aligning the plates with the direction of the local airflow. The weighted pointer serves as a damper to reduce effects of small variations in actual wind direction. The output signal is an analogue voltage that is directly proportional to the azimuth angle of the wind direction. The sensor is very cheap and is easy to interface to a microcontroller because its output voltage is directly proportional to the azimuth angle. Fig. 2 shows schematic diagram of the potentiometer incorporated in the transducer. The output voltage from the sensor is given by [2]: V ( R R ) (1) 0 2 1 Vin where V o the output voltage, V in is the input voltage, R 1 is the total resistance, and R 2 is the resistance proportional to the angle subtended. The sensor measures angle from 0 o to 358 o. The 2 o gap is incoporated in order to ensure smooth operation of the sensor from 358 o to 0 o. http://dx.doi.org/10.15242/ijccie.e0316024 148

Fig. 2 The circuit diagram of the W200P potentiometer wind direction sensor To ensure the protection of the microcontroller from the sensor, a voltage follower circuit was used as a buffer. The voltage follower has a high input impedance, low output impedance, and unity gain. As the input voltage was changed, the output and the non-inverting input changed by an equal amount but limiting the current flowing into the microcontroller. A 741 operational amplifier was used for this purpose [3]. Fig. 3 shows the circuit diagram of the wind direction system with the 741 operational amplifier marked as IC. The heart of the wind direction system designed for this research work was a PIC16F872 microcontroller [4]. The PIC16F872 is a 28 pin, 8-bit CMOS Flash microcontroller with 10-bit analogue to digital module. The microcontroller is manufactured by Microchip Company. It has an integral design with an in-built modular input/output circuitry that monitors the status of the field connected to inputs and controls the attached outputs according to a user created program stored in the programmable flash RAM memory. Three seven segment LEDs were used to display the angle of the wind direction from 0 to 358 o, while eight single LEDs were used to indicate the cardinal and primary inter-cardinal directions. Cardinal points are North, East, West and South while primary intercardinal points are Northeast, Southeast, Southwest and Northwest The microcontroller requires an external clock that determines its fundamental operating characteristics, therefore it needs to be selected wisely. It was realized that a faster clock is not always better in terms of microcontroller operating speed and programming execution. The drawbacks associated with high frequency clock are: their requirement for large power consumption and possible electromagnetic interference. All the instructions embedded within the microcontroller which require proper timing depend on the external clock. Fig. 3 The circuit diagram of the wind direction display system. IC is a 741 operation amplifier, C 1 and C 2 are capacitors both with a value of 22 pf, R 1 to R 20 are resistors each of 180 Ω resistance and T 1 to T 3 are PNP transistors. http://dx.doi.org/10.15242/ijccie.e0316024 149

Therefore, if the clock speed is stable and accurate the operation of instructions will be stable and accurate as well. Considering all these factors, a 20 MHz oscillator clock marked as Xtal in Fig. 3 was selected. The capacitors C 1 and C 2 both of magnitude 22 pf were connected in parallel to the oscillator in order to stabilize the signals from the crystal especially on power up. The common anode LEDs used for the seven segment display and direction indicators were connected as shown in Figure 3. The electrical specification for the output line of the microcontroller is 25 ma at 5 V. An LED requires approximately 1.8 V and draws approximately 20 ma. Because of the LED requirements, a current limiting resistor was connected in series with each diode in order reduce the current flowing through it. To find the value of the limiting resistor, the characteristic voltage drop across each LED was subtracted from the PIC output voltage ( 5 V). Using Ohm s law and the LED specifications the limiting resistor was calculated using the following equation: direction indicators were connected to Port B. The input from the sensor, the power ON LED and the three transistors that switch the three seven segment displays, all took up Port A. The second stage was to convert the analogue signal from sensor to a digital signal compatible with the PIC and the MCASM assembly language. Fig. 4 shows the flow chart for the analogue to digital (A/D) conversion stage. The converter generated a 10 bit digital result of analogue level via successive approximation. The A/D conversion of the analogue input signal resulted in a corresponding 10-bit digital number. Conversion starts when the go/done bit of the A/D control (ADCON) register is turned ON. This bit is automatically cleared when conversion is ended. The result of the conversion is transferred to the A/D result high ADRESH and A/D result low ADRESL registers. R V r I (2a) R (5.00 1.80 )/ 0.02 180. 00 (2b) where V r is the voltage across the current limiting resistor and I is the maximum current ( 20 ma) allowed to flow through the LED to avoid overheating and breakdown. A standard resistance value of 180 Ω slightly greater than the calculated one (160 Ω) was used for all the resistors in the circuit of Figure 3. Common-anode seven segment LEDs were used for the display of the wind direction system. The common anode of each seven-segment display was connected to the 5 V rail through a PNP transistor and the LEDs were turned on with logic zero. To produce a three digit display the diodes a, b, c, d, e, f and g of each seven-segment display were multiplexed, and connected on the output pins 11 to 19 of the microcontroller. The common line (the common-anode line) for each seven-segment display was taken out separately through a switching transistor and this line is switch off for a short period of time to turn on the display. If a PNP transistor was in a conducting mode any segment with logical zero emitted light, and if not no segment emitted light, regardless of its pin state. Each display was turned on at a rate above 100 times per second through multiplexing, and it appeared that all the displays were turned on at the same time. III. SOFTWARE DESIGN The microcode assembler (MCASM) assembly language was used to write the source code that was then programmed into the PIC16F872 microcontroller [5]. The PIC16F872 has three input/output ports. The first stage of the program was to configure the ports that were to be used as inputs or outputs and the ports that were to be split so that some pins are inputs and others outputs. The Input/ Output lines that were used for this research work were twenty. The seven segment displays made use of seven I/O lines of Port C. The single LEDs Fig. 4 The analogue to digital converter (ADC) flow chat. ADRESH and ADRESL stand for analogue to digital result high and low registers, respectively In this research work the two least significant bits in ADRESL were ignored. Therefore, the result in the ADRESH register was used meaning to say the A/D converter was configured to work as an eight bit instead of ten bit converter. This meant that the output of the A/D converter varied from 0 (all bits '0') to 255 (all bits '1'). In hexadecimal numbers, this was from 0 to FF. Considering the quantization level of an 8 bit A/D converter, the resolution of the signal converted was approximately 1.406 o obtained from 360 o /256. The MCASM assembly language used was only compatible with hexadecimal numbers and hence for the seven segment displays, the resolution was taken to be two steps of the A/D converter result. For a result of two steps, the display read 3 and for a result of six steps it read 8 after rounding off to nearest integer, respectively. This was how the value sent to the seven segment LED display was determined by the program. This gave a maximum resolution of 3. http://dx.doi.org/10.15242/ijccie.e0316024 150

The programming of the assembly language was done in such a way that the 0 to 360 o rotation was quantized into 16 quantisation levels representing the cardinal, primary intercardinal and secondary inter-cardinal points. Only the cardinal and primary inter-cardinal points were displayed on the single LED direction indicators. The range in which a cardinal or primary inter-cardinal point was displayed was between two secondary inter-cardinal points surrounding it, implying a range of 45 o or 2D in hexadecimal. Fig. 5 shows the quantization levels at each secondary inter-cardinal point. Fig. 5 Quantization levels at cardinal, primary inter-cardinal and secondary inter-cardinal points. The abbreviations N, NE, NNE stand for north, northeast north of north-east and so on, respectively. Only the cardinal and primary inter-cardinal points were displayed Fig. 6 The flow chart for the light emitting diodes (LED) direction indicators subroutine. ADRESH:ADRESL stands for analogue to digital result high and low registers, respectively. N and NE stands for north and north east, respectively. The numbers 10 and 30 are in hexadecimal From Fig. 5, if, for example, the ADC result was between F0 and 10 in hexadecimal, the wind direction that was displayed was North. This can clearly be shown in the flow chart of Fig. 6. The display of wind direction was accomplished by two subroutines. One subroutine catered for the single LED direction indicators while the other catered for the seven segment displays. If the hexadecimal value in the ADRESH:ADRESL registers is less than 10 then the north LED indicator is switched on otherwise the next stage of the subroutine is checked. Fig. 7 shows the flow chart for the seven segment LED displays. As explained earlier the ADC converter s output increased in steps of 2 from 0 to 256, that is from 0 to FF in hexadecimal. For each stepwise increment the angle increased by 2 or 3 o. This gave an error of approximately 1%. IV. SYSTEM TESTING The linearity of the W200P wind direction sensor was tested by connecting the sensor to a 5 V power supply. The angle of the sensor was varied and measured using a 360 o protractor. The corresponding resistance and voltages for each 45 o angle increment were measured by a high precision digital multimeter manufactured by Fluke Corporation. The angle dependence of the voltage and resistance is shown in Fig. 8. The figure shows that the resistance and voltage are directly proportional to the angle. Fig. 7 The flow chart for the seven segment light emitting diodes (LED) displays subroutine. ADRESH stands for analogue to digital result high register. The numbers 2H, 4H and 6H are in hexadecimal http://dx.doi.org/10.15242/ijccie.e0316024 151

Fig. 8 The angle dependence of voltage and resistance for a W200P wind direction sensor After the program was assembled using the MCASM assembler, it was simulated with PIC Simulator integrated development environment (IDE), a software produced by the Oshon Soft Company. This simulator gives the correct picture of how the program would behave in a real device. The simulator helps to identify and fix syntax errors in the program before it is blown into the PIC. Fig. 9 shows the simulation in progress. TABLE I SENSOR OUTPUT VOLTAGE RANGE AND THE CORRESPONDING CARDINAL AND PRIMARY INTER-CARDINAL DIRECTIONS Voltage range (V) 4.541 0.303 North Wind direction 0.303 0.908 North East 0.908 1.514 East 1.514 2.119 South East 2.119 2.723 South 2.723 3.326 South West 3.326 3.935 West 3.935 4.541 North West V. CONCLUSION A low cost electronic wind direction system was successfully designed and constructed. The system was able to display wind direction on both seven segment displays and single LEDs. REFERENCES [1] http://www.osha.gov/publications/complinks/oshg-hazwaste/11-12.pdf. [2] Vector Instruments, W200P wind direction sensor manual, 2005. ftp://ftp.campbellsci.com/pub/csl/outgoing/uk/manuals/w200p.pdf [3] T. L. Floyd, Electronic devices. [4] Microchip Technology, PIC 16F872 Data Sheet, 2005. [5] M. Collier, Design of a cross-assembler for PIC16F872, Conference proceedings, pg 4-5, 2005. Fig. 9 Window showing simulation in progress After the simulation was performed and the program found to run well, the next step was to load it onto the PIC16F872 microcontroller and power the system. Depending on the orientation of the wind direction sensor, one LED that displayed wind direction in the cardinal or primary intercardinal point turned ON. A high resolution digital voltmeter was connected across the output of the voltage follower circuit and the range of voltages within which a particular direction was displayed was noted and recorded. Table I shows the sensor output voltage range and the corresponding cardinal and primary inter-cardinal directions. The seven segment LEDs displayed values of wind direction in degrees. http://dx.doi.org/10.15242/ijccie.e0316024 152