Maker Pro
Maker Pro

Reverse the voltage?

stevew

Jun 16, 2012
12
Joined
Jun 16, 2012
Messages
12
I have an IC that gives an output voltage that ranges from 0 to 5v. I want to build a circuit that would convert that to the exact opposite, when it's 0v I want it to be 5v, etc.

I have no idea what this type of circuit would be called... any idea's or suggestions on how I would do this or what I should be looking for?

Thanks
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Use an OpAmp to invert it.
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
It depends on the type of signal, and the IC it's coming from, but the term is to invert the signal, at least if it is a logic signal. If it is analogue in nature, use an opamp as said.

TOK ;)
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
What's the chip you're using and what's your load going to be?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
As often happens on these forums, there is FAR too little information in the question. To the OP, please give as much relevant information as you can. At least a few paragraphs describing the situation.
This should include, at a minimum:
What you have, with part numbers, circuit diagrams, and/or photos;
What you want to do, in detail;
and what (if anything) you have tried, including any googling you have tried and the reasons why you couldn't use the ideas you found.
It may seem that you're saving people time by making them read only a short description, but as you can see here (and has OFTEN happens), different people interpret your question differently, and this leads to contradictory answers and much MORE wasted time than would have been the case if you had described your situation fully in the original post.
 

stevew

Jun 16, 2012
12
Joined
Jun 16, 2012
Messages
12
Sorry, here is exactly what I am doing...

I have a MLX90316 Rotary Position Sensor IC that is pre-programmed to deliver analog output instead of digital. It detects a magnet being rotated above the chip and outputs 0-5v depending on the position of the magnet when you rotate it.

The sensor chip has 3 pins, GND, +5V and Output. I've connected it to a USB joystick controller card on the X axis (which has +5v, GND and Input pin). It works perfectly except when I turn the magnet clockwise it registers as if I were turning a potentiometer counter-clockwise. I need it to be the opposite.

So an OpAmp is still my best choice for this? I assume that if I invert the voltage on the output of the sensor chip it will work the way I want it to...

Thanks,
Steve
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
have you actually observed what happens to the output voltage of the sensor when it detects the magnet rotating the opposite direction ?

If its producing 0 to +5V regardless of rotation direction of the magnet then adding an opamp to reverse the voltage is only going to reverse it for both directions of rotation....
Is that what you really want ?

Dave
 

stevew

Jun 16, 2012
12
Joined
Jun 16, 2012
Messages
12
have you actually observed what happens to the output voltage of the sensor when it detects the magnet rotating the opposite direction ?

If its producing 0 to +5V regardless of rotation direction of the magnet then adding an opamp to reverse the voltage is only going to reverse it for both directions of rotation....
Is that what you really want ?

Dave

The direction of the rotation matters. The voltage depends on the 360 degree position of the magnet. For example...

Magnet at zero degrees position = 0v
Magnet at 180 degrees position = 2.5v
Magnet at 359 degrees position = 5v.

I want it to be the opposite, like this...

Magnet at zero degrees position = 5v
Magnet at 180 degrees position = 2.5v
Magnet at 359 degrees position = 0v.

Right now the voltage increases as I turn it clockwise from 0 degrees to 359 degrees. I need it to decrease as I go clockwise from 0 degrees to 359 degrees.

I'm looking at OpAmp OP07CP now, I think this might be the one I need but not sure, any suggestions?

this is the datasheet for OP07CP http://www.datasheetcatalog.org/datasheet2/c/0gzhglfo9kzczeqd5oft6g445lpy.pdf

Thanks
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
I had a look at the MLX90316 data sheet, it seems to have a clockwise and anti-clockwise setting. Would reversing the direction do what you want?
 

stevew

Jun 16, 2012
12
Joined
Jun 16, 2012
Messages
12
I had a look at the MLX90316 data sheet, it seems to have a clockwise and anti-clockwise setting. Would reversing the direction do what you want?

In section 17 of the data sheet, the BCS version (figure 15) has an inverted output on pin 5. I wanted the BCS version but nobody sells it.

The version I have is in section 17, figure 14. I have no idea what they mean by "CCW (counter clockwise) is the defined by the 1-4-5-8 pin order direction for the SOIC8 package".... unless they are just refering to the BCS version.

CCW or CW is also a programmable feature but I have no way to program it, mine was already programmed for analog output so I just got the default settings.

Thanks
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Could you mount the IC upside down? You might be able to bend the pins around so the opposite side is facing outwards.
Do you intend to use a USB joystick interface permanently? Can you give the part number for the USB joystick interface? If it works with old joysticks (from the 1980s and 1990s) then it is not a voltage input circuit; it responds to resistance.
Disregarding the previous points, and assuming that a simple op-amp-based inverter will work, there are still issues. The OP-07 is a nice op-amp but you will need to provide positive and negative supply rails of at least +7V and -2V because its operating input and output voltages don't extend all the way to its negative and positive supply rails. This will require two voltage converters, either inductor-based or switched capacitor. Actually the MAX232 family and its equivalents will produce suitable voltage rails. A single-supply op-amp will not need a negative supply rail but will need a positive rail of about +7V.
If you want to power the circuit from 0V and +5V you will need an op-amp with rail-to-rail input and output capability such as the Maxim MAX9914/9915, see http://datasheets.maxim-ic.com/en/ds/MAX9914-MAX9917.pdf - it's a pretty impressive device.
Please also include any other information that might be relevant.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
The MCP6021 is a FET OpAmp specifically designed for single ended 5V supply operation and rail to rail operation. You can power this from your USB 5V supply line.
 

Attachments

  • OpAmpDcInv.JPG
    OpAmpDcInv.JPG
    42.5 KB · Views: 331
  • MCP6021crv.jpg
    MCP6021crv.jpg
    13.6 KB · Views: 150

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
CDRIVE,

What is the schematic / simulution package you use to produce the circuits you post? They really look good.

Bob
 

stevew

Jun 16, 2012
12
Joined
Jun 16, 2012
Messages
12
Could you mount the IC upside down? You might be able to bend the pins around so the opposite side is facing outwards.
Do you intend to use a USB joystick interface permanently? Can you give the part number for the USB joystick interface? If it works with old joysticks (from the 1980s and 1990s) then it is not a voltage input circuit; it responds to resistance.
Disregarding the previous points, and assuming that a simple op-amp-based inverter will work, there are still issues. The OP-07 is a nice op-amp but you will need to provide positive and negative supply rails of at least +7V and -2V because its operating input and output voltages don't extend all the way to its negative and positive supply rails. This will require two voltage converters, either inductor-based or switched capacitor. Actually the MAX232 family and its equivalents will produce suitable voltage rails. A single-supply op-amp will not need a negative supply rail but will need a positive rail of about +7V.
If you want to power the circuit from 0V and +5V you will need an op-amp with rail-to-rail input and output capability such as the Maxim MAX9914/9915, see http://datasheets.maxim-ic.com/en/ds/MAX9914-MAX9917.pdf - it's a pretty impressive device.
Please also include any other information that might be relevant.

That's an interesting idea (mounting it upside down)... but with what I have done with other Hall sensors they seem to be very picky with what side works well with the magnet.

I tried placing a magnet on the other side of the board and it doesn't appear to register anything although I cannot get it as close to the chip that way. Actually mounting the chip upside down might be worth a try but it would be a last resort because mounting it in the first place was not very fun :)

I have the BU0836X USB card. http://www.leobodnar.com/products/BU0836X/

That card says it is compatible with the "Magnetic (Hall effect) sensor Allegro A1302" (listed on that same page). That led me to trying my current IC because I needed one that could track a 360 degree position rather than just distance from the magnet.

Since I can calibrate this axis in Windows the voltages don't have to be exact. So only going from like 1 to 4v (or whatever) would not be a problem, I'd lose a little resolution that way but that's okay, I'll settle for the easiest solution.

So if I understand this correctly, I would use an OpAmp like this.... I would give it voltages from two sources, one would be from the output of my IC and the other would be a constant 5v from another source on the controller card, and the output from the OpAmp would be inverted based on the output of my IC (although the range would not be a full 0 to 5v), is that correct?

Thanks
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
What is necessary for your application is a simple inverting amplifier with gain=(-1) and symmetry around (+2.5) volts, i.e., 2.5v IN = 2.5v OUT. CDRIVE has posted the schematic for such a circuit where Rin=Rf for unity gain and a voltage divider puts +2.5v reference voltage on the '+' input of the op amp. This will work with a power supply of +5v if you carefully select the op amp for single supply rail-to-rail operation. You can use a more common LM324 type op amp with a higher supply voltage (+9v) but the reference voltage on the '+' input still needs to be +2.5v and stable. If you're not sure about how stable the power supply voltage will be, then it might be necessary to generate the reference voltage from a bandgap voltage reference. In the past I have used half-LM358, 1.2v bandgap, and a trimmer to generate the voltage reference. Then used the other half-LM358 as the inverting amplifier. This was in a situation where the power supply varied over a range 5-12 volts.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
So if I understand this correctly, I would use an OpAmp like this.... I would give it voltages from two sources, one would be from the output of my IC and the other would be a constant 5v from another source on the controller card, and the output from the OpAmp would be inverted based on the output of my IC (although the range would not be a full 0 to 5v), is that correct?

Thanks

You probably missed my post..

https://www.electronicspoint.com/reverse-voltage-t249177p2.html#post1473672
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
CDRIVE,

What is the schematic / simulution package you use to produce the circuits you post? They really look good.

Bob

Bob, thanks for that. The schematics are generated in Tina by DesignSoft. I have two electronics CAD apps and 5 Spice apps.. Electronics Workbench, Visual Spice, LT Spice, ISIS and my beloved TINA Classic. I really do love it. It's, by far, the easiest to use. I find that I can draw and simulate a circuit in one tenth the time it takes me to do it in my other apps.

Probably one of her best features is component size. Unlike my other apps, I can build a high density schematic and not have to scroll the screen. The schematic that I posted was magnified 100 times before exporting it as a Jpg. I don't normally do this when I include a plot embedded in the schematic but this time I uploaded the plot separately. Someday they'll support .PNGs too.

There's a free version of Tina called Tina-TI. It's far more robust than the original offering. Tina TI is a joint offering from DesignSoft & Texas Instruments.

Chris
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Bob, thanks for that. The schematics are generated in Tina by DesignSoft. I have two electronics CAD apps and 5 Spice apps.. Electronics Workbench, Visual Spice, LT Spice, ISIS and my beloved TINA Classic. I really do love it. It's, by far, the easiest to use. I find that I can draw and simulate a circuit in one tenth the time it takes me to do it in my other apps.

Probably one of her best features is component size. Unlike my other apps, I can build a high density schematic and not have to scroll the screen. The schematic that I posted was magnified 100 times before exporting it as a Jpg. I don't normally do this when I include a plot embedded in the schematic but this time I uploaded the plot separately. Someday they'll support .PNGs too.

There's a free version of Tina called Tina-TI. It's far more robust than the original offering. Tina TI is a joint offering from DesignSoft & Texas Instruments.

Chris
Thanks, I'll have to get the free version and try it out. With TI having consumed National, I would think they might have a good library of analog parts.

Bob
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Thanks, I'll have to get the free version and try it out. With TI having consumed National, I would think they might have a good library of analog parts.

Bob

I don't know if Tina-TI has the 'Create New Macro' feature enabled but one of the Macro options is creating the macro with pcode. I didn't have a MCP6021 model in my library so I googled and downloaded it.

Enjoy,
Chris
 
Top