last day (18 days later) » 

21:49
0
A: Arduino high side driver with up to 30V

Nick GammonThe current through the transistor is controlled by R1 so I would suggest increasing that somewhat in this case. Perhaps to 1k or 2k. If D2 conducts then you will have a (roughly) 30V drop over 330Ω which would be 90 mA, and therefore 2.7W of power dissipation, which is more than the transistor i...

Actually I think the above explanation is slightly flawed, however I still think that increasing the value of R1 would be a good way to go.
dim
dim
@Edgar is right regarding the fact Q2 could not turn on if R1 is too high. However, increasing R2 has a limit too, because at some point the zener will take over. Actually, this zener stuff isn't really appropriate and will prevent you to size things correctly. What should be done is 1) completely remove the zener 2) put R1 between Q1 and R2 (this way you have a resistor divider with R1 and R2, and the emitter of Q1 is directly to ground) 3) size R1/R2 so that the gate voltage stays within the FET ratings (e.g.: R1 = 3xR2 should be fine), 4) size R1+R2 so that the current is just a few mA.
To make it more explicit: something like that, with a PFET instead of the Q2 PNP. Simpler, IMO.
@dim Do you mean R3 = 3xR2? Does this sound reasonable: R1 = 1k, R2 = 2.2k, R3 = 3.3k? I calculate that gives us 12V at the gate with 30V at the source, and around 5 mA through Q1.
Oops, that's relative to ground, isn't it? So we really want 18V at the gate (relative to ground) to give 12V relative to the source. So: R2 = 3.3k and R3 = 2.2k?
dim
dim
@Nick "R2 = 3.3k and R3 = 2.2k" yes, if we refer to the designators in the schematic from my comment above. Note that 12V across the gate could be too high for some smaller mosfets (that's why I suggested a 1/3 ratio: that would give ~7.5V at the gate, which is generally enough and safer for all kind of mosfets). Also, 1kOhm at the base is unnecessarily low. Sourcing 5mA from and Arduino pin can be done, but unless there is a real reason to do so (e.g. driving a LED directly), you should try to stay below 1mA. So ~10kOhm seems more appropriate.
@dim OK, thanks for that. The output pins (on the AVR chips for example) should easily handle 20 mA, but there is no particular reason to stress them. I might redo my suggestion on my web page and replace the schematic with the Zener by your alternative. Can you see any pitfalls? Like, for lower voltages, or a variable supply voltage? The exact resistor values would probably need to be calculated based on the exact supply voltage, but that could be done by a formula.
dim
dim
21:49
@Nick Indeed, the resistors need to be adjusted according to the supply (and the gate voltage you want to achieve). But this is actually the same with the zener: even if the gate voltage is clamped independently from the supply, you see, from this very question, that the supply has an impact on the current in the resistors and through the NPN anyway, and if not taken care of, that can lead to problems. So things needs to be adjusted whatever the topology. The main pitfall of my suggestion is, indeed, with a variable supply: the gate voltage will be less stable than with a zener.
@Nick also, regarding the current on pins, indeed, the chip can [easily] manage 20mA per GPIO, but the current through the chip supplies is also limited: on ATmega328P, it is 200mA max. So if you need 20mA on 10 pins, you're dead (not even including the consumption from the chip itself). That's why you should always keep GPIO currents as low as you can. Moreover, if you don't take care of that and have a few chips on the board, you can easily reach current levels that would require a heat sink, if you use linear regulators.
@dim Yes, I understand about the total ratings. Some quick calculations appear to show that 10k would be fine for driving the transistor enough to sink around 7 mA (if I used 1k and 3.3k). Isn't another problem, though, that 30V between collector and emitter (if the transistor is off) is approaching its maximum rating? Max for Vceo is 40V on the 2N3904, and 30V on the PN2222.
22:15
Would that work? Now I have the voltage divider such that Q1 will have about Vce of 22V and the gate of Q2 is 8V from the source. Or is there a fundamental flaw there?

  last day (18 days later) »