parallel microcontroller outputs to increase current capability - Page 1
Forum section: electronics / general

author: webgiorgio
author_rank: Regular Contributor
timestamp: December 08, 2013, 01:22:02 pm
content: Hi,Is it a good idea to connect together two outputs of a microcontroller together to increase the current output capability?On a PIC16F886 I connected pins RC5 and RC4 in parallel (drive a buzer 5V 35 mA).I made a small test program that makes a 0.5 Hz square wave.The problem is that on those two pins it does not work, while it works on pin RC7, where I've put a second buzer. (test buzer)I tried having RC5 and RC4 both as output, and also configuring the tris_C so that one is an input, and the other one is output. ...but I never get to measure voltage in RC5 RC4 node.Am I doing someting wrong or I just fried RC4 and RC5?

author: filip_cro
author_rank: Regular Contributor
timestamp: December 08, 2013, 01:49:53 pm
content: Connecting outputs is usually not a good idea. Use buffer or transistor instead

author: fcb
author_rank: Super Contributor
timestamp: December 08, 2013, 04:34:26 pm
content: In general, it isn't a good idea to parallel uC pins, however if you pay careful attention to the timing on the pins and what you are driving, then it can work.Firstly, you should try and ensure both pins switch at the same time. So writing to those port pins using BSF/BCF will result in temporary shorts, so you need to suck in the value of the port, modify the value, then write it out. Or you could use boolean logic.I haven't written for the 16 series for a good few years, but something like-turnon:movlw 0x00110000iorwf PORTCturnoff:movlw 0x11001111andwf PORTCPersonally, I'd bolt on a 2N7002 and use just one pin.

author: dannyf
author_rank: Super Contributor
timestamp: December 08, 2013, 06:16:39 pm
content: QuoteImpossible to tell without seeing your code + schematic.

author: Kremmen
author_rank: Super Contributor
timestamp: December 09, 2013, 11:14:19 am
content: Quote from: webgiorgio on December 08, 2013, 01:22:02 pmWell... yes! Why else do you think they were fried?

author: poorchava
author_rank: Super Contributor
timestamp: December 09, 2013, 11:44:59 am
content: You cannot switch them one by one, you need to switch them at once and make sure that your compiler understands it that way. It will be best if you code that in ASM.It's much safer to use a schottky diode for this (for example dual diode with common cathode - BAT54C). This way you will not fry any port even if one is high and the other one is low, but that's good only if you need the port to source OR sink current (use common anode in this case - BAT54A).

author: tszaboo
author_rank: Super Contributor
timestamp: December 09, 2013, 04:30:01 pm
content: Quote from: webgiorgio on December 08, 2013, 01:22:02 pmYou could just use a transistor, like BC846 to boost the current.On a side note this is not a good idea on a MCU, it is actually valid option on CPLDs and FPGAs.

author: macboy
author_rank: Super Contributor
timestamp: December 10, 2013, 04:01:03 pm
content: RC4 and RC5 share function with the MSSP. Ensure that the MSSP is not enabled, or those pins will be driven by the MSSP rather than the state of the PORTC register.RC7 is not used by the MSSP (but it is used by the USART).The outputs on a PIC are internally current-limited and it is rather difficult to kill them even with a short-circuit.

author: Jeroen3
author_rank: Super Contributor
timestamp: December 10, 2013, 08:22:40 pm
content: Pins, other from parallel data, are not designed for power output. Keep them under <5mA al all cost.The sum al all pin currents ends up in the VCC and GND pads, depending on the chip, this can be very limiting. Sinking/Sourcing all pins might not even be possible without getting oscillator troubles.

author: fcb
author_rank: Super Contributor
timestamp: December 10, 2013, 11:13:04 pm
content: Quote from: Jeroen3 on December 10, 2013, 08:22:40 pmRubbish.Read the datasheet.Absolute max on typical port pin is +/-25mA.Max current for all ports combined is 200mA.Max current thorugh Vss is 300mA and Vdd is 250mA.

author: webgiorgio
author_rank: Regular Contributor
timestamp: December 13, 2013, 08:39:47 pm
content: Thank you for all the comments, I gained a lot of knowledge.If I drive them up one pin at the time, I will have no output at all. I guess in that short intervall the PIC puts them in a "current protection".If I disconnect the two pins, I see the voltage on one, and also on the other one.So, I didn't ruined the outputs.I will change the code so that I update the outputs on port C exactly simultaneously all pins, just to try if it works.Then I will go for a small mosfet (2N7002). The mosftet looks better than a transistor so that I save a resistor for the base/gate.tnx everybody

author: AndersAnd
author_rank: Frequent Contributor
timestamp: December 13, 2013, 09:46:09 pm
content: Quote from: webgiorgio on December 13, 2013, 08:39:47 pmBe very careful with static electricity when using MOSFETs, especially if they are connected to external plugs or similar.In a previous job repairing televisions I have replaced countless damaged 2N7002 MOSFETs connected near an external plug. A very common fault on a certain models.BJTs are much harder to destroy. If you don't want extra resistors externally you can get BJTs with built-in resistors.Available in standard small signal transistor packages like TO-92 and SOT-23.Fairchild call them "Digital / Bias-Resistor Transistors":http://www.fairchildsemi.com/search/discretes/bipolar-transistors/digital-bias-resistor-transistors/ON Semi call them "Bipolar Digital Transistors" / "Bias Resistor Transistors" (BRTs):http://www.onsemi.com/PowerSolutions/parametrics.do?id=799NXP call them "Resistor-equipped transistors" (RETs):http://www.nxp.com/products/bipolar_transistors/resistor_equipped_transistors_rets/The schematic symbol for a NPN RET looks like this and you can get different types with different values for R1 and R2:

author: cthree
author_rank: Frequent Contributor
timestamp: December 14, 2013, 05:43:38 am
content: A MOSFET is an excellent choice. Using a transistor is best practice. Power peripherals from a power rail and not from the micro controller. Use GPIO pins for IO. Be aware of how much current (and power) you are putting through your transistor. You may not fry your PIC but you can fry your transistor.

author: fcb
author_rank: Super Contributor
timestamp: December 14, 2013, 10:56:24 am
content: Quote from: cthree on December 14, 2013, 05:43:38 amI don't want to sound grumpy or mean, but there is quite alot of **** being talked here.MOSFET's, yeah great if they suit what you are doing and are appropriate! If you follow the serving suggestion, then it won't be damaged."Transistor is best practice" - if it's appropriate and meets your requirements, then great, design it in."Power peripherals from a power rail and not from the micro controller" - if it's appropriate! Countless millions of designs power LED's from PIC's - again, read the spec sheet.+1 for the digital transistors - they also tend to be cheap.

author: westfw
author_rank: Super Contributor
timestamp: December 17, 2013, 07:14:09 am
content: QuoteI don't know that anyone would say that it is "a good idea", but it seems to be done often enough that it certainly works. (BEAM robotics and Micro IR RC planes are a couple places where such output paralleling shows up pretty often.) In general, microcontroller outputs are MOS transistors, which are "somewhat OK" to parallel (IIRC, the argument is that they have the appropriate temperature behavior, such that if one carries more current, it heats up, which causes it to conduct less, which causes it to cool down. In CONTRAST with bipolar transistors, BTW.)Note that a transistor based solution does not provide the "push/pull" outputs typical of most modern microcontrollers; a single transistor will push OR pull, but not both. A 555 timer may be a convenient high-current push/pull driver (200ma) Or something like a 74ACxx chip (possibly with some outputs in parallel.)BEAM paralleled gate motor driver:http://solarbotics.net/library/circuits/driver_240.html(Hmm. My favorite IR RC sites have gone dead :-( )EDIT: here's the main one:http://www7b.biglobe.ne.jp/~toko0131/pic/0045/index.html(I should probably note that these are not "professional" circuits.)

author: Jeroen3
author_rank: Super Contributor
timestamp: December 18, 2013, 11:29:29 pm
content: Quote from: fcb on December 10, 2013, 11:13:04 pmNot completely rubbish on modern 32bit ic's.

author: westfw
author_rank: Super Contributor
timestamp: December 19, 2013, 09:39:14 am
content: Quotetrue, but the OP did mention a particular PIC processor...On many newer chips, 5mA is only available on special "high drive" pins. LPC210x datasheet says you should stick to about 4mA, and some other ARM chip I recall looking at (Stellaris?) had configurable 2/4/8mA.It's a bit sad to read something like "two high-current outputs capable of directly driving LEDs without external transistors", if you're used to robust 8bit micros...

author: NiHaoMike
author_rank: Super Contributor
timestamp: December 20, 2013, 04:21:10 pm
content: Blue LEDs don't need much current to appear bright.