Main Page | Projects Index Gallery IndexSite log


Analogue Conditioning Board for Microcontrollers



In order to make measurements of real world analogue signals, it may sometimes be necessary
to condition the signal from a sensor or circuit so that it is presented to the Microcontrollers
in a form that it can readily process.

Typically this would mean transforming the signal so that it was applied to the controller with
a span of 0-2.5V or 0-5V.

The circuit below provides this conditioning service between an external sensor and the controller. What follows is an outline of how to configure the board so that a number of real world values can be read.


How it works

The layout of the board is such that channel 0 is configured to more readily handle current
signals and channel 1 is intended for voltage measurements.

Typically the board would be connected as below in order to measure basic current and voltage, the shunt resistor is shown here as an external device to the PCB, however a location is provided on the board for a small shunt suitable for low current measurement(eg 4-20mA etc).

The circuit was transferred into a PCB design and dispatched for manufacture.

Once manufactured the finished blank board appeared as below:

The items attached to the board will depend on the required configutaion for each channel.

Configuring Channel 0 to Measuring 4-20mA

In order to use channel 0 for low current measurement it should be configured as below:

- IC1 is not required for this option

- link   f-g, m-n, o-p

 - Rx(sense)internal = 250 Ohms

 - for this option only a single 5V rail is required.

If we use a 250R resistor, from ohms law we can calculate the measurable range of the input as:

for I/P = 0-20mA ------> O/P = 0-5V

and therefore

for I/P = 4-20mA ------> O/P = 1-5V

Here the voltage produced by the shunt is in the 0-5V range and can be fed via the IC2A buffer directly to a microcontroller.

Configuring Channel 0 to Measuring currents in the range of 0-2A

By using an external ceramic 5W 0.56 Ohm resistor in place of PCB's Rx(sense) resistor higher currents can be measured with the circuit.

If we can calculate the maximum measurable current for this 5W resistor


W = V^2/R = I^2 x R

then by transposition   SQR(5/0.56) = 2.988 A

This can provide measurements up to approximately 3A, but to keep thinks away from the top end of their ratings we will make the calculations for a range of 0 to 2A.

If we use the following connections.

links set as  a-b, e-d , j-k , m-n, o-p

The first amplifier on the circuit (IC1A) will be set up as non inverting, the output of which is then fed directly to the final buffer(IC2A) bypassing the summing amplifier (IC1B).

Knowing the configuration of the first amplifier we can work backwards to find the combinational resistance of R2+VR1 so that a measurable range of 0-2A can be realised.

From ohms law when measuring full current across the sense resistor we can predict the potential diffeence produced.   

2A x 0.56Ohms = 1.12V

Next the gain required to transform this to the full scale ADC voltage (in this case 0-5V) can be found.

Av = 5V/1.12 = 4.46

and finally by transposing the formula for a non inverting amplifier [Av = 1+(R3/(R2+VR1))] and taking the resistance of R3 as 4k7 we can find the missing values in order to achieve the desired gain.

R2+VR1 = 4k7/(4.46 - 1 )= 1.358 Kohms

From this we can now say that VR1 needs to be set to 358 ohms or 72% from fully closed with R2 = 1Kohm for the required gain.

Finaly for compleatness the maximum and minimum ranges of the system can be calcumeted assuming the component values. R1 = 4K7, R2 = 1k, VR1 = 500 Ohm

If we use these values and reference the formula for a non inverting amplifier, as it applies to this circuit we get:

Av = 1+(R3/(R2+VR1))

then with the 500 Ohm pot at its two extremes we can calculate the resulting circuit gain and from this the measurable range of the setup.

pot closed   Av = 1+ ---- = 5.7

pot open     Av = 1+ ---------- = 4.1333
                     1K + 500R

the maximum readable input current can now be calculated if the final expected output span is 0-5V

    Vout               5V                           5V
---------- =  Vin ------------ = 0.877V   to  ------------ =  1.21V
    gain               5.7                        4.1333

finally from ohms law  we can calculate the maximum measurable current for both extremes of the pots travel.

from V(Rsence)/Rsence = I(Rsence)

pot open = 0.877/0.56 = 1.566A

pot closed = 1.21/0.56 = 2.16A

Configuring Channel 0 to Measuring currents in the range of 0-5A, 0-10A, 0-20A or 0-50A

By making use of commonly available shuts that provide 5A/75mV, 10A/75mV, 20A/75mV or 50A/75mV ranges we can substantially increase the measurable range of the analogue board.

Here if we again use the the first amplifier in non inverting mode we can calculate the required gain of the first amplifier in order to achieve a full scale reading of the selected shunt.

If we assume the input range of our microcontroller is 0-5V then we can calculte the required gain  inorder to produced the full scale voltage from an input of 75mV.

Gain (Av) = 5/0.075V = 66.6666

Then if we take R3 to be 82K we can find the combinational resistance of R2+VR1 for optimal gain

R2+VR1 = 82K /(66.66 - 1 )= 1.248 Kohms

This can be achieved with a 1K and a 500R pot set to about 50%

Configuration and Components:

links set as  a-b, e-d , j-k , m-n, o-p
R2  = 1K
R3  = 82K
VR1 = 500R

Configuring Channel 0 to Measuring bidirectional Currents

If we wish to measure current flow in both directions we must now reconfigure
the links in order to bring in the summing amplifier and dual supply's, as below:

links set as  a-b, e-d , j-k , m-n, o-p need to check....

Once this is done we can calculation the circuit parameters so that an input range of +75mV to    -75mV will result in an output from the first IC1A of:

 -2.5V to +2.5V

Then by adding +2.5V to this using the summing amp we can achieve an output range from the board of

0V to 5V

In-order to do this we can calculate that the amplifier must be non inverting and have a gain of:

Gain (Av) = 2.5V/0.075mV = 33.3333

To achieve this gain we can use

R3 = 33K, R2 = 820R and VR1 = 500R

As we are now dealing with +ve and -ve amplifier outputs, as mentioned above, the board must be
configured to run from a dual rail supply.

Configuration and Components:

links set as  a-b, e-d , j-k , m-n, o-p

R2  = 33K
R3  = 820K
VR1 = 500R

Configuring Channel 1 to Measuring Voltage Ranges  > 5V

The second channel of the conditioning board is designed to condition input voltage so that they can be easily mersured by a microcontroller.

Here we will discuss how to configure the board to measure 0-15V, 0-30V and 0-60V.

Lowering the input voltage is first achieved by use of a potential divider and directly following this an op-amp is used to send the conditioning signal on to the microcontrollers ADC.

If we consider the resistor arrangements as below, the required ranges can be achived.

Many more configurations of the amplifier are possible although for my purposes at least these 3 ranges should cover most bases. Aprat from the links mentioned in the drawings above only link (r) needs be made, this will set the channel 2 amplifier into a non inveriing buffer configuration.

Configuring Channel 1 to Measuring Voltage Ranges  < 5V

If link (r) is moved to (s) then the second channel buffer can be configured as a non inverting amplifier. Here if we wish to measure an input range of 0-1V we must amplify the signal by a factor of 5 in order to make best use of the ADCs full range. From the formula for a non inverting amplifier we can work out the gain of the second channels amplifier as.

Av = 1+(R17/R16)

From this if we take R17 = 39K and R16 = 10K, then the circuit gain works out as 4.9 (not bad).



Click here to download the associated project files: