Anemometer From A Computer Mouse

6
S PECIAL F EATURE: DIY P HYSICS www.iop.org/journals/physed Design and calibration of an inexpensive digital anemometer R Hern´ andez-Walls 1 , E Rojas-Mayoral 2 , L Ba´ ez-Castillo 3 and B Rojas-Mayoral 4 1 Facultad de Ciencias Marinas, UABC, Ensenada Baja California, Mexico 2 Centro de Investigaci´ on Cient´ ıfica y Superior de Ensenada, Ensenada, Baja California, Mexico 3 Facultad de Ciencias, UABC, Ensenada, Baja California, Mexico 4 Facultad de Ciencias Naturales y Exactas, Unison, Sonora, Mexico E-mail: [email protected] Abstract An inexpensive and easily implemented device to measure wind velocity is proposed. This prototype has the advantage of being able to measure both the speed and the direction of the wind in two dimensions. The device utilizes a computational interface commonly referred to as a mouse. The mouse proposed for this prototype contains an optical sensor which allows it to situate itself in space. The prototype utilizes a pendulum with an attached drag body. The pendulum’s drag body interacts with the fluid in motion, causing an angle with respect to the vertical. The mouse measures the displacement of a sphere attached to the pendulum and calculates the angle. The resulting angle determines the relationship between the drag force and the wind speed, thereby allowing the mouse to calculate the velocity. A MATLAB script was written to process the data received from the mouse. After calibration, the program determines the relationship between the pixels measured and the pendulum’s angle, and so obtains information about the wind. This system (device and software) eliminates human error in data collection and storage, thereby considerably reducing the time and cost associated with measuring wind velocity. S Supplementary data are available from stacks.iop.org/physed/43/593 Introduction One problem in meteorology is that of obtaining reliable data in an autonomous way. In general, meteorological instruments are expensive and difficult to maintain. This problem can be solved with a personal computer system. Any computer system will contain input and output devices, such as a mouse and a monitor. It has been shown that a computer mouse can be used as an input device for information [1–5]. The use of the computer mouse as an electronic interface is an alternative that avoids the design and construction of an interface card between the computer and a sensor [4]. In this article, a prototype of an anemometer is proposed that utilizes an optic sensor. Even though this prototype is similar to a one-dimensional current meter, it has the advantage of being able to measure the wind’s speed as well as its direction [4]. This article is structured as follows. The next section contains the physical preliminaries 0031-9120/08/060593+06$30.00 © 2008 IOP Publishing Ltd P HYSICS E DUCATION 43 (6) 593

description

Making a wind speed sensor from a computer mouse. Calibration procedure for rotary motion.

Transcript of Anemometer From A Computer Mouse

  • SP EC I A L F E A T UR E : D I Y P HY S I C Swww.iop.org/journals/physed

    Design and calibration of aninexpensive digital anemometerR Hernandez-Walls1, E Rojas-Mayoral2, L Baez-Castillo3 andB Rojas-Mayoral41 Facultad de Ciencias Marinas, UABC, Ensenada Baja California, Mexico2 Centro de Investigacion Cientfica y Superior de Ensenada, Ensenada, Baja California,Mexico3 Facultad de Ciencias, UABC, Ensenada, Baja California, Mexico4 Facultad de Ciencias Naturales y Exactas, Unison, Sonora, Mexico

    E-mail: [email protected]

    AbstractAn inexpensive and easily implemented device to measure wind velocity isproposed. This prototype has the advantage of being able to measure both thespeed and the direction of the wind in two dimensions. The device utilizes acomputational interface commonly referred to as a mouse. The mouseproposed for this prototype contains an optical sensor which allows it tosituate itself in space. The prototype utilizes a pendulum with an attacheddrag body. The pendulums drag body interacts with the fluid in motion,causing an angle with respect to the vertical. The mouse measures thedisplacement of a sphere attached to the pendulum and calculates the angle.The resulting angle determines the relationship between the drag force andthe wind speed, thereby allowing the mouse to calculate the velocity. AMATLAB script was written to process the data received from the mouse.After calibration, the program determines the relationship between the pixelsmeasured and the pendulums angle, and so obtains information about thewind. This system (device and software) eliminates human error in datacollection and storage, thereby considerably reducing the time and costassociated with measuring wind velocity.S Supplementary data are available from stacks.iop.org/physed/43/593

    IntroductionOne problem in meteorology is that of obtainingreliable data in an autonomous way. In general,meteorological instruments are expensive anddifficult to maintain. This problem can be solvedwith a personal computer system. Any computersystem will contain input and output devices, suchas a mouse and a monitor. It has been shownthat a computer mouse can be used as an inputdevice for information [15]. The use of the

    computer mouse as an electronic interface is analternative that avoids the design and constructionof an interface card between the computer anda sensor [4]. In this article, a prototype of ananemometer is proposed that utilizes an opticsensor. Even though this prototype is similarto a one-dimensional current meter, it has theadvantage of being able to measure the windsspeed as well as its direction [4].

    This article is structured as follows. Thenext section contains the physical preliminaries

    0031-9120/08/060593+06$30.00 2008 IOP Publishing Ltd P H Y S I C S E D U C A T I O N 43 (6) 593

  • R Hernandez-Walls et al

    for obtaining an equation used to calculate thespeed and direction of the fluid in motion with theproposed device. The following section describesthe assembly of the anemometer, consisting ofan optical mouse, a sphere and a pendulum.Later, the calibration of the proposed device isexamined, followed by a description of how thecomputer script captures the information. Finally,the advantages, disadvantages and conclusions arediscussed.

    Physical preliminariesIf we consider the case of a pendulum with weight(W ), that, upon interacting with fluid in motion,produces an angle with respect to the vertical ( ),resulting from the drag force (Fa) that the fluidexercises over the pendulum, then the resultingopposing force is the tension (T ). This can bedescribed with a diagram of a free body, wherea balance of forces is obtained, as is shown infigure 1. Using the trigonometric relationshipbetween the angles and sides of a right triangle,the following equation is obtained:

    tan = FaW

    . (1)

    Solving for the drag force in equation (1),

    Fa = W tan . (2)The drag force of an object surrounded by

    a stationary flow is defined by the followingequation [6]:

    Fa = 12 Cd Av2 (3)where Cd is the drag coefficient, A is thearea of the projection of the object on a planeperpendicular to the direction of motion, is thedensity of the fluid, and v is the flow speed.

    Setting equations (2) and (3) equal to eachother, the following equation is obtained:

    W tan = 12 Cd Av2. (4)Solving for the velocity, we find

    v =

    2W tan Cd A

    . (5)

    If we consider that the fluid and the object donot change with time, it can be supposed that the

    Figure 1. Right triangle representing the balance of forces obtained by modifying the free-body diagram.

    W

    T

    Fa

    following parameters can be considered constants,and that they may all be included in a constant:

    K

    2WCd A

    . (6)

    Then equation for the velocity is

    v = Ktan . (7)If the value of the constant K is known, thenonly the deviation of the angle with respect to thevertical is necessary to obtain a measurement ofthe velocity of the flow.

    Experimental deviceThe main purpose of this project is to measurethe drag angle with an optical computer mouse.The mouse is positioned on the upper portionof a sphere, which has free movement, while apendulum is attached to the lower portion of thesphere. When the pendulum interacts with fluid inmotion, it changes its alignment, thereby causingthe attached sphere to rotate. The mouse detectsthe rotation of the sphere, as shown in figure 2.

    It was necessary to build a device that firstallowed the free movement of the sphere whenthe drag object was interacting with the fluid,and second, allowed the mouse to detect themovement of the sphere. The device is mountedon a triangular frame, inside which a sphere is

    594 P H Y S I C S E D U C A T I O N November 2008

  • Design and calibration of an inexpensive digital anemometer

    Figure 2. Effect of the drag force on the pendulum.

    mouse

    sphere

    pendulum

    drag body

    flow

    supported by skate bearings that allow the freemovement of the sphere without changing itsrelative position with respect to the mouse. Aboard with a circular hole in the centre is affixedto the top of the frame. The mouse is attachedto the board so that it can detect the movementof the sphere through the hole in the board.

    Since the mouse detects any displacement of thesurface below it by optical means, the mousehas to be fixed to the upper part of the structurein such a way that it stays within a small andconstant distance to the sphere without makingany contact. A pendulum is attached to thebottom of the sphere. A vane is used as a dragbody and is attached to the opposite end of thependulum. When the vane interacts with the fluid,the movement is transmitted to the sphere by thependulum. The mouse then detects the movement(figure 3).

    The optical mouse is capable of measuring thepixels of the rotating surface of the sphere, but notthe angle ( ) resulting from the spheres rotation.It is necessary to determine the relationshipbetween the measured pixels and the drag angleof the pendulum.

    Pixelangle relation

    For the rotation of the sphere, caused by an angle( ), there exists a specific quantity of pixels.Therefore the angle ( ) can be defined as

    = pixels. (8)

    Figure 3. 3D model of the prototype.

    November 2008 P H Y S I C S E D U C A T I O N 595

  • R Hernandez-Walls et al

    00

    10152025sp

    eed

    (mph

    )

    tan1/2 ()

    303540455055

    0.5 1.0 1.5 2.0 2.5 3.0 3.5

    Figure 5. Calibration of the prototype with a protractor.

    Equation (8) describes a straight line with slope .Substituting equation (8) in (7):

    v = tan( pixels) K . (9)For the components:

    vx =

    tan(x pixelsx) K (9.1)

    vy =

    tan(y pixelsy) K . (9.2)The following section contains a description ofhow the estimation of the constant K was carriedout.

    CalibrationA commercial weather gauge (SELL-O-CRAFTSheboygan) was used for the calibration of the

    Figure 6. Angles plotted against the horizontal displacement of the cursor in pixels.

    500pixelsx

    0

    2

    4

    6

    8

    10

    12

    14

    16

    100 150 200 250 300 350 400

    proposed device. The weather gauge measureswind speed based on the same physical principles.

    The angles with respect to the vertical ( )were measured and the corresponding wind speedsobtained via the weather gauge were plotted withvelocity (miles per hour) on the vertical axis and

    tan on the horizontal axis (figure 4). A linearregression with a correlation coefficient of 0.993produced the following equation:

    v = 15.179tan . (10)The experimental device was calibrated

    to measure the velocity of the air with K(equation (7)) equal to the slope of equation (10).The drag body must have the same weight (W ) andarea (A) as the drag body of the weather gauge.

    For obtaining the pixelangle relationship,a protractor was placed on the base of thecage assembly (figure 5), and for each angle ofinclination ( ) the movement of the surface of thesphere was measured in pixels by the mouse inboth the x-axis and the y-axis.

    The measurements of the pixels against theangles are shown in figures 6 and 7. Theequation obtained from the linear regression, witha correlation coefficient of 0.995, for the x-axiswas

    x = 4.16 102 pixels.

    For the y-axis, with a correlation coefficient of0.998, the equation obtained was

    y = 5.09 102 pixels.

    596 P H Y S I C S E D U C A T I O N November 2008

  • Design and calibration of an inexpensive digital anemometer

    Figure 7. Angles plotted against the vertical displacement of the cursor in pixels.

    00

    2

    4

    6

    8

    10

    12

    14

    16

    50 100 150 200 250 300pixelsy

    Therefore the value of the constant in equa-tion (9.1) is x = 4.16 102, while in equa-tion (9.2), y = 5.09 102.

    Algorithm and scriptThe computer program for the calibration of theprototype was written in MATLAB, since it offersfunctions to obtain information from input devicessuch as the mouse. The script is shown in box 1.

    In order to obtain the coordinates of theposition of the cursor, it is necessary to obtain thedimensions of the monitor. For this the functionget is utilized, as follows:

    get(0, screensize).

    In order to start using the prototype it is necessaryto set the initial position of the cursor. Thefollowing function is utilized:

    set(0, PointerLocation, [x, y]).

    The function that obtains the position of the cursorwhen the prototype is in operation is

    get(0, PointerLocation).

    Advantages and disadvantagesThe materials of the proposed digital anemometerare available at low cost. The software wasdesigned with elementary programming concepts,making the reading and storage of the measureddigital data and its subsequent processing efficient.

    Box 1. MATLAB script for calculating wind velocitywith a mouse. This script is also available as asupplementary data file in the online version of thejournal at stacks.iop.org/physed/43/593.

    The calibration of the prototype is simple.The high correlation coefficients obtained suggestthat the measurement of the wind velocity isreliable.

    This system can be easily adapted for otherenvironments, such as marine coastal zones orfluid mechanics laboratories. It is possible tomeasure the velocity in two dimensions of almost

    November 2008 P H Y S I C S E D U C A T I O N 597

  • R Hernandez-Walls et al

    any flow by calibrating the prototype for thatspecific fluid.

    The main disadvantage of this prototype isthat the mouse must be kept dry.

    ConclusionsThe measurement range depends on the drag bodyand the precision depends on the volume of thesphere: the bigger the sphere, the greater theprecision.

    It has been shown that an optical mouse canbe used as an inexpensive sensor of geophysicalvariables: in this case, the velocity of the wind(speed and direction).

    AcknowledgmentsThe authors acknowledge Andrea Lievana-MacTavish for her suggestions and comments. Thefirst author also acknowledges support from SNI,UABC and from SEP-CONACYT (Mexico) undergrants UABC-325 and SEP-2004-C01-47285.

    Received 14 May 2008, in final form 30 July 2008doi:10.1088/0031-9120/43/6/005

    References[1] Ochoa O R and Kolp N F 1997 The computer

    mouse as a data acquisition interface:application to harmonic oscillators Am. J. Phys.65 11158

    [2] Yang Z and Maeda R 2000 Automatic micro flowrate measurement using a modified computermouse device 1st Annual Int. IEEE-EMBSSpecial Conf. on Microtechnology in Medicineand Biology (France) pp 28891

    [3] Modesto-Ortiz M, Martnez Y and Gonzalez J I2003 Observaciones De Nivel Del Mar ConInstrumentos De Bajo Costo. Reunion Anual DeGeofsica (Mexico: UGM) p 159

    [4] Hernandez-Walls R, Luna-Hernandez J R,Rojas-Mayoral E and Navarro-Olache L F 2004Dispositivo electronico, de facil construccion,para medir la velocidad de un fluido Rev. Ing.Hidraulica Mexico 19 1218

    [5] Ng T W 2003 The optical mouse as an inexpensivedevice SPIE Proc. ETuF4 (San Diego, CA)(Bellingham, WA: SPIE Optical EngineeringPress) pp 13

    [6] Roberson J A 1980 Engineering Fluid Mechanics(Boston, MA: Houghton Mifflin)

    Rafael Hernandez-Walls received hisPhD in optics from CICESE, Ensenada,Mexico. He currently works as aprofessor and researcher at the School ofMarine Sciences of the UniversidadAutonoma de Baja California (UABC)where he teaches physics andcomputation, focusing on thedevelopment of new technologies for usein marine sciences.

    Evaristo Rojas-Mayoral is a studentcurrently working to obtain his Mastersdegree in physical oceanography fromCICESE, Ensenada, Mexico. In 2005, heearned his Bachelors degree inoceanography from the UniversidadAutonoma de Baja California. Since2001, he has worked on the design andimplementation of new methods andtechnologies for measuring differentproperties of geophysical fluids.

    Leonardo Baez-Castillo is a studentworking to obtain his Bachelors degreein physics from the UniversidadAutonoma de Baja California, Ensenada,Mexico. During his academic career, hehas participated in the design andconstruction of instrumentation for bothphysics and oceanographic laboratories.He is currently in the process ofcompleting his thesis in biophysics,carrying out his research in the laboratoryof Animal Reproduction andImmunology.

    Braulio Rojas-Mayoral is a studentworking to obtain his Bachelors degreein physics from the Universidad deSonora, Hermosillo, Mexico. Hisprincipal interest is in numericalmodelling and the realization of appliedexperiments.

    598 P H Y S I C S E D U C A T I O N November 2008

    AcknowledgmentsReferences