Help with circuit analysis - Page 1
Forum section: electronics / projects

author: daisizhou
author_rank: Super Contributor
timestamp: August 16, 2025, 09:17:23 am
content: Hallo everyoneI drew a constant current drive circuit,I expect the RX1 adjustable resistance (0-220 ohms) to have a linear relationship with the CN1 voltage output,For example: When RX1 is 110 ohms, CN1 outputs 2.5v. When RX1 is 220 ohms, CN1 outputs 5.0v.Is the actual output CN1 voltage value the same as I expected?Thanks

author: moffy
author_rank: Super Contributor
timestamp: August 16, 2025, 09:38:39 am
content: It would probably work but why not make Q1 a PNP with the collector connected to the 0-220R resistor and swap the +/- inputs to the opamp around. The collector of a transistor already acts like a current source with high output impedance.

author: daisizhou
author_rank: Super Contributor
timestamp: August 16, 2025, 11:17:07 am
content: Quote from: moffy on August 16, 2025, 09:38:39 amCan use software to simulate or emulate my result?I'm not sure if the output is as expectedThanks

author: Zero999
author_rank: Super Contributor
timestamp: August 16, 2025, 11:21:16 am
content: It will most likely oscillate, because the transistor introduces more gain. The LM358's phase shift is 180oC at a high frequency, but its gain is below one at that point which prevents it from oscillating. The additional gain from the transistor will make the gain greater than 1, when the phase shift is 180oC, thus ensuring oscillation.Channing the transistor to PNP and swapping the inputs to the op-amp will reduce the chance of oscillation, because the transistor will be an emitter follower, which has a gain of slightly less than 1.

author: daisizhou
author_rank: Super Contributor
timestamp: August 17, 2025, 12:48:48 pm
content: I further drew a schematic diagram, this is a resistance value measurement module.SW1 is used to identify different modules.K1 and K2 are two relays that work at 5V voltage.Let me describe how it works:CN2 is used to connect to external ports,CN1 is connected to a 0-220 ohm adjustable resistor.Normally DB15-3 is closed,DB15-3 opens only after pressing the "READ" button.The normal working process is like this,Connect CN2 and the external circuit, adjust the resistance value of CN1, and when the indicator light comes on, stop adjusting the resistance of CN1 and press the "READ" button. The screen will show the measured resistance value of CN1.The schematic diagram was drawn by myself. Because the schematic diagram is missing, I only see the component BOM table. I can only try to draw the schematic diagram based on the component BOM table.That is the REM/ARM module described in the manual.The following link is the user manual of the module.See page 81.(http://frankshospitalworkshop.com/equipment/documents/workshop_equipment/manuals/DNI%20Nevada%20454A%20Electrosurgical%20Analyzer%20-%20User%20manual.pdf)The Mexican version of the service manual has a BOM list.See page 84-99.If you think there is an error in the schematic, please let me know.Thank you.

author: Terry Bites
author_rank: Super Contributor
timestamp: August 17, 2025, 05:57:04 pm
content: You've swapped pins 2 and three on the opamp. Q1 needs to be a pnp for this circuit to work a a current source. eg 2N3906You probably need a small cap between the inverting and opamp output terminals and a resistor from R5 to pin 2.This does create a small error but the intrinsic inaccuracies of the 358 opamp and the over all design will dominate error terms.Analysis.Iref=(Vcc-Vref)/R1You can ignore R3. Its effects are negligible in this application. So on with the show.The opamp inputs are kept at the same voltage because this is a negative feeback circuit. That's a given.The voltage at the anode of the TL431 is Vcc-Vref. So, the voltage across R5 must be the same, hence Io=(Vcc-Vref)/R5. Its that simple.But the circuit is not ideal. You need to add the base current of the transistor (note negative sign of Ib in this case). So Ib=Io/hfe.My numbers dont match your numbers, but what the hell. So attched is the analysis of the orginal corrected circuit and how it might evolve.You can reduce the base current by using a Darlington connected pair of 3906s or a small mosfet, eg BS250 or similar. A precision opamp and precsion reference and a precsion R5 will improve current accuracy.You can use a hefty MOSFET if you need higher currents without changing the last circuit. Maybe increase the feedback cap a little.

author: moffy
author_rank: Super Contributor
timestamp: August 17, 2025, 11:43:59 pm
content: As Zero999 mentioned the OPs circuit would tend towards instability because you are adding the gain contributed by the transistor, which could be up to approximately 10 for a very low value resistor(for low values R3 is acting as a voltage divider), into the LM358 control loop. It might not oscillate though because of the relatively poor performance of the LM358 and the actual resistor values tested. It is much better to use a PNP in its place or one of the alternatives that Terry Bites suggested, they effectively remove the test resistor from the current setting circuit by their high output impedance.

author: daisizhou
author_rank: Super Contributor
timestamp: August 18, 2025, 03:23:41 am
content: Thanks.I have 3 questions:1、Is a PMOS circuit the best solution? Because I see that the current across R5 110 ohm is almost the same as the current across Rx1 220 ohm.2、To improve performance, I chose R3 as a 110 ohm 0.1% resistor.What is the best replacement for the LM358 op amp?(I have OP200G AD712JN OP07CN8)3、For a 220 ohm adjustable resistor, can I choose a 1K resistor?(Because I have a BI 1K ohm 7286 model in stock,Ordinary precision wound adjustable resistors seem to have a 5% accuracy, although the resistance is 220 ohms)

author: moffy
author_rank: Super Contributor
timestamp: August 18, 2025, 03:47:56 am
content: The '22.703mA' are the current, the voltage across the 110R is about 2.5V and across the 220R 4.995.

author: daisizhou
author_rank: Super Contributor
timestamp: August 18, 2025, 04:08:35 am
content: Quote from: moffy on August 18, 2025, 03:47:56 amsorry.I'm referring to the current values. It seems that only the PMOS solution shows very good current consistency. Is this the best solution?

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 01:08:37 am
content: Hi Terry BitesI made a PCB based on the Pmos tube model circuit according to your suggestion on the 5th floor, But there is no voltage at the 220 ohm resistor in the lower right cornerDo you know why?My actual voltage measurement value is shown in the following figure "77"

author: rfclown
author_rank: Frequent Contributor
timestamp: September 04, 2025, 02:01:24 am
content: Quote from: daisizhou on August 16, 2025, 11:17:07 amI suggest getting LTspice which is a free simulator.

author: MathWizard
author_rank: Super Contributor
timestamp: September 04, 2025, 02:09:38 am
content: What MOSTFET did you use? They usually have a body diode, that would prevent them working backwards as hoped. So it would be like R1, a diode pointing down, and then the bottom resistor, if the op-amp makes VS>VG and VSG>Vdiode

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 03:23:56 am
content: Quote from: MathWizard on September 04, 2025, 02:09:38 amBS250I tried switching the pmos tube as shown in the figure below, but the result is still the same

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 03:37:34 am
content: Quote from: daisizhou on September 04, 2025, 01:08:37 amSomething is quite wrong, the voltages are consistent with a diode conducting S-D on the FET, plus even with that error, the opamp output is also wrong.With IP pins at 12 and 7V the opamp output should be saturated high.What is the part number of the X7 and is it wired correctly ?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 03:40:01 am
content: Quote from: daisizhou on September 04, 2025, 03:23:56 amYour drawing has the opamp +ve pin connected to the wrong place!

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 04:32:28 am
content: Quote from: PCB.Wiz on September 04, 2025, 03:40:01 amThe op amp is connected to LM358. Did I draw any pins incorrectly?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 05:14:03 am
content: Quote from: daisizhou on September 04, 2025, 04:32:28 amYes, the error is Pin 8 = OpAmp Vcc needs to go to +15VIf it goes to the source resistor, it is unable to regulate the MOSFET gate enough to turn it off sufficiently.That explains the strange/unexpected opamp output voltage I mentioned above.A rail to rail opamp might have limped along, but any opamp that cannot go close to Vcc will not regulate with your connections.

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 07:06:53 am
content: Quote from: PCB.Wiz on September 04, 2025, 05:14:03 amIs it correct for me to cut the existing connection on pin 8 and connect it directly to +15V?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 07:25:56 am
content: Yes do that and repeat your measurements

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 07:45:44 am
content: There is no voltage on output pin 1 of lm358.Too much current is flowing through the 220 ohm resistor. Did I install the X7 backwards?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 09:22:34 am
content: Quote from: daisizhou on September 04, 2025, 07:45:44 amThose readings show toolittlecurrent thru 220 & 110.The Opamp is trying to pull the source low, so -ve matches +ve, but fails to do that. ie The FET is failing to turn on.Did you properly cut all the fet source connections that went to pin 8?If the source is now connected to +15, you will get excess 220r current

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 10:32:18 am
content: Quote from: PCB.Wiz on September 04, 2025, 09:22:34 amIndeed, there is a pin connected to pin 8. Now I have completely cut it off. The 220 ohm current has decreased, but there is still no voltage output from pin 1 of lm358.Did I install X7 incorrectly?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2025, 07:34:41 pm
content: The circuit is very simple, you should be able to do your own troubleshooting.Just use a meter and a pencil, and record the voltages, thenthink about how that can be possible.It helps if your docs are consistent.Make the part labels the same on sim sch and pcb, you will save time in the long run.

author: daisizhou
author_rank: Super Contributor
timestamp: September 04, 2025, 10:38:49 pm
content: Sorry, I forgot the schematic diagram corresponding to the PCB. I drew this schematic based on the initial schematic recommended aboveThe H1 interface should be connected to a 220 ohm resistor, while the H2 interface is used for external connectionsThe currently known error is the connection error of pin 8 of operational amplifier LM358. It is unknown if there are any other errorsThe PMOS tube is installed in the same pin position as the schematic diagram, and I'm not sure if it's an errorThe latest status is that the 220 ohm resistor still has no voltage, which means RTEST-IN has not measured any voltage output.LM358 pin 1 also has no voltage output.

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 09:56:45 am
content: Can anyone help me?I don't know why I can't measure voltage across the 220 ohm resistor.

author: Zero999
author_rank: Super Contributor
timestamp: September 06, 2025, 06:32:21 pm
content: Quote from: daisizhou on September 06, 2025, 09:56:45 amYou might get more replies if you posted a better schematic. Using proper symbols for the op-amp and voltage reference would make it easier to understand and use PNG format which is lossless, rather than lossy Jpeg which is designed for photographs.

author: rfclown
author_rank: Frequent Contributor
timestamp: September 06, 2025, 09:35:14 pm
content: As I suggested before, you should simulate the circuit to see if what you drew works. I suggested LTspice, which is a free simulator that I regularly use. I entered the original circuit which you showed, and it does what you expect. I hadn't originally jumped in to look at the circuit closely enough to comment on it, because you did not seem interested in understanding what might be wrong. You wanted someone else to simulate and figure it out. Please download LTspice. I attached the schematic I drew. I didn't see LM358 in the LTspice library, so I picked an op-amp which should be similar. The ADR5041 is a 2.5v shunt reference like the TL431The amount of current in the source is set by the voltage across R5 which is set by the 2.5v shunt reference, so the current is 2.5/110. Since the current through Rx1 is the same as the current in R5 (plus the small about of base current), then yes, there will be a linear relationship between the voltage you see across Rx1 versus the value of that resistor. For Rx1=110, the voltage would be 2.5/110*110=2.5. For Rx1=220, the voltage would be 2.5/110*220=5.0. You are correct with your expectations.

author: rfclown
author_rank: Frequent Contributor
timestamp: September 06, 2025, 10:03:10 pm
content: Your original schematic shows a LM358 which is a single supply op-amp. Later on you have a OP200 which is not made for a single supply. It needs +/- supplies. What op-amp are you actually using?

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 10:31:44 pm
content: Quote from: Zero999 on September 06, 2025, 06:32:21 pmOK.I ignored the possibility that the picture was blurry, I re-uploaded all the files, thanks

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 10:37:59 pm
content: Quote from: rfclown on September 06, 2025, 10:03:10 pmI don't know if it's my PCB drawing error or some other unknown error. It seems that this circuit is very simple, but the result is still not as expected.In the actual circuit, I used LM358, but it seems that OP200 can only be used with dual power supply? Because many people suggest that OP200 has better performance than LM358, I chose OP200. And from the definition, they seem to be the same. I installed the IC socket, so I can replace different op amps.

author: rfclown
author_rank: Frequent Contributor
timestamp: September 06, 2025, 10:52:37 pm
content: You want to use a single supply op-amp like the LM358 in your circuit. There is NO reason to use a "better" op-amp for this circuit. The OP200 is better in that it has low offset voltage, low input bias current and low noise... but these better specifications do absolutely nothing to benefit your circuit. No reason to have to use a dual supply.

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 11:01:12 pm
content: Quote from: rfclown on September 06, 2025, 10:52:37 pmOK, I will revert to using the LM358. Does the PCB need to be modified? I don't know if there is something wrong with my PCB.

author: rfclown
author_rank: Frequent Contributor
timestamp: September 06, 2025, 11:04:55 pm
content: You shouldn't have followed the other advice of changing to a PFET and changing the op-amp input terminals without simulating the suggested changes. The original schematic you posted works.

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 11:10:36 pm
content: Quote from: rfclown on September 06, 2025, 11:04:55 pmAre you saying that I will continue to use the original transistor scheme? Is it meaningless to choose PMOS transistors? But my actual PCB is drawn according to the pmos circuit .............

author: rfclown
author_rank: Frequent Contributor
timestamp: September 06, 2025, 11:39:22 pm
content: Why don't you simulate it to see if you expect it to work?Whenever I have a circuit to design/make, I will first simulate it. Then, especially if it is simple like this, will build it on a solderless breadboard. Only then will I make a PCB. The last board I did wasn't a fabricated PCB, I just soldered components on a vector board, but I still followed this process: simulate, breadboard, then solder. I'm trying to do what your subject originally asked, "Help with circuit analysis". With simulation, you can measure the voltages and currents to compare with your built board to help find errors.

author: daisizhou
author_rank: Super Contributor
timestamp: September 06, 2025, 11:48:12 pm
content: Initially, I simulated and built the circuit on the first floor. The test results showed that the voltage output seemed to reach a bottleneck when the resistance was between 150 ohms and 220 ohms.What I mean is that as the resistance increases, the voltage seems to lose its linearity.50R--1.103v100R--2.267v150R--3.42v200R--4.59v220R--4.61vSo I followed Terry Bites's suggestion on the 5th floor and used pmos tubes, which seemed to have lower leakage current and better performance.But the reality is that there is no voltage at the output

author: rfclown
author_rank: Frequent Contributor
timestamp: September 07, 2025, 12:04:49 am
content: The simulated results showed a bottleneck, or the measured results? If the measure results differ, then first start looking for errors in the wiring/construction. Someone pointed out an error of not connecting pin 8 of the op-amp to the 15v supply. That will certainly cause a problem. But it seems you changed other things before fixing that first problem. If you have a working simulation and a non-working circuit, first exhaust all possibilities of physical problems: wiring, bad component, short circuits, bad solder joints. You do this with thorough visual inspection and measuring with a multimeter (and scope when necessary).

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 07, 2025, 12:17:47 am
content: Quote from: daisizhou on September 06, 2025, 11:48:12 pmBasic trouble shooting is to get a circuit that exactly matches your PCB,including revisions, and measure all the voltage points and write those on the circuit.Then compare those with the simulated predictions, and reason what mechanisms can make them different.When properly wired, the OpAmp will try to keep the 110R at Vcc-2.5V

author: rfclown
author_rank: Frequent Contributor
timestamp: September 07, 2025, 12:27:27 am
content: Simulated with PMOS and rewired op-amp input. Seems ok.Is the PFET installed the right way?

author: rfclown
author_rank: Frequent Contributor
timestamp: September 07, 2025, 12:48:08 am
content: You need to completely go through your schematic and layout. The relay wiring of your latest schematic doesn't match the original one you showed. Kickback diode on one is wrong. I'm not going to try to find all the errors.

author: daisizhou
author_rank: Super Contributor
timestamp: September 10, 2025, 06:15:31 am
content: Hallo everyoneI have successfully debugged the circuit above, but there is an issue where the voltage and resistance values do not match.For example, the voltage value corresponding to 220 ohms is 5.08v. The voltage value corresponding to 200 ohms is 4.59v. The voltage value corresponding to 150 ohms is 3.42v.I hope to adjust 5.08v, 4.59v, 3.42v,In other words, the actual host display value corresponding to 5.08v is 218 ohms or 220 ohms, which cannot accurately match the actual value.I don't know how to adjust it

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 10, 2025, 07:05:12 am
content: Which circuit did you actually use in the end, and what is your resistor precision and what numbers do you expect to see ?Those values are all close to 23mA, BJT will have more variation than MOSFET.

author: daisizhou
author_rank: Super Contributor
timestamp: September 10, 2025, 07:15:27 am
content: Quote from: PCB.Wiz on September 10, 2025, 07:05:12 amI used LM358 as the op amp,PMOS tube uses BS250,The circuit shown in the figure below is used.The voltage value finally measured on 220R needs some adjustment

author: Zero999
author_rank: Super Contributor
timestamp: September 10, 2025, 07:20:26 am
content: Quote from: daisizhou on September 06, 2025, 11:10:36 pmChanging to a P-device was a good idea. I did a simulation showing instability with the NPN transistor, under transient conditions when the load resistance is very low. I would've gone for a BJT rather than a MOSFET in this case, because the gate capacitance can introduce instability.

author: daisizhou
author_rank: Super Contributor
timestamp: September 10, 2025, 08:25:53 am
content: I tested the circuit and the test values are shown in the following figure