4
\$\begingroup\$

We have a 3 AA batteries-powered Santa figure (which sings and dances :P ) we want to control from an Arduino Uno board.

Being quite noob to electronics and Arduino, we have been able so far to light up a set of Xmas AC-connected lights using Arduino and a relay.

The complimentary Santa figure is giving more problems: We have connected the Arduino board's GND pin to the negative pole of the batteries' case and a digital output pin (pin 10) to the switch of the figure (which is always switched on, to let current turn the figure on).

But the most we could get was a bit of led blinking in the figure, as if the current was not being constantly held.

So is there any standard layout to connect the figure to the Arduino board or do we have to connect the pins in a different way?

\$\endgroup\$
  • \$\begingroup\$ While a MOSFET would be a professional solution, someone new to things like this might have an easier time with a generic NPN transistor driving a small relay, since the care and feeding thereof is substantially simpler. \$\endgroup\$ – Chris Stratton Nov 29 '12 at 20:48
  • \$\begingroup\$ @Chris -- Fair enough, but the component count and cost are higher... Relay's are messy too (care-and-feeding-wise). \$\endgroup\$ – DrFriedParts Nov 30 '12 at 0:20
5
\$\begingroup\$

Summary

Your diagnosis is correct. Your Santa figure requires more power to operate than the Atmel ATMega MCU can supply (Santa input impedance too low; MCU output impedance to high) from one of its GPIO pins (~14mA*, max, safely). Continuing to attempt to power it in this way will ultimately result in the destruction of the Arduino's processor's output pin (specifically, the internal component known as the output buffer).

You need an amplifier. The simplest way (component count, cost, tolerance to variation) to do this is to put an N-type MOSFET (NFET) in the ground path of the Santa figure.

Proposed Solution

Schematic

Simplified Schematic

Netlist

The above schematic embodies the following netlist:

  • Battery(+) --> Santa(+)
  • Battery(-) --> NFET(Source)
  • Arduino(GND) --> NFET(Source)
  • Arduino(GPIO) --> NFET(Gate)
  • Santa(-) --> NFET(Drain)

Note: I haven't really addressed your power supply situation. If you require further assistance with that, let me know.

Explanation of Solvency

Notice the two connections to the NFET Source Pin. This configuration is called a common-source amplifier (bet you can't figure out why ;-) ). For your application, practically any discrete NFET you are likely to encounter will work.

I'll elaborate more specifically on the (1) parameters of principal interest, (2) design constraints that guide their selection, (3) an approximation of the value, and (4) the rationale:

Ids,max

  1. The maximum continuous allowable drain-to-source current of the transistor
  2. Choose for >2 times the expected current demand of the Santa (Isanta)
  3. Perhaps something like 2A is reasonable given the 3AA battery compartment
  4. Prevent excessive voltage drop and temperature rise in the transistor

Vgs,th

  1. The "threshold" voltage at which the transistor "turns on" (the voltage at which the channel begins enhanced linear behavior)
  2. Choose Vgs,th < 0.9 * Vcc,arduino
  3. Let's say, Vgs,th < 4.5
  4. If Vgs,th is too high then the resulting Rds (resistance in the transistor channel) will be higher resulting in more voltage drop in the transistor (lower voltage delivered to the Santa) and less current flow. At excessive levels the transistor will be in cut-off (effectively an "off" switch) and the Santa will not sing and dance (oh no!).

Qg

  1. Total gate charge -- the total amount of charge transfered to the gate during a charge cycle.
  2. If Qg > 10nC, use R1 to limit the in-rush current
  3. for 2, a rather large transistor compared to the output buffer of the arduino, Qg = >50nC. Set R1 = 250 to 1k Ohms.
  4. There is a wide latitude in these numbers since you are dealing with operating characteristics and long-term reliability. The overriding goal is to prevent the gate, which momentarily looks like a short-circuit when switching, from sucking too much current out of the arduino's output buffer and doing a little bit of damage in the process that accumulates over time. Externally limiting this instantaneous current with R1 > Varduino/Iarduino,safe is an excellent practice. The exact value of Iarduino,safe has been the subject of some debate as described by @Kortuk below.

A Suggested Part

Vishay Si4836Dy -- probably overkill, but will definitely work.

*This value varies based on the supply voltage of your circuit and temperature, please check the datasheet of your specific chip with your operating conditions to determine the acceptable value here, 14mA should be safe for all operating conditions of the chip used in an arduino. 20mA should be more then safe if you are using an arduino.

\$\endgroup\$
  • \$\begingroup\$ These comments became non-productive and people took a technical discussion and made it personal. This is not okay. it is okay for someone to think you are wrong and downvote and ask for more information, dont make personal attacks, dont make the feedback personal, this is a technical forum. The worst that can come of such a discussion that stays technical is more information. \$\endgroup\$ – Kortuk Nov 29 '12 at 22:18
  • 1
    \$\begingroup\$ I have performed an edit trying to clarify the point that was asked about based on your comment @drFriedParts. In the future take a question about source/subject matter as a chance to teach someone else something and expand on a subject others could use more information about. A downvote is easily reversed, they cant reverse without an edit. If you clarify and prove your point in your answer then the answer becomes better and you have a chance to earn another upvote and lose a downvote! I think a circuit in this case might be useful to show how to hook up the FET, have you seen circuitlab.com? \$\endgroup\$ – Kortuk Nov 29 '12 at 22:23
  • \$\begingroup\$ @Kortuk mr. circuitlab summoned! \$\endgroup\$ – clabacchio Nov 29 '12 at 23:18
  • \$\begingroup\$ Recent edits by @clabacchio and others made this answer better. I removed my -1. \$\endgroup\$ – user3624 Nov 29 '12 at 23:27
  • \$\begingroup\$ @Kortuk -- Ah! yeah, that makes sense. Didn't see the edit function before. Sorry. New here. Thanks! Edited as requested. \$\endgroup\$ – DrFriedParts Nov 30 '12 at 0:01

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.