0
\$\begingroup\$

Please refer to the following image:

circuit and arduino

I hope the quality is not too bad. Anyways, as can be seen, the circuit has its own external power supply from a wall wart (AC to DC transformer). The arduino is being used only to close the circuit by means of providing the signal current to the base.

My question is: is the only thing that needs to be done is to connect the Arduino output to transistor's base? Is there a need to somehow make use of the GND pin in the Arduino (for example, by connecting the -Ve of wallwart along with the emitter to the GND)?

While I am at it, I have another question: how to find the +Ve and -Ve on the female DC jack?

female dc jack

As can be seen, there are 3 pins sticking out of the DC jack, (it is centre positive I think. I bought the jack because it makes it easy to connect the wall wart to the motor, i.e., without having to cut open the adapter's male jack).

\$\endgroup\$
3
  • 1
    \$\begingroup\$ While Olin is a bit of a cranky guy, it would help to have a proper schematic, took me a second to follow the drawing. You also should deal with the back EMF the inductive load will give. Also, always understand that voltage is a relative difference between two areas, thus the use of a ground to provide a reference. \$\endgroup\$ Jul 15, 2015 at 18:52
  • \$\begingroup\$ thanks jarrod, to deal with the back emf of the inductive load(motor), i think i'll use a diode across the motor terminals. i just left it out to avoid making the image even worse, should have provided with a proper schematic like olin lathorp said \$\endgroup\$
    – user221238
    Jul 16, 2015 at 3:25
  • 1
    \$\begingroup\$ FFS, that's a very clear and simple schematic, the question is clear too. The close votes are coming from assholes with a stick lodged firmly into them... \$\endgroup\$
    – Passerby
    Jul 16, 2015 at 15:00

3 Answers 3

1
\$\begingroup\$

You will need to ground the emitter/DC jack's ground with the Arduino. Without doing this the base has no reference point to be driven from.

As for the DC socket. Check first which contact of the plug is positive and which is ground. Most often the internal contact is positive, but not always. Once you've done this, either check the datasheet of the socket or use a multimeter in continuity mode to check which pin the middle is connected to. MY guess would be the one on the back is connected to the center pin, and the other two will be the outer.

\$\endgroup\$
1
  • \$\begingroup\$ thanks sensors, i'll check it out using a multimeter. was wondering if it should also be possible by just trying to light up an LED \$\endgroup\$
    – user221238
    Jul 16, 2015 at 3:31
1
\$\begingroup\$

Yes you will need to connect the arduino ground and the GND of the supply to the dc motor. I also second Jarrods opinion of using a diode (flyback) as this is an inductive load. You can also use a PMOS (with a low Rds and relevant Id) to do the job. Most of the present day MOSFETs have inbuilt flyback diode. Only thing is you need to modify the software of the arduino as the PMOS will on when the arduino output is low and vice verca.

P.S - am assuming you are using a 5V compatible UNO or similar.

\$\endgroup\$
1
  • \$\begingroup\$ thanks vinod, am using the most commonly used model: arduino uno r3 \$\endgroup\$
    – user221238
    Jul 16, 2015 at 4:46
1
\$\begingroup\$

Since others have covered most of your questions, I'll address what I think is missing from their answers:

  1. The third pin on the barrel jack you have is used to detect when the connector is inserted. I rarely use the feature. If you don't use it, leave it unconnected. Here's a links to an article about it: SparkFun tutorial on Power Connectors and a one picture "datasheet":

Barrel jack datasheet

  1. Make sure you have a series limiting current resistor in series with the Arduino output and transistor base. The transistor doesn't limit current by itself, so without the resistor, you'll fry the transistor when you turn it on. You should select the resistor value considering the transistor gain and the amount of current you want to put through the motor. Here's a handy transistor base resistor calculator.

  2. Motors demand much more current to start up than when running free or with a moderate load. This may trip your wall-wart current limiting protection circuit if it's not capable enough making it shut down when you turn the motor on. The symptom of such problem is that your Arduino may reset intermitently and your motor may run jerkly. If that happens, it means you need a more potent wall wart. Or you can solve that using a set of AA batteries to power your setup.

  3. Just so my answer is complete, yes, you must connect the Arduino ground to the DC jack ground.

\$\endgroup\$
3
  • \$\begingroup\$ thanks a lot for such a detailed description. the base resistor calculator was extremely useful \$\endgroup\$
    – user221238
    Jul 17, 2015 at 6:51
  • \$\begingroup\$ yes, after playing around a bit with the barrel jack, i found the 3rd pin to be kind of like a detector to sense whether the male has been inserted or not \$\endgroup\$
    – user221238
    Jul 17, 2015 at 7:47
  • \$\begingroup\$ had been searching for the "base resistor calculator" since a long time: forum.arduino.cc/index.php?topic=335194.msg2311121#msg2311121 \$\endgroup\$
    – user221238
    Jul 17, 2015 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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