Pages: [1] 2   Go Down
Author Topic: Arduino controlling DC motor - how to make it as safe as possible?  (Read 1640 times)
0 Members and 1 Guest are viewing this topic.
Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* projekt_polaczenia_v1.0.jpg (54.66 KB, 768x922 - viewed 40 times.)
Logged

0
Online Online
Shannon Member
****
Karma: 220
Posts: 12710
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

Arkansas, US
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
I only ever use XAND and XNAND gates.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?


* projekt_polaczenia_v1.1.jpg (56.7 KB, 768x922 - viewed 34 times.)
« Last Edit: March 23, 2012, 12:51:22 pm by Rubid » Logged

Arkansas, US
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
I only ever use XAND and XNAND gates.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
« Last Edit: March 24, 2012, 07:57:57 pm by war_spigot » Logged

Finland
Offline Offline
Sr. Member
****
Karma: 1
Posts: 270
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 3
Posts: 258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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;


* 12vMotorControl1.1.png (8.49 KB, 1495x1060 - viewed 15 times.)
« Last Edit: March 25, 2012, 03:00:48 am by AdamBrenton » Logged

-Adam Brenton
Resident Technician @ Impulse Electronics

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* projekt_polaczenia_v1.1_schem.jpg (37.34 KB, 866x797 - viewed 11 times.)

* projekt_polaczenia_v1.12.jpg (61.64 KB, 690x607 - viewed 18 times.)

* projekt_polaczenia_v1.12_schem.jpg (37.78 KB, 814x780 - viewed 19 times.)
Logged

Finland
Offline Offline
Sr. Member
****
Karma: 1
Posts: 270
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now it seems right  smiley 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.
Logged

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley So it draws a little over 0,05A, not 1A smiley-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.32 KB - downloaded 5 times.)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

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

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Edison Member
*
Karma: 37
Posts: 1354
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2   Go Up
Jump to: