Maker Pro
Maker Pro

BJT Ramp?

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hello,

I am pretty new to trasnsistors and lately I had calculated a ramping circuit using a simple Pn2222 transistor. When the input was 2.0VDC at the base, Vc was 1VoltDC. As the input to the base voltage ramped up towards 3.3 VDC, Vc ramped down to 0.5VDC. Therefore, this circuit had a gain of:

G = Vo/Vin = (1.0 - 0.5) / (3.3-2.0) = 0.3846

However, Now I need a different ratio which is:
G = Vo/Vin = (1.0 - 0.5) / (2.5-2.0) = 1

Therefore in this new circuit I need a ratio 1 : 1. Please view my circuit in attachment. If Vs = 2.0VDC, Vc has to equal to 1VDC. As Vs ramps up to 2.5VDC, VC has to proportionally ramp down to 0.5VDC. Having specified this, I don't understand how to calculate R1 and R2 in order for the transistor to provide this ratio between the input (base) and the output (Vc)?

At these voltages and currents, this transistor's Beta is approx 139 and Vbe is 0.639VDC. Therefore if Vc = 1.0 VDC, we get an Ic of: (3.3-1.0)/2400 = 958.3 ua.

Divided by 139 we get an Ib required of 958.3/139 = 6.894 ua. These currents are pretty exact as I have measured the Vdrop across RB and the ohmic value of RB and calculated the currents.

At 2.0VDC for Vs, Rb should be (2.0 - Vbe) / 6.894ua = 197K
I bleed the 6.894ua through R2 in order to keep my 1VDC at Vc.

Therefore R2 is:
R2 = Vbe/Ib = 0.639/6.894ua = 92K

When I try this circuit with R1 as 200K and R2 as 100K, Vc's ramp is way off...
When Vs = 2.0VDC, Vc = 0.95 VDC. Which is close to 1VDC. But when I ramp Vs up to 2.5VDC, Vc = about 0.84VDC which is not acceptable... as I was expecting 0.5VDC.

Does someone know what I am doing wrong?
Discouraged!

Thanks all.
 

Attachments

  • HiResSol.jpg
    HiResSol.jpg
    40.5 KB · Views: 132
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
What is it you are trying to do? Ramp certainly does not describe the function of your circuit, inverter would be more like it. Ramp would describe a circuit whose output increased (or decreased) linearly with time.

Bob
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
hi,

vs will be a signal from a dac output with a certain ramp frequency.
so the timing is taken care of by the ramping signal. vs will start at
2vdc and ramp up to 2.5Vdc. in contrast, at the output I need 1.0 v dc
to 0.5vdc.

thanks
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
An opamp is the right device to use for this. It can invert / amplify / offset a signal, and do it very accurately.

Bob
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
I don't know op amps!

For now, I am pretty sure this can be done with transistors please!

Can anyone please help me with the collector feedback circuit as posted to acheive the ramping specs.

Thanks all in advance!
 
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Then it is time to learn! The opamp circuit is this simple (see attachment)

The blue line is the input ramp from 2.0V to 2.5V.
The green line is the output from 1.0V to 0.5V.

To do this this accurately with transistors, you would essentially be inventing the opamp.

Edited to add: The op amp can be any single supply op amp that can work at 5V. The lm324 is a popular one that should work okay.

Bob
 

Attachments

  • ramp.JPG
    ramp.JPG
    81.3 KB · Views: 161
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
By the way, I designed this circuit on paper and it worked in simulation exactly as designed with no twiddling necessary. That is the beauty of op amps. They behave like an ideal mathematical amplifier when used within their limits. If you want to progress in electronics, learning op amps is essential.

Bob
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
vs will start at
2vdc and ramp up to 2.5Vdc. in contrast, at the output I need 1.0 v dc to 0.5vdc.
So the transfer function is Vout=3V-Vin. As Bob wrote, this is easy with an OpAmp.

If for whatever reason you want to stick to dicrete transistors, this can be done, but is much more difficult. Here is a basic discussion on that type of amplifier.
vs will start at
2vdc and ramp up to 2.5Vdc. in contrast, at the output I need 1.0 v dc to 0.5vdc.
So the transfer function is Vout=3V-Vin. AS Bob wrote, this is easy with an OpAmp.
If for whatever reason you want to stick to dicrete transistors, this can be done, but is much more difficult. Here is a basic discussion on that type of amplifier.
Checking the amplifier only at Vin=2V and Vin=2.5V is not sufficient to guarantee a linear transfer chracteristic. You will need some negative feedback in order to compensate for the non-linear transfer characteristic of the transistor

I really recommend using Bob's circuit. It will take a lot of follow-up work from you.

Harald
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Okay guys, I will use Bob's circuit. A few questions before I build it though...

1) Just to confirm, V1 = +5VDC and V2 = my Vs ramp voltage of 2.0V to 2.5VDC right?
2) No negative voltages are required ... right?
3) LT1006 is the part number of the OPAMP. But I will use the LM324N.... is this okay!

Thanks for your help
24V
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
1) right
2) right
3) LM324 is o.k. in this application. Note that the LM324 operates with input voltages up to Vcc-1.5V and can only drive output voltages up to Vcc-1.5V. Since Vcc=5V and Vin or Vout <3V rhis is. o.k.

Harald
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
hi Harald,

tomorrow i will go out and buy me a few op amps LM324 pdip. i will also look at some op amp tutorials so i know a little what i am doing here. which other opamp do you suggest i buy to keep in my handy stash? i see often the 741, is this a popular opamp and which others would be useful for newbie circuits like:

diff opamp
inv/non inv opamp
opamp comparator
operational amplifier
summing amplifier

keeping in mind i am usually working with voltages between 0V to 12VDC

on another note... if i may ask.... all these transistor circuits with collector feedback resistor, emitter feedback resistor and voltage divider feedback resistor configurations.... what good are they if op amps can do all that anyways???

thanks
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Don't buy OpAmps on stock. There are so many parameters that a single OpAmp cannot fit. For example the operating voltage and the input and output ranges (keyword: rail-to-rail), bandwidth, slew rate, etc. etc.

Get 2 or 3 LM324s so you have a spare part or two in case of a mishap with your circuit during the first tests. If some of the chips survive, they are well suited for other experiments to get you acquainted with OpAmps since the LM324 is a rather good-natured part.

The 741, while once a very common type of OpAmp, today is outdated. And it will operate only very limited with single supply voltages.

Once you have grabbed the principles of OpAmps come back to this forum if you need help in selecting an OpAmp for a defined purpose.

There is a comprehensive and free collection of basic articles on OpAmps available at Texas Instruments.

Regards,

Harald
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Okay Harald, thanks for your advice.

Stay tuned... I will let you know if the circuit works!!

sincere regrads
24v
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Confirmed. Be aware that you need a 5V regulated supply, otherwise the voltage output will vary with the supply voltage. You can use a different (regulated) supply voltage, but you will have to change the divider that is setting the voltage on the +_input so that it is set to 1.5V. If you must use a regulated supply, you will need a voltage reference to set the bias on the + input.

Bob
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Wow!

Worked the first shot!!! :)

Unbelievable!

I cannot thank you guys enough!

Now, I really want to learn more abpout op amps :D

sincere regards
24V
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hi guys,

I have adjusted my reference voltages to my dac so they are very precise. So the output of my DAC is giving exactly 2.5VDC->2.0VDC. As you know this voltage ramp is fed into the op amp circuit.

Out of the op amp as you know, we are supposed to get the following relation:

DAC >>>> 2.5VDC ->2.0 DC
OP AMP >>>> 0.5VDC->1.0VDC

in reality what I get is:

DAC >>>> 2.5VDC ->2.0VDC
OP AMP >>>> 0.578VDC ->0.959VDC

Which to me is still *very* acceptable!

But I noticed that between 2.5 and 2.42VDC, the opamp stays pretty much at 0.578VDC which means that there is 0.08VDC that is wasted.Then and only then the 0.578VDC starts to ramp up. This means that approximately 41 of my 256 DAC steps are lost. Now I know that this is not due to the circuit it's self but perhaps has to do more with the resistor tolerances used with the op amp.

Can someone show me which resistor in the op amp circuit can slightly be varried so to make up this difference! I think I could vary the feedback resistor but I am not sure???

Thank you so much for your much appreciated help and suggestions!
24V
 
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I don't see how the output voltage can not change with changing input. The gain and offset voltage could be off due to the tolerance of the resistors, but it should still behave liinearly over the entire input range. What is the load on the op amp output? It should be no more than 1K.

To calibrate it, you need to adust the gain to 1.0 and the offset to 1.5V.

The gain is set by R1 and R2 and it is R1 / R2 you could use precision resisitors or use a trimmer to adjust it.

The offset is given by the divider made up of R3 and R4. Their junction should be adjusted to 1.5V.

Edited to add: I would expect your results to be much better, within a few millivolts.

Bob
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hi Bob,

Well, VR4 is 1.507VDC. So I believe that I wouldn't question R3 and R4.

Also to avoid confusion, I did not not connected the output of the op amp to anything while doing my adjustments!

I tried trimming R1 so that the output is exactly 0.5 when the input is 2.5V. But then when I adjusted the input to ramp down to 2.0V, the output is 0.855VDC. So I trimmed R2 until the output was 1.009 VDC.

I realized that adjusting R1 fine tunes the bottom range (0.5VDC) and adjusting R2 fine tunes the top range (1.0VDC). Or is it the other way around... uh! :cool:
I don't remember... but just to say that now it works perfectly!

The only pet peeve I have here is the Max/Min voltage references I provide to my DAC. I use 2 voltage dividers for this. The first voltage divider provides the DAC with 2.0VDC and the 2nd voltage divider provides the DAC with 2.5VDC. These Min/Max DAC voltage references provide the ramping voltage output of the DAC as seen by our op amp.

But these darn Min/Max voltage references coming out of my voltage dividers dance all over the place. For example I adjust the 2 volts voltage divider to exactly 2.011VDC. Then I go back a minute later and its 2.056VDC and then later it goes to 1.998VDC. And it dances around like that all the time. Its really starting to annoy me because it affects the precision of what the op amp sees. I guess I would have to get voltage references... right. But all I found for my voltages are 2.048VDC and 2.5 VDC!!! Isn't the 0.048 going to make a difference????

Oh! By the way, in usual operation, the output of the op amp gets connected directly to the base of a PN2222 transistor. The emitter of that transistor has an Re resistor to it. This transistor controls the intensity of an IR led. But I see no difference in the output of the op amp when it is or when it isn't connected to the base of the transistor.

Man!!! is this stuff sensitive... I have been measuring all day... :eek:

Thanks Bob for your help, it's really appreciated!
24V
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Bob and Harrald!! I unfortunately need your help once more!

My ranges to the op amp were 2.0V->2.5VDC with an output of 1.0->0.5VDC.

It was great and it worked !!! The 2.0VDC was fed into my DAC reference voltage via a voltage divider. But now, I am using a voltage reference chip and it gives 2.070VDC instead of 2.0VDC.
This changes things. So, now I need the op amp to react as follows:

2.070V->2.5VDC "IN" with 1.0V->0.5VDC "OUT"

I tried trimming R1 and R2, I don't seem to be able to get the exact ranges anymore!!
Every time I adjust one range limit, the other one is off??

And since I have not had a chance to read up on op amp theory yet I am stuck!!!

Is there a new set of resistor values for R1 and R2 I should use given these new parameters.

Thank you so much for your help!

24v
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Okay, I have managed to trim R3 along with, R1 and R2 and I am able to get exactly:

2.070V->2.5VDC "IN"
1.001V->0.53V "OUT"

Which is very acceptable for me! The ONLY problem:

R1 = 31.25K
R2 = 28.65K
R3 = 3.293K

Where am I supposed to get these extremely precise resistors? :eek:

If I change any of these values just by 100 or even 50 ohms, the ramp will be off :(

So what do we do in a case like this? :cool:
 
Top