Go Down

Topic: Arduino controlling DC motor - how to make it as safe as possible? (Read 1 time) previous topic - next topic

Rubid

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.

MarkT

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.
[ I won't respond to messages, use the forum please ]

war_spigot

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)

kf2qd

#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.

Rubid

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?

war_spigot

#5
Mar 24, 2012, 02:44 am Last Edit: Mar 25, 2012, 01:57 am by war_spigot Reason: 1
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)


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.)

pekkaa

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?

Daanii

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?

AdamBrenton

#8
Mar 25, 2012, 09:36 am Last Edit: Mar 25, 2012, 10:00 am by AdamBrenton Reason: 1
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;
-Adam Brenton
Resident Technician @ Impulse Electronics

Rubid

Thanks again guys ;)
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.

pekkaa

Now it seems right  :) 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.

Rubid

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 :) So it draws a little over 0,05A, not 1A ;) 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.


AWOL

Quote
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?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Rubid

AWOL, I will check it personally tomorrow, when I will be able to access the lab ;)
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.


DVDdoug

Quote
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.

Go Up