scaling and shifting lfo to 0...5V

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: Kent, Joe., luketeaford, lisa

Post Reply
User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

scaling and shifting lfo to 0...5V

Post by ello » Fri Nov 29, 2019 5:25 pm

hello, i need to create a 0....5V output from possibly any input that i get in my modular, so i thought of building this circuit.

Image

would this work? is there another preferable way of doing this? i have build an arduino based module and would like to add some cv modulation inputs.

basically i want to maintain the lfo shape to a certain degree at least for voltages from -5 to 5V, i don't really care if voltages like -8/+8 get clipped as i can use an attenuator before entering the above circuit.

any advice?
You do not have the required permissions to view the files attached to this post.

User avatar
Troubleshooter
Wiggling with Experience
Posts: 379
Joined: Thu Oct 01, 2015 8:21 am
Location: Belgium

Post by Troubleshooter » Fri Nov 29, 2019 5:35 pm

Hi,
I would use a Gain&Offset opamp cirquit with just one TL072 and 2 pots. In the first stage sum (using one opamp) your input with a pot sweeping between your voltage rails. In the second stage use a non inverting gain stage (use the 2nd opamp) with variable gain.
Really just opamp basics.
http://www.ti.com/lit/an/sloa097/sloa097.pdf

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 2:32 am

wow. that is awesome. thank you very much. figure 4 seems to be exactly what i need. i am just unsure about the potentiometers you mentioned, since i need do make sure not to leave the -0.5 ... 5.5V range at any time. since that would possibly destroy the arduino.

but is that even sure using the clamping diodes? would they need ground and +5V or even other reference?

User avatar
latigid on
Ultra Wiggler
Posts: 967
Joined: Fri Oct 25, 2013 11:05 am

Post by latigid on » Sat Nov 30, 2019 5:21 am

Resistors a bit low perhaps? I did something similar with 50k input impedance.

If you make the second op amp stage an MCP600X powered at the MCU voltage you don't need any further protection and probably no output resistor.

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 5:33 am

i must admit that i don't really understand how to pick certain resistor values. guess i need to continue learning some basic electronics understanding.

as to the MCP600, the characteristics mention VSS – 1.0V to VDD + 1.0V for the analog inputs and VSS – 0.3V to VDD + 0.3V for the others. so wouldn't that chip burn when a voltage between -8...+8V enters while it is powered at +5V?

User avatar
latigid on
Ultra Wiggler
Posts: 967
Joined: Fri Oct 25, 2013 11:05 am

Post by latigid on » Sat Nov 30, 2019 5:48 am

Generally an op amp (with suitable current limiting) will clip/distort signals outside the rail voltages to those rails. You can condition the input with the TL07X so that clipping is avoided, but it shouldn't hurt if the voltages are outside the limits.

Image

The Mutable Instruments way is to use one inverting amplifier (MCP600X) and treat the inverted CV in software.
Last edited by latigid on on Sat Nov 30, 2019 6:04 am, edited 1 time in total.

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 5:59 am

cool. thank you. i will maybe even sacrifice an opamp to check how it behaves on this just for the sake of experimenting. i guess it is worth it :)

User avatar
SphericalSound
Wiggling with Experience
Posts: 366
Joined: Thu Feb 01, 2018 9:23 am
Location: Spain

Post by SphericalSound » Sat Nov 30, 2019 8:05 am

The arduino (328 at least)pins are quite hard to kill . If you put a 1k resistor before they can resist -5, -10v constinously and not die.

Just protect with 1k and you are good

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 2:05 pm

since i have only some tl07x opamps at home i tried the following circuit. it acts totally weird. i know this simulation (http://tinyurl.com/ru2nrzn) should not be taken too serious, but i didn't expect it to be that off.

my circuit in reality outputs between -0.09V on -12V input and 2.6V at 12 V input. and 2.2 at 5V input. i tried different chips because i thought it was broken, but seems to be the circuit itself. is it soo much misbuilt?

Image

@SphericalSound this sounds like a last solution if i cannot get some useful scaling to work. i want at least reach some 0...1023 result at the analog input for a range between -5 to 5volts. clipping for higher inputs like from my doepfer lfo which outputs -8...8volts but to completely loose the negativ inputs is not that preferred, too.

next i will try the circuit with inverting in the first stage and inverting it back in a second stage. just to see if that works.

User avatar
PrimateSynthesis
Super Deluxe Wiggler
Posts: 3487
Joined: Tue Mar 15, 2011 6:50 pm

Post by PrimateSynthesis » Sat Nov 30, 2019 2:39 pm

ello wrote: my circuit in reality outputs between -0.09V on -12V input and 2.6V at 12 V input. and 2.2 at 5V input. i tried different chips because i thought it was broken, but seems to be the circuit itself. is it soo much misbuilt?
Firstly, you should never draw power pins like that.

Secondly, a TL072 can't go below the negative rail.

Thirdly, the best way to make sure that the output cannot go negative, is to power it single-sided.

Fourthly, you don't need voltage dividers to ground. Let the op-amp do the dividing.

I built a little -5/+5 to 0/+5 converter box many years ago. It used one dual op-amp (LM358, LT1013, I don't remember, but those are both good choices). I ran it off +15 and ground (because my modular is 5U). Sorry, I looked for a schematic, but I couldn't find it. Anyway, you would use different values, and it should be easy to figure out. Add +5V with the first op-amp, so it's 0 to +10, then divide it in half with the second op-amp to get 0 to 5V.
FS: Rare Morley Rotating Wah Oil Can Delay!

Since the forum has gone back to being 100% community funded, I've decided to donate half the proceeds from the Morley Rotating Wah this thread is supposedly selling :miley:

https://www.muffwiggler.com/forum/viewt ... p?t=131332

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 4:17 pm

thanks for your insight.

what exactly is wrong with the pins?

i tried building it the way you described. maybe i got a whole packet of faulty opamps, since none of them do anything like they should. and a while back, i built some buffered multiples as well as inverters and those all worked without any issues. so i am really starting to think they are all broken... guess i need to go to my local electronics dealer and get some from there

Synthiq
Veteran Wiggler
Posts: 602
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Post by Synthiq » Sat Nov 30, 2019 6:21 pm

ello wrote:since i have only some tl07x opamps at home i tried the following circuit. it acts totally weird. i know this simulation (http://tinyurl.com/ru2nrzn) should not be taken too serious, but i didn't expect it to be that off.

my circuit in reality outputs between -0.09V on -12V input and 2.6V at 12 V input. and 2.2 at 5V input. i tried different chips because i thought it was broken, but seems to be the circuit itself. is it soo much misbuilt?

Image

@SphericalSound this sounds like a last solution if i cannot get some useful scaling to work. i want at least reach some 0...1023 result at the analog input for a range between -5 to 5volts. clipping for higher inputs like from my doepfer lfo which outputs -8...8volts but to completely loose the negativ inputs is not that preferred, too.

next i will try the circuit with inverting in the first stage and inverting it back in a second stage. just to see if that works.
The TL07X is only specified to operate with at least 10V supply (or +/-5V) so I can imagine you have a problem if you supply only 5V. On top of that, the input common mode range (according to the spec) doesn't include 1.67V from the negative supply even in the typical case. Likewise, the output has a problem reaching less than 1-2V from the supplies so this application isn't really a good fit for the TL072. You would be better off to still drive the opamp from a higher +/-12V supply and just limit the input current to the Arduino with a resistor. The ADC in the 328 controller allow as much as 10kohm in source resistance in case you want to limit the input current even more.

Note also that if the input is not driven, the amplifier will act as a voltage follower and the ADC will see the same voltage as on the non-invering input of the opamp and not 0V. This may or may not be an issue. The circuit in your first post doesn't have this problem.

User avatar
Mungo
Super Deluxe Wiggler
Posts: 1186
Joined: Fri Jan 04, 2013 8:12 pm

Post by Mungo » Sat Nov 30, 2019 6:25 pm

ello wrote:what exactly is wrong with the pins?
Some people don't like the power pins on the functions, style choice. Another issue is not having the pins labelled so if you flip or rotate the part its hard to tell which is + and which is -
ello wrote:my circuit in reality outputs between -0.09V on -12V input and 2.6V at 12 V input. and 2.2 at 5V input. i tried different chips because i thought it was broken, but seems to be the circuit itself. is it soo much misbuilt?
ello wrote:i tried building it the way you described. maybe i got a whole packet of faulty opamps, since none of them do anything like they should. and a while back, i built some buffered multiples as well as inverters and those all worked without any issues. so i am really starting to think they are all broken... guess i need to go to my local electronics dealer and get some from there
The TL072 parts are probably working just as they would be expected to. Simulations rarely match all the real world parameters of the parts (good simulations are very slow, so they are usually simplified). The "gotchas" are all listed in the data sheet:

Supply voltage, min: +/-5V, max: +/-15V
Common-mode voltage, min: VCC– + 4V, max: VCC+

Extended data sheets show the maximum output voltages too, which with a 0-5V supply for a TL07x are worst case no drive at all (minimum output and maximum output limits are overlapped).

Now consider how the specifications for the MCP6002 are different.

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 6:50 pm

thank you both for the explanations it makes totally sense that i have the issues, if the input voltage slips out of the input range.

however, i seem to not really understand the background. the mcp6002 has a supply voltage from 1.8 - 6.0V, and to my understanding a very small input range of +-300mV. i must completely misunderstand the mechanisms there or does this mean i may be able to find an opamp maching my special case?

.. btw, i still don't understand about the pins. in the schematics?


for the sake of it, i just added the 1k resistor and use the voltage block to sequence the cv, as that codewise already works.


edit: wouldn't a LM741 be a good choice?

User avatar
Mungo
Super Deluxe Wiggler
Posts: 1186
Joined: Fri Jan 04, 2013 8:12 pm

Post by Mungo » Sat Nov 30, 2019 7:13 pm

ello wrote:however, i seem to not really understand the background. the mcp6002 has a supply voltage from 1.8 - 6.0V, and to my understanding a very small input range of +-300mV. i must completely misunderstand the mechanisms there
Probably a misunderstanding, consider their input common mode range when using the same terms and format:
MCP6002: Common-mode Input Range, Min: VSS - 0.3, Max: VDD + 0.3
TL072: Common-mode Input Range, Min: VSS + 4V, Max: VDD + 0V

There is a "class" from Ti on the subject, TIPL 1130:
https://training.ti.com/system/files/do ... ides_0.pdf

User avatar
ello
Common Wiggler
Posts: 100
Joined: Mon Sep 26, 2016 1:39 am
Location: lachendorf

Post by ello » Sat Nov 30, 2019 8:21 pm

awesome. thanks for the link. this is really helpfull and right about time to wrap my head around it

Post Reply

Return to “Music Tech DIY”