Author Topic: Amplify 500mV 0-pk square wave to >2V for PIC MCU  (Read 6145 times)

0 Members and 1 Guest are viewing this topic.

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #75 on: April 03, 2023, 09:28:32 pm »
If your symptom is 'stuck low' you may have miss matched transistors...

When you say "mismatched," do you mean two wildly different HFE values?
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1559
  • Country: au
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #76 on: April 03, 2023, 09:32:52 pm »
If your symptom is 'stuck low' you may have miss matched transistors...

When you say "mismatched," do you mean two wildly different HFE values?
Yes, the threshold spice gives assumes roughly matched transistors. With a triangle wave injection your circuit is now working, it then becomes a matter of setting the threshold
If Vbe or hFE are too different, will move the operating point slightly.
Did you try the ~250mV threshold resistor values ?
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #77 on: April 03, 2023, 09:54:56 pm »
Did you try the ~250mV threshold resistor values ?

I am away from the bench right now, but I will try it later today.  Thank you!
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #78 on: April 04, 2023, 01:46:58 am »
If your symptom is 'stuck low' you may have miss matched transistors...

When you say "mismatched," do you mean two wildly different HFE values?
Yes, the threshold spice gives assumes roughly matched transistors. With a triangle wave injection your circuit is now working, it then becomes a matter of setting the threshold
If Vbe or hFE are too different, will move the operating point slightly.
Did you try the ~250mV threshold resistor values ?

I measured the HFE values of both transistors in my breadboard circuit, and both are above 200, as shown in the attachments below. Specifically…

Q1 = 222
Q2 = 241

And while the 2 HFE values are not identical, they are perhaps close enough to where it shouldn’t really matter.

I also bench-tested the two resistor values you proposed in your attached schematic in Reply #70. Specifically…

R1 = 12k
R4 = 4.7k

But there’s not really any change at all. As I said in my earlier post, the problem is that when I use the DC offset adjustment of my function generator to make the waveform to be above 0 V, the output of your circuit basically goes to zero. You can see this in two attachments below. With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.

Why am I trying to make the output waveform of my function generator to be above 0 V? Because the car side waveform has its low side at 0 V and it’s high side at +500 mV. As such, it is necessary for me to replicate the car side waveform on my function generator for my bench test to have any meaning.

Any further thoughts would be appreciated. Thank you.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1559
  • Country: au
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #79 on: April 04, 2023, 03:32:27 am »
With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.
The output should swing to close to 5V, so something is incorrect. Maybe resistor values are incorrect ?


With the input simply grounded, (150K 12k 4k7) Spice gives 
Vbb    = 680.33099mV 
Vbase = 344.21611mV  so that means Q1 is comfortably OFF.
When the input lifts to 258mV, the collector has dropped from 5V to ~2.5V
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1328
  • Country: ca
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #80 on: April 04, 2023, 04:35:27 am »
With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.
The output should swing to close to 5V, so something is incorrect. Maybe resistor values are incorrect ?

I suspect that the OP has connected R3 (150K) to the collector of Q2 instead of the base.

« Last Edit: April 04, 2023, 04:38:23 am by Kim Christensen »
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #81 on: April 04, 2023, 05:56:11 am »
With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.
The output should swing to close to 5V, so something is incorrect. Maybe resistor values are incorrect ?


With the input simply grounded, (150K 12k 4k7) Spice gives 
Vbb    = 680.33099mV 
Vbase = 344.21611mV  so that means Q1 is comfortably OFF.
When the input lifts to 258mV, the collector has dropped from 5V to ~2.5V

Resistor values are absolutely correct. I don’t rely on color codes. I measure each and every resistor to know absolutely what the resistance value is.

Since you made no mention of a load resistor, I tested without a load resistor and with a load resistor that measures 1.6M ohm. The output values I measured we’re very similar, so the numbers I will report below were measured without any load resistor at all.

With the input grounded, the output is 5.01 V, as measured on my Fluke 8845A.

I put a Kikusui PMC35-3 variable power supply on the input so that I could slowly increase the voltage from 0 V to your recommended 250 mV. Because this is an analog power supply, I cannot get exactly 0.25000 V. However, I was able to increase it to 0.252 V, and with that voltage on the input, the output falls only slightly to 4.851 V.

However, if I continue to increase the input voltage to 326.3 mV, the output will drop to 2.553 V. In other words…

Input=0v, Output=5.0V
Input=252mV, Output=4.851V
Input=326.3mV, Output=2.553V

When I simulate that same circuit, I get this…

Input=0v, Output=5.0v
Input=252mV, Output=3.25v
Input=326.3mV, Output=90.94mV

At this point, I'm not sure we are really making progress.  The only thing I can suggest is that I purchase a dual BC847B to ensure the hFE of both NPNs is the same and then I can breadboard that. I found 8 part numbers in stock at DigiKey from reputable vendors.  Please let me know which part number I should buy, and I will go proceed with that.  Of course, I will also be testing the comparators when they arrive as well.
« Last Edit: April 04, 2023, 06:31:36 am by JDW »
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #82 on: April 04, 2023, 06:06:07 am »
I suspect that the OP has connected R3 (150K) to the collector of Q2 instead of the base.

Your suspicion is wrong.  R3 is correctly breadboarded between Q2 Base and +5V as shown in the attachment below.  (2SC1815 is ECB.)
« Last Edit: April 04, 2023, 06:14:25 am by JDW »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1559
  • Country: au
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #83 on: April 04, 2023, 07:41:48 am »
However, if I continue to increase the input voltage to 326.3 mV, the output will drop to 2.553 V. In other words…

Input=0v, Output=5.0V
Input=252mV, Output=4.851V
Input=326.3mV, Output=2.553V

When I simulate that same circuit, I get this…

Input=0v, Output=5.0v
Input=252mV, Output=3.25v
Input=326.3mV, Output=90.94mV
At this point, I'm not sure we are really making progress.
That's good, you have found a 50% threshold point. It's about 66mV higher than my sim, which is not massive.

Increase that Biased DC Vin slightly more, and it should give you the 0.5V point - useful spec points are 50% and the 10%/90% points.

The only thing I can suggest is that I purchase a dual BC847B to ensure the hFE of both NPNs is the same and then I can breadboard that. I found 8 part numbers in stock at DigiKey from reputable vendors.  Please let me know which part number I should buy, and I will go proceed with that.  Of course, I will also be testing the comparators when they arrive as well.
You could get BC846B / BC847B for lowest cost and the  BCM846B / BCM847B are the Nexperia / Diodes matched pair specs.
I'm not sure you really need the tight matching those give (2mV on Vbe) but you could try some of each.
Single package give you same-vendor/batch/date code and same temperature, which is a good improvement over separate packages.


Addit: I skewed the gain in spice, by selecting a badly-wrong-suffix part and it moves the threshold roughly +/- 25mV
Skew  Q2=BC847A, Q1=BC847C = 233.33334mV @ 50%
Match Q2=BC847B, Q1=BC847B = 258.26559mV @ 50%
Skew  Q2=BC847C, Q1=BC847A = 284.01084mV @ 50%
« Last Edit: April 04, 2023, 08:06:25 am by PCB.Wiz »
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #84 on: April 04, 2023, 08:27:16 am »
However, if I continue to increase the input voltage to 326.3 mV, the output will drop to 2.553 V. In other words…

Input=0v, Output=5.0V
Input=252mV, Output=4.851V
Input=326.3mV, Output=2.553V

When I simulate that same circuit, I get this…

Input=0v, Output=5.0v
Input=252mV, Output=3.25v
Input=326.3mV, Output=90.94mV
At this point, I'm not sure we are really making progress.
That's good, you have found a 50% threshold point. It's about 66mV higher than my sim, which is not massive.

Increase that Biased DC Vin slightly more, and it should give you the 0.5V point - useful spec points are 50% and the 10%/90% points.

The only thing I can suggest is that I purchase a dual BC847B to ensure the hFE of both NPNs is the same and then I can breadboard that. I found 8 part numbers in stock at DigiKey from reputable vendors.  Please let me know which part number I should buy, and I will go proceed with that.  Of course, I will also be testing the comparators when they arrive as well.
You could get BC846B / BC847B for lowest cost and the  BCM846B / BCM847B are the Nexperia / Diodes matched pair specs.
I'm not sure you really need the tight matching those give (2mV on Vbe) but you could try some of each.
Single package give you same-vendor/batch/date code and same temperature, which is a good improvement over separate packages.


Addit: I skewed the gain in spice, by selecting a badly-wrong-suffix part and it moves the threshold roughly +/- 25mV
Skew  Q2=BC847A, Q1=BC847C = 233.33334mV @ 50%
Match Q2=BC847B, Q1=BC847B = 258.26559mV @ 50%
Skew  Q2=BC847C, Q1=BC847A = 284.01084mV @ 50%

I will buy a few of these two part numbers...

BC847BS,135

BC847BS,135 (matched pair)
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1328
  • Country: ca
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #85 on: April 04, 2023, 03:15:42 pm »
As I said in my earlier post, the problem is that when I use the DC offset adjustment of my function generator to make the waveform to be above 0 V, the output of your circuit basically goes to zero. You can see this in two attachments below. With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.
However, if I continue to increase the input voltage to 326.3 mV, the output will drop to 2.553 V. In other words…
Input=0v, Output=5.0V
Input=252mV, Output=4.851V
Input=326.3mV, Output=2.553V

Those two tests have contradictory results.

So if you also connect the scope, while doing the static DC test with the power supply and voltmeter, do the readings on the scope and voltmeter agree when measuring both the input and output?

If you used your signal generator as the input source at a really slow frequency (0.2Hz), what does the DC voltmeter show vs the scope?

« Last Edit: April 04, 2023, 03:22:28 pm by Kim Christensen »
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Amplify 500mV 0-pk square wave to >2V for PIC MCU
« Reply #86 on: April 05, 2023, 04:11:49 am »
As I said in my earlier post, the problem is that when I use the DC offset adjustment of my function generator to make the waveform to be above 0 V, the output of your circuit basically goes to zero. You can see this in two attachments below. With the waveform entirely below 0 V, and the High level right at 0 V, I do get an output of about 2V zero to peak. But when  I raise the HI part of the waveform to just a little bit above 0V, using the DC offset adjustment of my function generator, the output all but vanishes.
However, if I continue to increase the input voltage to 326.3 mV, the output will drop to 2.553 V. In other words…
Input=0v, Output=5.0V
Input=252mV, Output=4.851V
Input=326.3mV, Output=2.553V

Those two tests have contradictory results.

So if you also connect the scope, while doing the static DC test with the power supply and voltmeter, do the readings on the scope and voltmeter agree when measuring both the input and output?

If you used your signal generator as the input source at a really slow frequency (0.2Hz), what does the DC voltmeter show vs the scope?

I am away from the bench today, will spend the day at the hospital tomorrow to deal with my health, and then I am still playing the waiting game with parts.  When I am back at the bench with parts in hand, I shall reconfirm all connections with my scope and multiple meters attached.

My humble thanks to all of you who have kindly provided input thus far.  It has been a helpful, learning experience.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf