8
\$\begingroup\$

I'm using a digital pin as a supply to a sensor (should draw ~7mA).

Unfortunately, the sensor pulls the voltage of the digital pin down from 3.3v to 3.0v, which isn't enough for the sensor.

Can I tie two digital pins together and enable both of them to keep a higher voltage? Or will it release the magic smoke from my mini / do nothing?

\$\endgroup\$
  • 6
    \$\begingroup\$ "I have one of my feet under the shortest leg of my desk to keep it from wobbling, but it still wobbles a bit. Should I put my second foot there to hold it steady?" \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 2 '13 at 4:43
  • 4
    \$\begingroup\$ "A house with a properly fitted floor to correctly support the desk is the correct solution here." \$\endgroup\$ – kolosy Oct 2 '13 at 4:49
  • \$\begingroup\$ I mean, you both arn't wrong haha +1 to both @IgnacioVazquez-Abrams \$\endgroup\$ – Passerby Oct 2 '13 at 5:10
  • \$\begingroup\$ You left out lots of details, like the type of arduino (processor, 5V or 3v3) and the type of the sensor (what minimum voltage does it require at that 7 mA, and is that average or peak?). \$\endgroup\$ – Wouter van Ooijen Oct 2 '13 at 7:42
  • \$\begingroup\$ lol you get a +1 for the magic smoke comment haha \$\endgroup\$ – Anthony Russell Oct 2 '13 at 19:43
14
\$\begingroup\$

Yes, but no.

Yes, you can use two pins to source more current, or in your case, source less current out of each. This is a common practice, but not often used on Microcontrollers. Devices like led drivers, or ULN2803 Motor Drivers, or connecting multiple transistors in parallel. Even multiple resistors in parallel. On a microcontroller, not really designed for heavy current lifting, you still have to deal with the Voltage Droop, you have to make sure that pins connected in parallel to a single source are never in different high/low states (creating a short), and you have to consider that one pin might be stronger than the other (realities of manufacturing). It would be recommended that you place both pins on the same port, so they can be changed at the same time, minimizing any chance for a short.

BUT no, it won't really work for you. You don't say which Arduino Mini, but it really doesn't matter, the different versions all have ATMega168 or ATMega328 chips and they have similar specs, as do most microcontrollers. Output pins experience Voltage Droop. As current sourced or sinked rises, the voltage decreases or increases, depending on the direction of the current and the voltage level.

The two things you need to see is the DC Characteristics for Voh (Voltage Output High), and the Pin Driver Strength.

enter image description here

enter image description here

They do not show characteristics for all VCC levels, but 2.7v and 3.0v are closer to your VCC of 3.3v than 5.0v is, so we will use those two graphs.

Notice that The test condition for VCC = 3v is that Ioh (Current Output High) is -10mA (Current sourced out, its 10mA). At 10mA sourced, the Voh is a minimum of 2.3v. That is 0.7v less than VCC.

Now look at the graph, with current on one side, and voltage on the other. When your output current at Logic High is 0mA, the pin's voltage will be at 2.7v, or VCC. At 5mA, the pin voltage will be at 2.5v. You just lost 0.2v. At 10mA, you are at ~2.2v, a loss of 0.5v.

Even if you put two pins in parallel, you are basically halving the current between the two, but assuming 8mA peak, that is still 4mA each, and that is roughly 0.2v lower than VCC. You would need a few pins in parallel, which might lead to a higher risk than you want and taking up multiple pins for no good reason.

You do not list the sensor you are using, but over all, you should either connect it directly to the 3.3v supply, or use a transistor/mosfet on a single pin if you need to have control over the sensor's power supply.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ cool, thanks. would a simple junction transistor work here, or do i need a full mosfet? thinking of this: sparkfun.com/datasheets/Components/BC546.pdf \$\endgroup\$ – kolosy Oct 2 '13 at 5:12
  • 1
    \$\begingroup\$ @kolosy honestly, it might or might not. Any small signal npn or mosfet can work, but neither is perfect. And your sensor is sensitive. If a 0.3v vcc difference stops it from working, you might have problems with either. A npn transistor has about a 0.2v drop on VCE (not the same as the 0.6v drop on VBE for silicone transistors). That means 3.1v for your sensor, and 0.2v for the transistor. A mosfet has a very low DS resistance, but it could be enough to affect your sensor. Is your sensor a 3v or 3.3v or 3.6v sensor? \$\endgroup\$ – Passerby Oct 2 '13 at 5:26
  • 1
    \$\begingroup\$ actually - it's not that sensitive, i'm just at the bottom range of it's power rating. it can do 3.3v - 20v, and produces 0-3v as the output. it's just a moisture sensor: vegetronix.com/Products/VH400 .. this whole thing is running from a LiPo battery, so I can just feed the battery line in, which won't drop below 3.4v or so. \$\endgroup\$ – kolosy Oct 2 '13 at 5:31
  • \$\begingroup\$ @kolosy oh then yea, that npn is fine, as is any other, 2n3904, 2n2222, any small signal would do lovely. \$\endgroup\$ – Passerby Oct 2 '13 at 5:44
6
\$\begingroup\$

You could.... but it's a bad idea.

Typical microcontroller pins can easily source or sink up to 40mA (at least, this is typical of the AVR chips most Arduino boards are built around). So, current draw is not likely the problem.

It is also common for the pins set as digital outputs to be a few to a few dozen millivolts below the supply rail, meaning a 3.3V supply will not show up entirely on the output pin. This is known as voltage droop.

If your sensor needs a higher voltage supply, you will need to increase you supply rail (for example, from 3.3V to 5V) or power the sensor external from the Arduino - that is, connecting it's power supply pin directly to your 3.3V source.

Besides, it is not good practice to use an I/O pin as a direct power supply for anything, but rather, a pin can be used to control an electric swtich, such as a MOSFET or other switching IC.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

The specs on the sensor say 3.3V to 20V.

If you have any voltage greater than 3.3V on the board, I would suggest you use that instead.

The sensor will still give you a 0-3V output.

Even with two cpu pins connected together, it is still going to drop below 3.3V a bit, and the sensor will be out of spec.

If a) no higher voltage is available, or b) you need to turn off the sensor power, I would suggest using a logic level p channel FET to supply power to the sensor.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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