How to measure an analogue voltage with a PC

 
 
 

   Everything in life is not digital. These days it’s too easy to expect the world of electronics and computing to use digital signals exclusively. Digital signals are easy in the sense that they only have two distinct voltage levels. For example TTL logic has +5 volts to represent logic ‘1’ and zero volts to represent logic ‘0’. However, there are times when an analogue signal is inescapable and needs to be measured. For example a temperature sensor typically provides a continuously varying voltage proportional to the measured temperature. If a control system must respond to these changes then fundamentally it needs to be able to quantify this voltage. For our example we will show how a PC can be used with a W.A.S.P. USB adaptor board to measure an analogue voltage varying between 0 and 5v and obtain a numerical measurement for this in the corresponding range of 0 – 255.
Measuring an analogue voltage level using a PC is easy with the USB adaptor board    WASP is an acronym for Windows Analogue Signal Processor and the adaptor board can measure 4 independent analogue voltage inputs. (The board also has other facilities, which we will leave to other discussions).

Connecting Analogue signals to WASP
The WASP has four analogue inputs which are connected via the screw terminals TL1. For our purposes we will use analogue input 1. This is connected to TL1 Terminal 7. Since every analogue signal must have a ground reference this will be TL1 terminal 9. To allow us to generate a variable DC voltage to be measured, we will use a simple potentiometer supplied from a 5v source. This circuit is shown below.

How to connect an analogue voltage to a PC


   By turning the potentiometer the voltage on terminal 7 will vary between 0 and 5v. This is what we will be measuring.

Connecting the WASP to the PC
    The WASP is a standard USB device and will automatically configure itself for Windows operation as soon as it is connected to a free USB port on the PC. There are no additional drivers to install for the WASP as these are already part of the Windows operating system (WinXP or later).
making a USB connection to the PC

Running WaspWare Software
.
    Supplied with the WASP is WaspWare software. Installing this from the installation disk simply consists of clicking on the “Next” button for a few screen prompts for the default installation.
    When you run the WaspWare software you will be presented with a screen showing (amongst other things) four vertical sliders.

Control software for measuring analogue voltages on a Windows XP PC
click on image for higher resolution version in new window

    The four vertical sliders correspond to the four analogue inputs to the WASP. Since we are using input one we will be using the first slider on the left. When running the height of the slider is directly proportional to the amplitude of the voltage input. The numerical value of this input is also shown directly beneath the slider . This number is in the range 0-255.
    All that is required now is to click on the “Run” button on the bottom left of the screen to start measuring the analogue voltage. When you click on “Run” the message window adjacent will show “Running”. Now you can vary the voltage at the input by turning the external potentiometer. As you turn the potentiometer the vertical slider will move up and down corresponding to your changes and the numerical readout below will show the actual value of this voltage (in range 1-255).

   
         
   

!!!  You are now measuring an analogue voltage with a PC  !!!

   
                   
   

    WaspWare allows you to add more functionality to this setup by specifying limits on the analogue level at which it will turn on or off its switching outputs forming a complete control system. It will also allow you to change the range over which you are measuring, but these are both subjects of other discussions.

   
                   
         
                   
 

.        .

 
 

© Copyright pc-control.co.uk 2008