I'm trying to find a simple way to convert a 0-5 V output from a joystick hall effect sensor to +2.5 -- 0 -- +2.5 V. Here's how I want the response to look:
The output voltage will be sent to a frequency converter and on to a stepper motor driver. I want to have the same voltage at both extremes so the frequency (motor speed) is the same regardless of the positive or negative direction of the joystick. I intend to use a comparator at the zero point (with an appropriate deadband) to reverse the direction of the stepper driver.
I've thought of a few ways to accomplish this, but none seem to be particularly straightforward:
- Create a second, inverted output from the sensor and switch the input source (via comparator and mux) to the frequency converter at the 2.5 V midpoint. This would provide 2.5-0 V from the inverted output and 0-2.5 V from the original output.
- Shift the 0-5 V range to -2.5-2.5 V and then use an absolute value circuit to invert the negative portion of the output.
- Generate a bias voltage, based on joystick position, and add/subtract it from the sensor output.
Ideally, I'd like to have a single input to the frequency converter instead of trying to switch it to another source, such as an inverted output. The second idea above would satisfy that preference, but it would require a negative voltage source. Also, I'm trying to use discrete components in this design, so a microprocessor isn't an option for me.
Is there an easier way to accomplish this task? The problem seems fairly straightforward, but I'm having trouble coming up with a simpler solution. I appreciate the help.
Answer
I'd use the absolute value circuit and a subtractor to shift the output to the 0-2.5V range. Jasen's answer provides an absolute value circuit I've used before and which should work here. I'd follow that with an op amp difference amplifier with a gain of 1.
You'll need a 2.5V reference for both the absolute value circuit and the difference amplifier. You can either use a simple resistor divider from your positive power supply (which I would buffer with another op amp) or a 2.5V reference IC.
Here's a schematic which you can simulate (I assumed a 5V supply was available for the 2.5V reference):
simulate this circuit – Schematic created using CircuitLab
I didn't pay much attention to the resistor values -- I just made sure they have the right ratios. You'll know better what values work in your application. Similarly, I just used a generic op amp.
A DC sweep of the input from 0V to 5V produces the following outputs for the absolute value circuit (in orange) and the difference amplifier (blue):
Since there are four op amps you might be able to use a single quad op amp IC. Or, if you use a 2.5V reference IC (so you only need 3 op amps), you could use a dual op amp IC for the absolute value circuit and a single for the difference amplifier.
No comments:
Post a Comment