Transistor H bridge base resistor values - Page 1
Forum section: electronics / projects

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 10:31:40 am
content: Howdy folks,I'm designing a transistor H bridge to drive two-lead bi-colour LEDs, and was wondering if I could get clarification as to base resistor values?The initial value I've got is 330r, but that was worked out for a single 20hfe transistor, with 60mA load current and 20mA max IC current. Does that value change when there's two resistors arranged in the H bridge configuration? Or have I got the resistor value wrong in the first place?Thanks!!!Sent from my ONEPLUS A3003 using Tapatalk

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 11:12:14 am
content: What transistor and voltage are you using? That looks quite low numbers for small transistors...JS

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 11:15:26 am
content: Quote from: JS on July 05, 2018, 11:12:14 amHi JS,I'm using MMBT4401/4403s from ON, on a 5V supply. It's only to drive 3 LEDs, but by changing the resistor values in assembly time I can add more power - have I got that right?CheersSent from my ONEPLUS A3003 using Tapatalk

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 11:34:27 am
content: I see a minimum hfe of 40 and more than twice at your desired range on the 4401 datasheet. And even higher for the 4403. I will take 50 to be safe but I could take 100.You want 20mA Ic, so at the base you need 0.4mA. .4mA at 4V (allowing some for the base emmiter and some from the logic output to the 5V rail] that's like 10kΩ base resistor.Use 1k if you want to be sure you are into saturation, but 330Ω seema quite low and not every micro or logic output can drive 12mA, 4mA is more likely and even a tad high for a general circuit.JS

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 11:43:12 am
content: Quote from: JS on July 05, 2018, 11:34:27 amI'm using PICAXE micros, and per datasheet they can drive 20mA per output, with a total of 60mA across all outputs.The hfe definitely seems odd... The RS Components part I'm looking at has a minimum DV current gain of 20... That's part no. 545-0371 & 545-0387 on the RS website...CheersSent from my ONEPLUS A3003 using Tapatalk

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 12:00:45 pm
content: If you start conaidering that 20mA you will hit the 60mA barrier pretty quick...Minimum HFE is most likely at maximum current, to drive the 20mA is likely much higher.JS

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 12:05:57 pm
content: Quote from: JS on July 05, 2018, 12:00:45 pmTrue... Never really considered that 60mA barrier too much....But I'm afraid you've lost me in terms of the hfe... I'm really a newbie to transistors; most I've ever done is use them as a very basic switch :-)Sent from my ONEPLUS A3003 using Tapatalk

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 12:24:49 pm
content: HFE depends on the bias conditions, it isn't constant for all Ic or Vce. Also there is a DC hFE and a signal hfe, caps or not makes all the difference here.Look at this datasheet, you have DC hFE numbers for different points and then the small signal h parameters including hfehttps://www.google.com.ar/url?sa=t&source=web&rct=j&url=https://www.diodes.com/assets/Datasheets/ds30058.pdf&ved=2ahUKEwiv_62k7YfcAhXJHZAKHVeeBpgQFjAAegQIABAB&usg=AOvVaw0TFFGDD7blhKbdV6A3r9wQJS

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 12:26:16 pm
content: HFE depends on the bias conditions, it isn't constant for all Ic or Vce. Also there is a DC hFE and a signal hfe, caps or not makes all the difference here.Look at this datasheet, you have DC hFE numbers for different points and then the small signal h parameters including hfehttps://www.google.com.ar/url?sa=t&source=web&rct=j&url=https://www.diodes.com/assets/Datasheets/ds30058.pdf&ved=2ahUKEwiv_62k7YfcAhXJHZAKHVeeBpgQFjAAegQIABAB&usg=AOvVaw0TFFGDD7blhKbdV6A3r9wQJS

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 01:06:11 pm
content: Ah, gotcha - so you'd recommend something between 1k - 10k? Would be handy as I've got some 2k7s lying around which are the correct type :-)Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 05, 2018, 01:55:57 pm
content: Do the LEDs have to run at full current, for the desired brightness? Quite often 5mA is more than enough, so no h-bridge required.What's the maximum forward voltage of the LEDs? What's the supply voltage? If there's enough headroom, just use emitter followers, then no base resistor is required, as the base current will set itself to the correct value.

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 01:58:22 pm
content: Quote from: Hero999 on July 05, 2018, 01:55:57 pmHi Hero999,I'm afraid I don't know the specs of the LEDs... I struggled to find red/white LEDs, so ended up buying off eBay. They had no documentation or part numbers, so I've been playing it safe and wiring them in parallel and assuming 20mA, no voltage drop (obviously not true, but safest).Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 05, 2018, 02:01:05 pm
content: Quote from: danners430 on July 05, 2018, 01:58:22 pmPlaying it safe would be using as lower forward current, as possible to give enough light and not wiring them in parallel, using a separate series resistor for each LED.

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 02:03:38 pm
content: Quote from: Hero999 on July 05, 2018, 02:01:05 pmUnfortunately due to space constraints that's often impossible... The board being designed is to fit inside a model railway locomotive / coach / multiple unit, and some of my collection don't have enough space for each LED to have its own wire to the board, even when using really thin wire specifically bought for the low current LEDs. In these cases it's proven necessary for me to solder the LEDs directly together by the leads, well before the wires can even be run to the circuit board in the body :-(Sent from my ONEPLUS A3003 using Tapatalk

author: Benta
author_rank: Super Contributor
timestamp: July 05, 2018, 03:31:20 pm
content: Hero, I think you've missed that it's 2-pin, 2-color LEDs. Current must be able to be reversed to get both color, so an H-bridge is not a bad idea.

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 03:53:34 pm
content: Quote from: Benta on July 05, 2018, 03:31:20 pmIt's possible without an H-bridge - by connecting the LEDs across two outputs, the low side output pin would sink the current, it's capable of 20mA. But that would be me getting back into the realms of the current source capacity of the micro.Sent from my ONEPLUS A3003 using Tapatalk

author: Benta
author_rank: Super Contributor
timestamp: July 05, 2018, 05:50:36 pm
content: Quote from: danners430 on July 05, 2018, 03:53:34 pmThat IS an H-bridge. Just sayin'

author: danners430
author_rank: Regular Contributor
timestamp: July 05, 2018, 07:51:39 pm
content: Quote from: Benta on July 05, 2018, 05:50:36 pmYeah, but without transistors Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 06, 2018, 12:18:48 pm
content: Quote from: danners430 on July 05, 2018, 03:53:34 pm20mA is probably more than enough, shared between three LEDs. Another issue is the current probably won't divide between the LEDs equally, which is another reason to use a lower current. I'd recommend aiming for 5mA per LED, which should be bright enough.Don't forget that microcontrollers are normally specified by the total current going into the Vcc pin and out of the GND pin, so connecting a 20mA load between two I/O pins, will only result in 20mA of additional current through the power pins.What are the other I/O ports connected to? Is it driving anything else.

author: danners430
author_rank: Regular Contributor
timestamp: July 06, 2018, 12:37:50 pm
content: Quote from: Hero999 on July 06, 2018, 12:18:48 pmThe microcontroller will be powering 3 LEDs at one end of the model train, another 3 at the other end, plus interior lighting which could consist of up to 10 LEDs per coach, hence my plan to use transistors. I can always alter the specs of the transistors and resistors in assembly time to cater for different quantities of LEDs, but without transistors I limit myself.Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 06, 2018, 03:05:58 pm
content: Quote from: danners430 on July 06, 2018, 12:37:50 pmAre they all bi-colour LEDs?The single LEDs could be powered using transistors and just power the bi-colour ones straight from the MCU.

author: danners430
author_rank: Regular Contributor
timestamp: July 06, 2018, 03:15:16 pm
content: The groups of 3 will all be bi-colour, with up to 5 lit at any one time.Sent from my ONEPLUS A3003 using Tapatalk

author: german77
author_rank: Regular Contributor
timestamp: July 06, 2018, 10:51:23 pm
content: Having a small half voltage supply, using a mosfet driver ic. You could drive your LEDs with one digital pin, in both directions and turn off the led if you set the pin as a input. With SMD components you could fit your 6 LEDs in a very small PCB. To control the current you just change a resistor that is in series with the LED.The only issue I could see it's not having enough voltage to drive the LED with should be around 1.8V. To avoid this you could have a 10v supply and use the 5v of the uC although depending on the driver you may can't turn both LEDs off.

author: JS
author_rank: Frequent Contributor
timestamp: July 07, 2018, 03:15:33 am
content: Quote from: german77 on July 06, 2018, 10:51:23 pmI don't know the actual micro but leaving GPIO pins as input with unknown voltage somewhere half the way across the rails isn't that great of an idea. Internal logic might/will be active and switch up and down with noise consuming considerable power.It is fine if pins are configured as analog inputs, as they do expect any voltage between the rails. Some micros (stm32 for sure) allow you to configure a pin as analog even if it can't go to an adc, stm cube code generator has an option to configure all unused pins to analog to minimize power consumption.JS

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 09:47:21 am
content: Hey guys, sorry for the absence - been in bed with the lurgy :-(I'm going to look through the replies this evening, but just now I've found I need to use an H-Bridge for another use at work, namely to drive a motor in either direction - I'm guessing this would work the same way - by activating one side of the bridge the motor would turn one way, by activating the other side it would turn the other way?For this use, would it be useful to use an inverter on the gate so that both sides are defaulted to ground (gate default logic +)?CheersDanielSent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 11, 2018, 10:10:47 am
content: Use an H-bridge IC. The cheapest, most common ones are the L298N and SN754410 but they do have fairly high on voltage losses, so aren't ideal for running the motor off 5V. There are more modern motor driver ICs available, with much lower voltage losses, but they come in SMT packages, with a thermal pad, which require a reflow oven to solder, but modules with the ICs already soldered in are available.https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdfhttp://www.ti.com/lit/ds/symlink/sn754410.pdf

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 10:15:46 am
content: Quote from: Hero999 on July 11, 2018, 10:10:47 amNeither are really ideal... It's going to be driven using PWM (separate thread for that in this forum), and since the motors are actually 6V, we kinda need as much voltage as possible :-)As for the modules, it sorta defeats the purpose of this STEM event which is to get the students to build their own circuitry...Would a MOSFET H-Bridge work for driving a motor with PWM in either direction?CheersSent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 11, 2018, 10:34:52 am
content: What's the difference between using a module and an IC, other than the latter provides a bit more soldering practise?If you're not expecting them to design the circuit, then the only purpose of building it, rather than using a module, is practical skills and if that's the point, rather than teaching them to think, fair enough.Yes, MOSFETs can work. The problem is shoot-through. Here's a circuit I designed awhile ago, which has minimal shoot-through and is protected from both transistors activating simultaneously, if both outputs are high.https://www.eevblog.com/forum/projects/dc-to-ac-converter/msg16288/#msg16288

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 10:48:06 am
content: Quote from: Hero999 on July 11, 2018, 10:34:52 amUnfortunately, this is pretty much it - we need to provide them with the circuit, teach them how it works, and still get them to physically assemble it.The circuit looks ideal - would there be any changes necessary for 5V operation?CheersDaniel

author: Zero999
author_rank: Super Contributor
timestamp: July 11, 2018, 12:37:39 pm
content: Yes, just use logic level MOSFETs. Make sure they will pass the required current for the motor, when the gate voltage is only 5V.

author: danners430
author_rank: Regular Contributor
timestamp: July 12, 2018, 01:15:09 pm
content: Quote from: Hero999 on July 11, 2018, 12:37:39 pmHi mate,Two quick questions regarding your H-bridge circuit:1. Would this circuit work using PWM?2. Would an alternative circuit using four logic outputs from the MCU work too, where the MCU programming prevents shoot-through by enforcing a delay between switching the FETs?With regards to the second question, I got that idea from another source when investigating the PWM control - would this also be easier to wire up if I have the spare GPIO?CheersDaniel

author: danners430
author_rank: Regular Contributor
timestamp: July 12, 2018, 01:52:11 pm
content: Just finished a circuit diagram - the PNP transistors are there to default the P-channel FETs to off in case of MCU failure :-)Daniel

author: Zero999
author_rank: Super Contributor
timestamp: July 13, 2018, 08:44:59 am
content: There's nothing to turn the upper MOSFETs off.To answer your previous questions:The circuit I posted was not designed for PWM. The turn off time for M3 and M4 is quite slow. It's possible there will be some shoot-through, if the opposite side is turned on very soon after the other side is turned off. Although this isn't good, it won't destroy the MOSFETs, if it doesn't happen very often.Relying on the software to not destroy the MOSFETs is bad design practise. Logic gates could be used before the MOSFETs, to ensure they don't both turn on simultaneously.

author: danners430
author_rank: Regular Contributor
timestamp: July 13, 2018, 08:55:52 am
content: Quote from: Hero999 on July 13, 2018, 08:44:59 amThe idea was that the PNP transistors act like a NOT gate to hold the FETs off unless they're powered by the MCU.The reason I decided to go with this design is that it's reasonably simple, so easy for students to build on a breadboard - the MCU will be pre-programmed by ourselves, and we'll add in checks to ensure a good few ms delay between switching the FETs to prevent shoot-through.CheersSent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 13, 2018, 10:58:03 am
content: Quote from: danners430 on July 13, 2018, 08:55:52 amSorry, I should have said, how are the tp MOSFETs supposed to turn on?QuoteThat's a shame. You could have used it as an opportunity to teach logic gates, although I accept it would make it more complex and could take too long.

author: danners430
author_rank: Regular Contributor
timestamp: July 13, 2018, 11:01:23 am
content: The idea behind the top FETs was to use them as digital inputs, PWMing the N-channel FETs. So a delay in the top ones actuating isn't a problem. By powering the PNP transistor, it would switch off, making the P-channel FET switch on... Or am I talking rubbish?Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 13, 2018, 12:41:40 pm
content: The P-channel MOSFET's gate needs to go to +V to turn it off and 0V to turn it on and must be connected to either power supply rail. The gate must never be left disconnected from anything, i.e. just left floating.

author: danners430
author_rank: Regular Contributor
timestamp: July 13, 2018, 01:01:43 pm
content: Quote from: Hero999 on July 13, 2018, 12:41:40 pmSo it needs pull-down resistors?Sent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 14, 2018, 05:41:26 pm
content: Yes, pull-down resistors are required to turn the P-MOSFETs on.

author: danners430
author_rank: Regular Contributor
timestamp: July 14, 2018, 05:49:12 pm
content: Quote from: Hero999 on July 14, 2018, 05:41:26 pmPerfect. I'm guessing simple 1k resistors would do the job?CheersSent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: July 16, 2018, 10:51:03 am
content: Quote from: danners430 on July 14, 2018, 05:49:12 pmThis really isn't the right way to do it.I'd recommend not driving the MOSFETs directly from the MCU. If a MOSFET dies, it will take out the MCU. There are special MOSFET driver ICs available, but just for low speed/power/frequency applications, they're not worth it. A hex Schmitt trigger IC can be used, with RC circuits to delay the turning on of the top MOSFETs, to avoid shoot-through. The capacitors will charge, slowly via the resistors, delaying turn on, but discharge quickly through the diodes.