this post was submitted on 07 Jul 2023
14 points (100.0% liked)

Ask Electronics

3316 readers
2 users here now

For questions about component-level electronic circuits, tools and equipment.

Rules

1: Be nice.

2: Be on-topic (eg: Electronic, not electrical).

3: No commercial stuff, buying, selling or valuations.

4: Be safe.


founded 1 year ago
MODERATORS
 

Hi! I'm working on an arduino project that has a -12v/0v/+12 psu. +12 is fed directly into arduinos voltage regulator, so there's also a +5v line available. I need to convert a -5v+5v signal to 0v+5v to feed it into arduinos analogue input and I've already mocked up a schematic in circuitjs based on an opamp that seems to do what I want. The only problem is that it needs -5v to shift the signal to be unipolar. I know that I can invert +5v using another opamp, but maybe there's some simpler way? I'd really like to avoid adding another opamp just for this? In this schematic I used simple voltage divider to get the needed voltage, but I guess that's not the best approach?

TLDR: I have -12v, 0v, +12v and +5v, what's the easiest way to get -5v?

top 9 comments
sorted by: hot top controversial new old
[–] grasib@lemmy.world 6 points 1 year ago* (last edited 1 year ago) (1 children)

Supply the OpAmp with +/-12V or +5/0V and use a non inverting Summing OpAmp Circuit to get your 0-5V signal. V1 is 5V, V2 your input.

[–] PinkDuck@kbin.social 1 points 1 year ago (1 children)

thanks! gonna give it a try tomorrow. I'm pretty new to this, and never used opAmps in non-inverting configuration, so I missed this option

[–] grasib@lemmy.world 1 points 1 year ago (1 children)

Exiting! It has been some time for me too, let me know how you solved the problem at the end.

[–] PinkDuck@kbin.social 1 points 1 year ago (1 children)

it worked! (at least in the sim)
thanks a lot!
I'm not sure I got all the math right, since I get 0 - 5.05V on the output, but it's not a deal breaker for me.
I attached the schematics, but not sure that images in comments federate from kbin to lemmy, so if you don't see it, try opening an original link to this comment.

[–] PinkDuck@kbin.social 1 points 1 year ago (1 children)

ah, a little bit of thinking helped me realize that I don't need 1k in inverting loop and then I'll get 5v instead of 5.05v :) and 100k can also be replaced by 1k

[–] grasib@lemmy.world 1 points 1 year ago* (last edited 1 year ago) (1 children)

So what should happen if you replace the 1k in the inverting loop by 0 Ohm is, you should get a 5V square wave.

Is that correct?

[–] PinkDuck@kbin.social 1 points 1 year ago (1 children)

No, with 0 Ohm I get a perfect 0+5v sine, just as I need. It's the other way round, it'll amplify the signal and clip off the top at about + supply voltage when you increase the resistance in the feedback loop, but it's not exactly square wave, as the bottom part of sine will remain intact. I use clipping schottky diodes to protect the arduino from voltage outside 0+5v range, this way if you increase input signal to say 20v peak to peak, you'll get more square-ish wave in 0+5v (I've attached the schematics)

[–] grasib@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

You’re right of course. Two more questions if you don’t mind:

    1. what’s the 1k || 100k doing?
    1. if you don’t want more than 5V at the output of the OpAmp, wouldn’t it be easier to just supply the OpAmp with 5V instead of adding a shottky diode which has a forward voltage of around 0.6V? As I understand the screenshot the voltage is 5.4V at that exact point and it could theoretically raise to 5.6V.

At the moment you’re also mixing up your + input. 10V AC + 5V DC result in 7.5V input in your sim.

[–] PinkDuck@kbin.social 2 points 1 year ago

Oops, the schematics didn't attach for some reason, let's try to add it here

load more comments
view more: next ›