Arduino controlling DC motor - how to make it as safe as possible?

Hi everyone,
can you please tell me how to make this schema as safe as possible?
What I mean is that I want to know if I should connect a diode, resistor or an voltage regulator somewhere here? I've read about a resistor between the transistor base and Arduino, but don't know if its only for getting apropriate voltage on the base or if its responsible for something different.

When Arduino is connected with my PC, and I turn the power on (the transformer at the right side of the schema), I hear that Windows "new USB device" sound and Arduino restarts... Do you know what I mean?

Cheers,
Maciek.

Unfortunately that Fritzing diagram isn't very informative - we don't know the pin-out of the device, nor what kind of device it is.

You will need a flywheel diode to protect the device from inductive spikes, what ever the circuit.

You probably need a current-limiting resistor from the Arduino pin controlling the device.

Assuming the collector/emitter are connected correctly(polarity wise) there should be a resistor(~1k) from the arduino the base (the middle one, I'm assuming), and the ground from the arduino to the ground on the battery(I think that's the thing in the top right). You also need a diode in reverse in parallel with the motor(in other words, the diode is across the motor's leads and when the motor is on, current will not flow through it)

#1 - Your grounds are not tied together. The ground for the motor circuit is the - side of the supply. The pin you are tied to is not ground.

OK guys, here is the diagram in which I included your suggestions. Please check it.

Do I need to put a capacitor in paralel with the diode to prevent from noise?
Also, what do you think about using an optocoupler between Arduino and transistor base?

war_spigot, how do you know that the value of the resistor should be 1k?

~~That seems to be good unless I'm missing something. ~~
Edit: yes, the Arduino GND should go to the emitter(so it's on the same row as the battery GND)

Rubid:
war_spigot, how do you know that the value of the resistor should be 1k?

I have a lot of 1k resistors, so I always use those. It limits current to the base, but you need enough current through the base to allow current from collector to emitter. The current needed would be based on the current that will be drawn and the current gain of the transistor. If you're putting it in a project you might want to use the most optimal resistor, but just to test something, it doesn't really matter(others may say differently, but that's just my opinion.)

I don't think it's right. What is the polarity of the wires from the power supply? If the yellow wire is + and the black wire is GND, you seem to bypass the transistor, assuming that the PSU's GDN is connected to Arduino's GND as it should be. How do you power the Arduino? Do you use the same PSU?

Yes, as pekkaa says, your Arduino ground and your power supply ground should be connected. Move the black wire that goes to the Arduino ground to the other outside leg of the transistor, so that the power supply ground and Arduino ground are wired together.

Also, are you sure you have the transistor wired correctly? What transistor is it?

New to the forum but Here is what im using for my DC brushless; adjust fuse size depending on the motor;

note not all TO-92 transistors have the same biasing so the basic graphical representation that you are providing could be misleading in some cases;

Thanks again guys :wink:
You're right again, the electric schema of that wrong circuit is shown below.

Also, I've corrected the circuit. The image (breadboard and schema) of the proper circuit is also attached.

Hope that this topic will be useful and clear for everyone interested in using Arduino with a DC motor.

Now it seems right :slight_smile: Btw, have you check from the transistor's data sheet how much current it can handle? If the motor draws 10W@9V, it means a little over 1A. 1A is the maximum for many common transistors, such as BC 639.

You've scared me peakkaa!
I checked that before I bought this components... My mistake is of course on the schema, because this is a 0,5W DC motor - not a 10W DC motor :slight_smile: So it draws a little over 0,05A, not 1A :wink: So my transistor is appropriate. Uff...

If we are already talking about transistors - how can I know what is the best (safe &efficient) base current for a transistor? In the datasheet I have only collector current in the "Absolute maxiumum ratings" table. There is nothing about the typical base current.

8854.pdf (43.3 KB)

So it draws a little over 0,05A, not 1A

Even tiny phone vibras can take 70 to 100mA - what kind of motor are you using that draws only 50mA?

AWOL, I will check it personally tomorrow, when I will be able to access the lab :wink:
My friends says that its a 0,5W motor so I trust him. Its also hard to calculate the current, because on the power supply, there is a small potentiometer and the maximum voltage is 9V, but usually we are using about 5-6V.

The transistors maxiumum collector current is 100mA, so when voltage equals 5V we can use a max 0,5 W motor. As I said - I will check it personally - if the motor power is greater I will replace the transistor.

But maybe you're right - even if it is a 0,5W motor I can't use a transistor with maximum collector current equal my current. I will search for another one.

If we are already talking about transistors - how can I know what is the best (safe &efficient) base current for a transistor? In the datasheet I have only collector current in the "Absolute maxiumum ratings" table. There is nothing about the typical base current.

The current gain of a transistor is called the beta. You should see a minimum beta listed on the spec sheet, and there might be a curve showing beta over a range of operating conditions. Typical beta is about 100.

You want to saturate the transistor... you don't want to turn it partially-on, or you can overheat it. That means if your motor needs 50mA* (max), the base of a transistor with a beta of 100 would need 1/2mA minimum. It's best to pump a little extra current into the base to make sure it's saturated. Once the transistor is fully-on (saturated), the current is limited by the load and increasing base current does not increase CE current.

if you don't have the beta for the transistor, design for a beta between 20 & 50, and you should be OK.

  • Double check that. Again, if you don't allow for enough current, the transistor won't saturate and it may overheat.

Thanks DVDdoug!
Now its clear for me.

Guys, please refer to this topic in which I will continue to describe my struggles.