Connecting grounds (Arduino UNO)

Hi,
I'm trying to run a small DC electric motor. Every time I connect it to an arduino pin (set to be HIGH) and the ground, for some reason he drops it down to a very small voltage and the motor doesn't run. However, if I connect it to the 5V source it runs fine. But I need the pin to control it.
So, I figured I'll just use a relay and bring some external power to run the motor, BUT the relay is triggered on 5 or 6V and arduino for some reason gives only 4.3V on the pin (when it's HIGH). :~
Then I decided to substitute the relay with a transistor, BUT since the external source (battery 3V) is connected: positive side to collector and the negative side (ground) to emitter, and arduino pin is connected to the base and the ground to emitter, I have to connect two grounds. This actually worked and the motor started running, but it doesn't effect arduino too good, and the next thing I try to upload is denied with a message saying that the Serial port (COM4) is being used. I measured the voltage between grounds and it's about 4.5V...
Now I either have to find a relay that triggers on lower voltage or some other solution? :.

You can't connect the motor directly to the arduino's pins you will burnout the pins. You connect via a transistor. Look in the playground!

Mark

Try this…

I tried connecting it with a transistor (common-emitter circuit), but it requires for me to connect the grounds of the 3V battery (running the motor) and arduino (feeding the base of the transistor)... And there's voltage difference between two grounds. That can't be good

Well, the idea is to eventually have the ability to control the speed of the motor. This seams to give only four function modes - CW, CCW, short-brake, and stop. Thanks anyway :slight_smile:

it requires for me to connect the grounds of the 3V battery (running the motor) and arduino (feeding the base of the transistor)... And there's voltage difference between two grounds.

If you have a wire between the two grounds there should be no voltage difference! Wiring problem??

Sorry, I meant there's voltage difference between the battery ground ( - side) and the arduino ground before I connect them. Around 3.5V to be exact, with arduino ground being the more positive side.

Did you find useful information in playground. there is a wealth of knowledge there. Which playground article came closest to what you wanted?

I found a lot of related topics, but none that really hit the spot. Or maybe I didn't look hard enough :blush:
It actually started to work now, strangely. :S
I assumed that the other (battery) ground by being more negative is drawing current from arduino ground and there for messing it up. I'll test it some more and see what happens...

Normally, before you hook any wires between two devices, there should not be a voltage difference (since no connections).
You would normally connect the grounds together, and since they are connected, there will be no voltage difference.

Can you show us a schematic of what/how things are hooked up. If you have a digital camera, you can just draw it on paper, and take a photo to upload, or use some system more sophisticated.

Here's the schematic drawing, it's pretty simple. And today, the voltmeter is showing 4.5V difference between grounds, before I connect them of course (that's why I put the dotted line).
And once again after I connect them and try to upload something new to Arduino I get the message "Serial port "COM4" already in use. Try quitting any programs that may be using it.". Dunno if that has anything to do with connecting grounds. :~

Note: It should say 1k resistor instead of 10k.

output.jpg

That measurement is meingless. It is just a stray interfering signal you are reading with a digital volt meter, you would not see anything with an analogue meter.

So you're saying that my arduino shows the message "Serial port "COM4" already in use. Try quitting any programs that may be using it." for some other reason? Even though it happens only when I connect those two grounds?

I just figured there must be some link to it...

With that schematic, you would get voltage readings. But the circuit will not work. You must have the ground wire there.
But you also did not show how things are connected to the arduino. That is more of a question?

duje:
So you're saying that my arduino shows the message "Serial port "COM4" already in use. Try quitting any programs that may be using it." for some other reason? Even though it happens only when I connect those two grounds?

I just figured there must be some link to it...

There probbly is some link but it involves information you have not given us. Probbly because you do not realise it is important.
The grounds must be connected together, so that is the end of it. If that results in a problem you have something else wrong as well.

jackwp:
With that schematic, you would get voltage readings. But the circuit will not work. You must have the ground wire there.
But you also did not show how things are connected to the arduino. That is more of a question?

Here's the schematic again, showing how Arduino is connected. And I would like to point out that the ground wires are actually connected and I agree that the circuit wouldn't work otherwise. The dotted line is there just to show which wire I disconnect ONLY when measuring the voltage difference between grounds. Once they are connected there is, as expected, no voltage difference. Hope this clarifies that.

I'm still not sure what could be causing the problem. But I think I'm gonna use the L293 H-bridge (once I obtain it) to operate the motor and perhaps regulate the speed with a PWM signal...

Try putting a diode across the motor.

It worked 2 times, but when i tested the 3rd time i got the message again :"Serial port "COM4" already in use. Try quitting any programs that may be using it.". :frowning:
The diode was put forward-bias parallel to the motor.
What was the idea behind it?

The diode should be put in reverse bias, parallel to the motor. Else the diode will stop the motor, or else burn out.

The idea of the diode, is to prevent back emf from the coils of the motor from damaging the transistor.

jackwp:
The diode should be put in reverse bias, parallel to the motor. Else the diode will stop the motor, or else burn out.

The idea of the diode, is to prevent back emf from the coils of the motor from damaging the transistor.

I tried the reverse bias in parallel - no luck... Though I can see it flash when ever the motor stops, so it's still a good idea to have as a safety method. :slight_smile:

off-topic: What if I change the regular dc motor for a stepper motor. Would I have better speed control? I need to be able to move it really slow. And does it require a mediator (transistor, relay, L293 etc.) or can it be connected directly to the Arduino pin?