I foolishly took on a complicated school project of making a model particle accelerator. The idea was to make it a modular system, as in each segment, or "accelerator module" would be independent so the final arrangement could be altered at any time.

The "particles" would be steel marbles and each segment would be made up of a photo-interrupter and a coil. The sensors would be placed before each coil, that way they would only be on for a short time while the marble was breaking the beam, providing the kinetic energy to get to the next stage, but not leaving the coil on so long the marble would start accelerating in the other direction

I have designed a rough circuit which by my logic should work, but for the life of me I cannot figure out how to calculate the resistors for the transistors or MOSFET. My goal was to keep it simple, not require a microcontroller, and for the segments to be independent of each other.

This is what I came up with;

The inductor represents the coil, it has a resistance of 0.6ohms and an inductance of 1200uH. Each coil will theoretically pull 40A at 24V.

enter image description here

Components (all sourced from Arrow.com):

-The LED and transistor on the far left represent the photo-interrupter, it is an EE-SX1070

-The NPN transistor is a BC337

-The PNP transistor is a BC327

-The N-Channel MOSFET is a SUP40010EL-GE3


-R2 Is to limit the current into the transistor and make sure Vbe will be greater than Vce

-R3 Is to limit the current through the base of the NPN transistor

-R4 Is only there as most examples online had an emitter resistor, it may not be required

-R5 Is to limit the current through the base of the PNP, and into the collector of the NPN

-R6 Is to stop the PNP's base from floating, it may need to be lower to ensure that the NPN has enough collector current

-R7 Is to limit the current into the PNP's emitter, however it might be slowing down the switching speed of the MOSFET

-R8 Is to discharge the MOSFET gate capacitance, thus decreasing turn off time

If I have overlooked anything, done anything wrong, the circuit is flawed or more details are required please let me know as this is my first post. Any and all advice is welcomed.

  • \$\begingroup\$ I would use segmented metal tracks and have the marble complete the circuit. \$\endgroup\$ Jun 14, 2020 at 5:26
  • 2
    \$\begingroup\$ I'm interested that you've specified two 50k values already. How about you write down what the function of each resistor is in your question. \$\endgroup\$
    – Neil_UK
    Jun 14, 2020 at 5:31
  • \$\begingroup\$ @Jasen, I thought about using a metal track but I already had a loop of acrylic, and using the metal would make each stage permanent \$\endgroup\$ Jun 14, 2020 at 5:44
  • \$\begingroup\$ The circuit is flawed from the coil if you haven’t verified the acceleration a=F/m and time interval doesn’t melt your coil. The driver can be just a CMOS gate, but you need PWM to limit the current with sensing using a time integrator or thermistor. \$\endgroup\$ Jun 14, 2020 at 15:39

3 Answers 3


Let's start by figuring out what resistors are needed, before settling on rough values (exact values aren't needed).


-R2 Is to limit the current into the transistor and make sure Vbe will be greater than Vce

R2 is there to give the phototransistor something to 'work against', and to source current into the following stage when the phototransistor is off. It doesn't need to source much current, as it's followed with amplifier stages. So no need for anything too small.

-R3 Is to limit the current through the base of the NPN transistor

This would be the case if driven from a low resistance output stage. However, the source current of the stage driving it is already limited by R2. You could omit R3. If you want to remove the phototransistor and sometimes drive it directly for debugging, then by all means have a nominal value there, 1k, 50k, whatever.

-R4 Is only there as most examples online had an emitter resistor, it may not be required

R4 is not required, as we're doing logic here. It's often used for linear amplification.

-R5 Is to limit the current through the base of the PNP, and into the collector of the NPN

Required. We'll get a value later.

-R6 Is to stop the PNP's base from floating, it may need to be lower to ensure that the NPN has enough collector current

Not wanted. You'd see this in a linear amplifier, but we're doing logic.

-R7 Is to limit the current into the PNP emitter, however it might be slowing down the switching speed of the Mosfet

Not wanted. Used in linear amplifiers.

-R8 Is to discharge the Mosfet gate capacitance, thus decreasing turn off time

It doesn't 'decrease turnoff time', it's the only thing that's doing any turnoff, as the driver transistor only sources, not sinks current, and the FET gate doesn't sink current either. As it's a fairly slow application, you'll get away with a resistive pulldown here, but any serious frequently switching application would need an active transistor to remove charge from the gate.

Use as small a resistor as you can, subject to the drive transistor being OK for the current. BC327 has rated minimum Hfe up to 300mA, so you've plenty in hand. A 300 Ω resistor would dissipate about half a watt from 12 V. Although you intend only short pulses of output, make sure that this resistor is rated for continuous dissipation, it's one fewer things to fail if your pulse stays 'on' accidentally for a long time.

Now we can go backwards and get some values.

R5 needs to turn the transistor on into 300 Ω. Let's use a very conservative Hfe for the second transistor of 30, so R5 becomes 10 kΩ.

Let's not make R2 and R3 (if used at all) too big by doing Hfe sums, just make them 10 kΩ as well.

Some folks put base-emitter resistors on their switching transistors to divert any leakage base current to get a good 'off'. These are only really warranted at high temperature or humid environments, you're unlikely to need them.

Sometimes you see a small resistor in series with the gate of a FET, often 10-100 Ω range. This is only needed in serious applications, where the FET is being driven by a low impedance driver, and it's to limit the gate charging current to limit ringing and overshoot. Will not be a problem in your application.

Is the driver adequate? This section is for the OP, when he's got a lot more under his belt, and people who might want to downvote what may appear an excessively hand-wavy answer, so they don't need to look up the FET and do sums. The FET has a 100uS SOA going right out to 40 V and 300 A, so as long as all switching is done within that time, there's no need to worry. The FET needs about 100nC gate charge to get through the Miller plateau, and then some. Assuming Hfe=100, Rs=10k will source 1 mA to base, so 100 mA at the collector. 100 nC at 100mA = 1 us, so switch on is OK by two orders of magnitude. It's a logic level FET, so Vgs(Miller_plateau) is low at 3 V. Even so, 300 Ω R8 will abstract charge at 10 mA, or in 10 us, still an order of magnitude for safety. The FET only has an unclamped inductive energy rating of 320 mJ, whereas the inductor can store 1 Joule at full current. That clamping zener is essential therefore. Note the FET only goes to 40 V, so the zener must come in before that. Maybe a higher voltage FET would be a good investment.

  • \$\begingroup\$ Wow, that was an amazing response, I must have been way over thinking this whole thing. If it's not too much to ask, could you explain why you were able to use such general values, everywhere online uses complex and in-depth equations. Also could you tell me what you think of the circuit as a whole, Its my first "complex" circuit, any feedback for the future would be amazing. \$\endgroup\$ Jun 14, 2020 at 6:32
  • \$\begingroup\$ @Pizzashape23 Most resistor locations have an upper bound and a lower bound, one often given by dissipation, the other by required drive current. Sometimes those bounds are tight and you have to do the sums. Sometimes those bounds are orders of magntiude apart, and you can just say '10k'. 50 years' of engineering experience helps you tell the difference, so don't feel bad. If you want honesty, it's not a circuit design.That's why I asked you what the resistors were for, I suspected you;d just cobbled together a load of fragments without understanding. Again, don't feel too bad, you're learning \$\endgroup\$
    – Neil_UK
    Jun 14, 2020 at 6:37
  • \$\begingroup\$ Thanks again, I really appreciate the help. You were right in assuming that although the fundamental idea was mine, most of it was cobbled together based on what little I could dig up. If you had been given a similar set of design parameters, how would you have gone about designing a circuit, particularly in regards to it's efficiency and simplicity? \$\endgroup\$ Jun 14, 2020 at 6:50
  • \$\begingroup\$ @Pizzashape23 A confession - R8 may not be small enough. I gave a value on 'what's the fastest we can discharge the FET gate for a half-watt resistor?' The faster you switch, the less energy is dumped into the FET. However, how fast you need depends on the coil current and inductance, and the SOA of the SUP400. I'll do some sums on some plausible values and come back in a day or two whether it's likely to go bang on turnoff, and suggest a circuit modification if that looks a problem. Your circuit with my comppnent omissions is quite simple and efficient. \$\endgroup\$
    – Neil_UK
    Jun 14, 2020 at 7:27
  • \$\begingroup\$ You have been a massive help and the value for R8 would be a lifesaver. I just thought it would be important to note that the higher the switching speed of the FET the better. It would result in it switching as the marble is further away from the center of the coil, allowing it to accelerate for more time. \$\endgroup\$ Jun 14, 2020 at 7:37

Your concept has potential flaws and may need improvements; these come first before any discussion of component values.

The sensors would be placed before each coil, that way they would only be on for a short time while the marble was breaking the beam

R8 (50 kohm) will cause the MOSFET to deactivate in about 0.5 ms (due to discharging the 11 nF gate capacitance) but, have you calculated the time it takes for the steel ball to arrive at the mid-point of the solenoid? That's when you could deactivate the solenoid in order to get maximum speed. Of course, if you want a slower ball speed, then turn off the solenoid earlier but, at the moment, your solenoid drive will begin to deactivate before the steel ball enters the solenoid. This may be too light-handed.

So, I think you may need some form of "hold-control" and you can make it variable. Maybe the 50 k resistor (R8) could become a 500 k potentiometer?

On the other hand, when the MOSFET deactivates there is still current circulating in the coils and that then finds a path via the parallel diode. The problem here is that the diode virtually shorts the solenoid out and it takes a long time (in relative terms) for the magnetism to reduce to marginal levels. The coil inductance is 1.2 mH and the resistance is 0.6 ohms therefore the time constant is 2 ms and I can't tell you if this is too much. If you feel that the 0.5 ms from the gate capacitance plus 2 ms from the coil discharge will adequately position the steel ball inside the solenoid to gain the momentum it needs, then OK.

There is also the charge time of the solenoid; with 24 volts and 1.2 mH the current rises at 20 amps per millisecond so if you aim to get 40 amps flowing then this "feels" about right. It should happen in less than 10 ms. However, if the ball passes through the optical gate faster than a couple of milliseconds then you can't rely on achieving anything like the peak current so, maybe you need a "sustain-control"?

The suggestion I'm making, in order to avoid you going down a path that might be hard to reverse out from is add a sustain or a hold circuit. I'm not bothered about choosing the resistor values because it's important that the concept is right first.

  • \$\begingroup\$ you bring up a very good point that I have overlooked. How would you implement this "sustain-control" circuit? One issue that I am anticipating, is the difference in time through the solenoid as the ball speeds up, as such i was hoping to be entirely dependant on the optical sensor, making it essentially "automatic." Also, after said implementation how would you go about decreasing the turn off time? \$\endgroup\$ Jun 14, 2020 at 12:58
  • \$\begingroup\$ Use a non-retriggerable monostable - it can be made from a 555 - go google some circuits. Turn off time can be controlled with a 500 k pot instead of a 50 k resistor across gate and source (as mentioned in my answer). \$\endgroup\$
    – Andy aka
    Jun 14, 2020 at 13:02
  • \$\begingroup\$ My question about the turn off time was about how to minimize it completely, supposing the timing circuit could turn the solenoid on for long enough. A shorter turn off time would get ride of a variable when tuning solenoid on time. \$\endgroup\$ Jun 14, 2020 at 13:05
  • \$\begingroup\$ Are you talking about how to extinguish the magnetism faster? If so then you haven't got much room to manoeuvre with the chosen MOSFET. \$\endgroup\$
    – Andy aka
    Jun 14, 2020 at 13:08
  • \$\begingroup\$ Yeah, I should have been more clear, my bad \$\endgroup\$ Jun 14, 2020 at 13:11

I don't think your 50K gate resistor will turn such a big FET off fast enough

Take a look at totem pole drivers if you want discrete BJT driver, or look at gate driver ICs.

The risk is that by switching the FET off slowly you pass a lot of current through the FET while it has high Rds during the off transition.

You have the same problem in the on transition if R7 is too big.

Gate driver ICs tend to have amps of gate current to make the FET switch fast.

Anyway, if the duty cycle is low enough it will work.

R4 should be zero.

R7 should be zero assuming your FET can tolerate Vgs of 12V. If it cannot, consider a lower supply rail.

R8 should be low, such that when the PNP is conducting you are at 50% maximum rated collector current. Say that 50% is 1A, then R8 would be 12R. 100mA it would be 120R. Etc.

R6 and R5 should be set such that voltage at their junction is approx 1V below the rail. So R5 is 11xR6.

R5 should also be set to saturate the base of the PNP when the NPN is on. Assume the current gain is 10 for such high collector current. So R5 will be 10x R8. Solve for R5 and R6 once you have set R8.

R3 should be zero.

For R2 again assume the current gain is 10x for the NPN. So it should be 10x R5+R6.

The above only works because you are running digital, on/off. For a linear application you would need to be much more methodical about the transistor currents, gains and biasing.

Good luck!

  • \$\begingroup\$ Thank you very much, I was just wondering if you could explain how I would go about finding R6. Also you state that the 50k resistor (R8) might not be fast enough to turn off the FET, but later you say, "R8 should be low, such that when the PNP is conducting you are at 50% maximum rated collector current." Could you explain what you meant, they seem to contradict each other. \$\endgroup\$ Jun 14, 2020 at 6:59
  • \$\begingroup\$ @Neil_UK made a more comprehensive answer than me and suggests 300mA or less, so R8 should 12/.3 = 36ohm. So that's lower than 50K. Though for other reasons he suggests 300ohm which is fine. \$\endgroup\$ Jun 15, 2020 at 7:12
  • \$\begingroup\$ So now you need the PNP to pass 12v/300R=40mA. Divide that by the gain Hfe and you get the base current. That sets R5. R6 should then be set so that the potential divider R5 and R6 sets the base-emitter voltage of the PNP to be at least -1V, i.e. the base is turned full on. So roughly R6 is one 11th of R5. \$\endgroup\$ Jun 15, 2020 at 7:17
  • \$\begingroup\$ I'm unsure of the accuracy of the Tinker Cad circuit sim, however, I tested both your solution and Neil's. Your values worked immediately, however, the one value which prevented Neil's design from working was the 10k for R5. I assume this is because it is not allowing enough current to flow through the base of the PNP. After changing that value, I'm not sure how to decide which response to use, any advice? Also If I wanted to implement thermal protection for the coils, could I short the base of the NPN to ground using an NTC Thermistor with a high enough ambient resistance? \$\endgroup\$ Jun 15, 2020 at 12:26
  • \$\begingroup\$ Hmm. I think Neil's numbers are sound, but it won't hurt to run with 1k instead of 10k. \$\endgroup\$ Jun 15, 2020 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.