Notifications
Clear all

OpAmp to transduce for Teensy

15 Posts
3 Users
0 Reactions
194 Views
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

Hi All,

 

Could someone help me design an OpAmp  circuit which will modulate a 0-3.3vdc signal with a -10 to +10vdc signal? 

 

I am building a static 727 simulator using OEM parts and interfacing them using Teensy microcontrollers. The Teensy  can transduce a 0-3.3vdc signal which I can then  use  to code objects in the simulator software (for example, use it to control a heading bug). 

 

In this case, a lot of the OEM equipment that I am using supplies signal voltage on a -10 to +10vdc scale and I need to use this signal to modulate the 0-3.3vdc signal going to the microcontroller.

 

In addition to the Teensy's, I have -15 and +15vdc power supplies for the rails.

 

bbutcher85 - if you're here ...I am forbidden from DM'ng you because of restrictions to new users who havent posted more than 10 times... your design for the opposite (0-3.3v signal from the Teensy modulates a -10 to +10vDC signal) works like a charm! Ive gone ahead and printed a bunch of them and they have proven to be a lifesaver with this project. Hope you can work the same genius advice here.

 

Thank you all in advance. This group is fantastic.

 

Jon Weiswasser

 

 


   
Quote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

Hello Jon,

The same circuit can be used to do what you want with a few minor changes. Your output load requirements seem to be a lot lower than the previous circuit since you are not be driving high currents. In that case you can substitute much lower current transistors for the output push-pull driver. In fact you may even be able to just delete U1C, Q1, and Q2 and take the output directly from the output of U1B. In that case you could use a dual op-amp (e.g. LM158) instead of the quad op amp from the previous circuit. 

Note in the circuit the gain of the first stage (U1A) has been changed to -0.165 (-3.3/20) where the - signifies it inverts the input signal. The gain of an inverting op amp is -Rf / Rin or -R5 / R4 in this case.

The positive input of the first op amp is set to approximately -1.65 volts by the voltage divider R1-R3 and the 10K pot R2 allows adjustment to get the output exactly where you want it. The output should be -3.3/2 = -1.65V with zero input, hence the offset of -1.65V applied to the positive input. 

The second stage (U1B) is simply an inverter with a gain of -1 to change the output of the first stage from 0 to -3.3V to 0 to +3.3V. The 10K resistor R8 could be any value including zero, but it is good practice to use about the same value as the input resistor R6 to prevent the output being offset by unbalanced input currents.

If indeed your load is only the analog converter in the teensy, then the simplified circuit should work just fine. The push-pull stage is only needed if you are driving a fairly high current load such as in the pervious project.

I hope you are getting a better understanding of how op amps work. 

Bob

push pull output + 10 to 3 3
Simplified + 10 to 3 3

 


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

Hi Jon,

There is a simpler way to do this with a voltage divider. The calculation of resistor values gets a bit messy, but here is a circuit that will get you close. The output voltage vs input voltage for this circuit will be:

-10 V        0.04878

0v            1.674797

 +10V       3.300813   

Or changing values slightly, R1=1.58K, R2=3.16K

-10v         0

0V           1.623377

+10V      3.246753

I can show you how this is calculated if you really feel masochistic.

 

Bob

voltage divider
This post was modified 2 weeks ago 2 times by bbutcher85

   
ReplyQuote
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

Bob- 

First, I seriously can’t thank you enough. I want to send you a picture of how far I’ve taken the original circuit design you gave me! I’ll try to attach it here, but it’s been a fascinating learning process you’ve launched me on and I am eternally grateful. 

im going to build both - the simplified dual op amp one and the really simple one. The transistor one is a little out of my league - I tried it with the other circuits and I was able to generate some smoke. Also, I couldn’t find ones that were small enough for a breadboard - the ones I used were big metal disc ones that were a bit unwieldy. It seems to have not mattered much anyway. 

Again, MANY thanks and I’ll let you know how this turns out tomorrow when I sit down and experiment with it. 

Jon

IMG 5034

ps - these are the printed and populated version of the original design you gave me!

 


   
ReplyQuote
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

Bill -

One more question… 

The opamp you have in your schematic is a quad channel Lm324, but the schematic only has you using two channels. Would an Lm358 suffice here?

Jon


   
ReplyQuote
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

@bbutcher85-

Bob- One last question - (and see above...sorry about the typo on your name - autocorrect on the mac..)

 

Would a dual channel opamp like the LM358 work just as well as the quad you have in the schematic?

 

 

Jon

 


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

Yes, you could use almost any op amp that can handle the voltage in your power supplies. The only exception might be if you have very high frequency requirements, and from what I understand your transducers are low frequency. Op amps have a gain-bandwidth rating. This means that you multiply the frequency of your inputs by the gain in any one stage of the op amp to get the required gain-bandwidth. For example if your inputs were changing at a frequency of perhaps 100 kHz and you wanted to amplify the signal by a gain of 10, then you would require a gain-bandwidth of 10*100kHz = 1 MHz or higher in the op amp to achieve the desired result.

Bob


   
ReplyQuote
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

@bbutcher85

I built the super simple one and it work like a charm! Do you know how I could incorporate another voltage divider ahead of the 5v supply that would bring the +15v power supply Im working with to the 5v needed to supply this circuit? Then I could incorporate this on a PCB with the other OpAmp circuit you gave me a couple months ago using one power supply. 

You are THE BEST. DM me your address so I can send you a bottle of single malt.

Jon


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

Hello Jon,

The best way to use the 15 volt supply would be to just change resistor values to allow using +15 volts for the reference instead of 5 volts. The circuit I sent previously was an approximation that was found by using a spreadsheet to iterate resistor values and get close to the desired result. I will show you how to calculate the exact values using algebra and the information we know.

You probably already know this, but there is an equation for voltage dividers that will calculate the output voltage knowing the input voltage and the resistor values. The attached divider schematic shows the circuit and the equation.

Divider

Vout = Vin * R2 / (R1+R2)

In the example the output voltage would be Vin * 10K / 30k = Vin / 3.

If you have two resistors being in parallel, the notation used will be R1||R2 to show R1 is in parallel with R2. This can be useful if you need a non-standard value, simply place two or more resistors in parallel to get the desired result. The resulting equivalent parallel resistance is calculated using the parallel resistance equation. For any number of resistors in parallel the equivalent resistance is:

1 / Req = 1 / R1 + 1 / R2 + .... 1 / Rn

For two resistors in parallel this can be rearranged to:

Req = R1 * R2 / (R1 + R2)

When you have multiple inputs as with the circuit where you want an offset, the problem becomes a little more complicated. In this case you can use a technique called superposition to calculate the output from multiple inputs. The idea is to calculate the output voltage for one input at a time and then add the voltages together to get the final result. When you do this, you must replace any unused voltage input with a short to get the correct answer. This results in some resistors being in parallel.

The general idea is to assign an arbitrary value to one resistor (e.g. R3 = 1K = 103). The input voltage used to create an offset is fixed at 5 volts. We know that when Vin = -10 that Vout =0, and when Vin = +10 that Vout = 3.3. Also when Vin = 0 then Vout = 3.3 / 2 = 1.65. 

Next plug into the equation for Vout the parallel equations from above and simplify. The solution is shown on the attached figures, calculation of R values and calculation 2.

Just change the voltage from 5 to 15 in the equations and you should get the result. Note that Eq2 will be different for 15 volts so when you go to the next step, use the new value for R2.

If you get hung up, let me know and I will assist you.

Calculation of R values
Calculation 2

Bob

bbutcher85@yahoo.com

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2571
 

@bbutcher85 

I'm curious. The circuit you provide will give a 5V supply at Vout, but you've limited the current there to 15V/20K = .75 mA. So unless this is just to provide a voltage reference level it may be too limiting for other use.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

@will 

Hi Will,

The design is intended for use with an analog to digital converter in a teensy processor. I assume the input impedance for this device is very high so virtually zero current will be required. Perhaps this assumption is incorrect?

Bob


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2571
 

@bbutcher85 

No, I'd expect that would be acceptable. I just wanted to point out that this isn't suitable for making a general purpose voltage supply.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

@will 

You are correct, however the same method can be used by placing the expected input impedance in parallel with R3. Or simply assign a lower value for R3 which is an arbitrary value anyway. For a more dynamic solution you can use an op amp with very high input impedance and very low output impedance to get higher precision.

Bob


   
ReplyQuote
(@bbutcher85)
Member
Joined: 2 years ago
Posts: 24
 

If you change the 5 volts to 15 volts, and go through the calculation for resistor values you should get R2 = 0.66667 R1 and R1 = 6667. Therefore R2 would be 4444.

The nearest standard values of 1% resistors are 6650 and 4420 ohms. You could probably get closer by using a parallel or series combination, but the resistor tolerances are still +-1%, and they probably have a temperature coefficient as well.

Bob


   
ReplyQuote
(@jonweisw)
Member
Joined: 7 months ago
Posts: 12
Topic starter  

@bbutcher85

Bob - Lots to digest here. Thank you so much for taking the time to explain this to me and Im gonna save this thread, study it, and commit it to my slowly growing arsenal of tools for this project.

 

Out of curiosity, what if I used a voltage regulator, for instance a L7805? I could probably power three or four of these circuits from one of these and eliminate a lot of loose wiring, no?

 

Jon

 


   
ReplyQuote