Skip to content

Rover Signal Conditioning

by Puck on December 2nd, 2009

With a circuit and a plan for controlling the motors we need a mechanism to take the signal from our Rabbit and pass it to the Toshiba H-Bridge.  Like many engineers before me I’m stuck with a signal that doesn’t quite reach the right voltage.

How can I make these two parts play nice with each other?

Going Down… Lowering the Voltage of a Signal

If circuits were geysers, the voltage divider would be Old Faithful. With two resistors and a bit of math we can make a big voltage smaller.

Voltage Divider

Voltage Divider

The math for a voltage divider is easy enough that with a calculator you can get a quick answer without any calculus, headaches, or swearing.

Voltage Divider Equation

Voltage Divider Equation

If we take two resistors with equal values and plug them into the equation we get a really cool effect.

  • R1 = R2
  • R1 + R2 = 2(R2)
  • R2/2(R2) = 1/2 (by canceling R2)

That means if you grab two identical resistors and build a voltage divider you can automatically cut your input signal in half.

V-Output = 1/2 V-Input

Not too small

For power consumption’s sake I would recommend “large” resistors.  Nothing says dead battery like two 1-ohm resistors used as a voltage divider circuit.

Not too big

On the other hand, you will eventually plug that voltage divider into some widget that will also have a resistance.  If your widget has a lower resistance than the voltage divider you drop most of the load into the widget which also isn’t great.

Just about right

As a rule of thumb, try to pick resistors that are about 1% as resistant as the widget.  (Take the resistivity of the widget and knock two zeros off the end and you’ll get a decent ballpark value for the voltage divider resistors.)

  • Widget = 1 Mega-Ohm (1,000,000 Ohms)
  • Voltage divider resistors = 10 Kilo-Ohms (10,000 Ohms)

Going Up… Raising the Voltage of a Signal

If you want to raise the voltage you might consider… ahem… an amplifier. ;)

The Operational Amplifier or “Op-Amp” to his friends

Operational Amplifier

The Operational Amplifier

The operational amplifier is the Swiss army knife of the analog design world.  It has so many uses that it finds its way into a multitude of designs .

In this case we want to amplify a digital 3.3 volt (max) signal up to 5 volts (max).  The first thing you will notice is that the operational amplifier has 5 connections:

  1. Positive Power Supply or Rail – tied to 5 volts in the schematic
  2. Negative Power Supply or Rail – tied to ground in the schematic
  3. Non-inverting input (+) – tied to our 0 – 3.3 volt input signal
  4. Inverting input (-) – tied to a voltage divider (V-out = 0.4 x V-in)
  5. Amplified Output – tied to our H-Bridge

The Rails tell us the range of our new signal which in this case will be from 0 – 5 volts.

Analog Device in a Digital World

There is a lot of operational amplifier theory we could look at for an analog circuit but because we are working digitally we are only interested in logical 0 (0 volts) and logical 1 (5 volts).  That means we don’t need to output all the values between 0 and 5 volts.

We won’t get much further without a bit of math and fortunately for us, it is easier in this case than the voltage divider.  Amplifiers have a value called Gain which tells us how much they can amplify a signal.  For some reason, Gain is usually represented by an ‘A‘.

  • A = Gain
  • Vp = Non-inverting input (+)
  • Vn = Inverting input (-)

To find the output voltage of an amplified signal we plug in an easy equation:

Output Voltage = A x  (VpVn)

Here is what we already know:

  • A = about 100,000 for a normal Op-Amp
  • Vp will be either 0 volts or 3.3 volts
  • Vn = 0.4 (5 volts) = 2 volts

Let’s plug our digital signal (Vp) into the equation to see where it takes us.

When Input Voltage (Vp) = 0 volts

Output Voltage = 100,000 x  (02 volts)

Output Voltage = -200,000 volts

Smoke, Fire, and… BOOM!

Well, actually there won’t be any “BOOM!”.  What we have really done is kicked the signal right into the extreme low side of what we can do which is defined by the lower rail at 0 volts.  Instead of -200,000 volts we will get 0 volts which is exactly what we want.

When Input Voltage (Vp) = 3.3 volts

Output Voltage = 100,000 x  (3.3 - 2 volts)

Output Voltage = 130,000 volts

At this point you probably realize there will be no BOOM here either. Here we have kicked the signal to the extreme high side defined by the upper rail at 5 volts.  Instead of 130,000 volts we will get 5 volts which is perfect.

Linear and Non-Linear

When you operate between the two rails of the amplifier, it is called operating within the linear region or linear.   That is very common with an analog signal.  In this digital example we are bouncing back and forth from one rail to the other which is why we call it non-linear.

A Motor Circuit Ready for Roving Destruction

With a voltage divider and an Op-Amp, you can change the voltage of an input signal.  That is exactly what we did with the Rover’s motors which you can see in the updated (and much cooler looking) schematic which Larry drew up in DipTrace shown here:

The updated Schematic with amplified signals and H-Bridges (Click for full size)

The updated schematic with amplified signals and H-Bridges (Click for full size)

We are using Parallel Port A on the Rabbit (configured as 8 digital outputs) to drive signals into 8 Op-Amps.  Each pair of Op-Amps is connected to a Toshiba H-bridge which controls one motor.  That’s a working circuit using 8 digital outputs to control four independent motors.

Want More?

Leave a Reply

You must be logged in to post a comment.