Author Topic: parallel microcontroller outputs to increase current capability  (Read 10284 times)

0 Members and 1 Guest are viewing this topic.

Offline webgiorgioTopic starter

  • Regular Contributor
  • *
  • Posts: 70
  • Country: dk
parallel microcontroller outputs to increase current capability
« on: December 08, 2013, 01:22:02 pm »
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?
 

Offline filip_cro

  • Regular Contributor
  • *
  • Posts: 71
  • Country: hr
Re: parallel microcontroller outputs to increase current capability
« Reply #1 on: December 08, 2013, 01:49:53 pm »
Connecting outputs is usually not a good idea. Use buffer or transistor instead
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
paralleling pins
« Reply #2 on: December 08, 2013, 04:34:26 pm »
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 0x00110000
iorwf PORTC

turnoff:
movlw 0x11001111
andwf PORTC

Personally, I'd bolt on a 2N7002 and use just one pin.

https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: parallel microcontroller outputs to increase current capability
« Reply #3 on: December 08, 2013, 06:16:39 pm »
Quote
Am I doing someting wrong or I just fried RC4 and RC5?

Impossible to tell without seeing your code + schematic.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: parallel microcontroller outputs to increase current capability
« Reply #4 on: December 09, 2013, 11:14:19 am »
Am I doing someting wrong or I just fried RC4 and RC5?

Well... yes! Why else do you think they were fried?
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: parallel microcontroller outputs to increase current capability
« Reply #5 on: December 09, 2013, 11:44:59 am »
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).
I love the smell of FR4 in the morning!
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7384
  • Country: nl
  • Current job: ATEX product design
Re: parallel microcontroller outputs to increase current capability
« Reply #6 on: December 09, 2013, 04:30:01 pm »
Is it a good idea to connect together two outputs of a microcontroller together to increase the current output capability?
You 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.
 

Online macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: parallel microcontroller outputs to increase current capability
« Reply #7 on: December 10, 2013, 04:01:03 pm »
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.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: parallel microcontroller outputs to increase current capability
« Reply #8 on: December 10, 2013, 08:22:40 pm »
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.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: parallel microcontroller outputs to increase current capability
« Reply #9 on: December 10, 2013, 11:13:04 pm »
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.
Rubbish.
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.


https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline webgiorgioTopic starter

  • Regular Contributor
  • *
  • Posts: 70
  • Country: dk
Re: parallel microcontroller outputs to increase current capability
« Reply #10 on: December 13, 2013, 08:39:47 pm »
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. :-/O

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
 

Offline AndersAnd

  • Frequent Contributor
  • **
  • Posts: 572
  • Country: dk
Re: parallel microcontroller outputs to increase current capability
« Reply #11 on: December 13, 2013, 09:46:09 pm »
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.
Be 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=799

NXP 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:

« Last Edit: December 13, 2013, 09:48:14 pm by AndersAnd »
 

Offline cthree

  • Frequent Contributor
  • **
  • Posts: 258
  • Country: ca
Re: parallel microcontroller outputs to increase current capability
« Reply #12 on: December 14, 2013, 05:43:38 am »
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.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: parallel microcontroller outputs to increase current capability
« Reply #13 on: December 14, 2013, 10:56:24 am »
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.
I 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.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: parallel microcontroller outputs to increase current capability
« Reply #14 on: December 17, 2013, 07:14:09 am »
Quote
Is it a good idea to connect together two outputs of a microcontroller together to increase the current output capability?
I 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.)

« Last Edit: December 17, 2013, 07:32:27 am by westfw »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: parallel microcontroller outputs to increase current capability
« Reply #15 on: December 18, 2013, 11:29:29 pm »
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.
Rubbish.
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.
Not completely rubbish on modern 32bit ic's.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: parallel microcontroller outputs to increase current capability
« Reply #16 on: December 19, 2013, 09:39:14 am »
Quote
Not completely rubbish on modern 32bit ic's.
true, 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...

 

Online NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9018
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: parallel microcontroller outputs to increase current capability
« Reply #17 on: December 20, 2013, 04:21:10 pm »
Blue LEDs don't need much current to appear bright.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf