Saturday 4 November 2017

Beginner DC motors

DC motor circuit - no Arduino yet
I finally have progressed far enough with my Arduino to be able to start setting up my car. In the starter kit you do eventually get to DC motors, but it's about lesson 9 out of 15. There is a bit to work through before you get there. I thought it would be easier to set up the motors than what it is, but there is all this stuff about inductance and back-emf and having to protect your circuitry. Also DC motors require more current than the Arduino can provide. Moving things takes a lot of energy, and when the DC motor starts it draws as much current as it can, the Arduino only provides 40 mA, which is not enough for the motor to start moving.

The basics of running a DC motor is that you would need a diode and a power source. This doesn't even require the Arduino. If you want to also use the Ardiuno then you will also need a transistor. The transister allows you to control the high voltage/high current power source with your low current Arduino. It is basically a digital switch, providing a voltage closes the transistors gate, and allows the higher voltage/current to flow through into the motor. The diode is necessary to protect your transistor from the DC motor.

DC motors are inductors, in that the electrical current being passed through the motor induces a magnetic field. When you turn off the electrical current, by opening the transistor gate, the magnetic field starts to collapse, but the energy stored in the motor will oppose this change in the magnetic field, and so try to generate a current to keep that magnetic field going. This means it's trying to arc over the opened gate in the transistor. This can damage the transistor because this arc can generate a lot of heat, think of lightning.

In order to prevent the damage you add the diode. The diode allows current to flow in one direction only, it's like a dam, water can only flow out of a dam, not up the dam wall. So if you add a diode you can create a circuit such that when the transistor gate is closed no current is flowing through the diode, only the motor, but when the gate opens, the diode allows the induced current to flow through it, rather than causing an arc across the transistor gate. There are still some limitations, if you had a massive motor and used a tiny little diode that wouldn't work well. For a start you could get current still flowing through the diode, as if you apply enough energy to water, you can get it to flow up the dam wall. Doing that to a dam might be ok, but a diode is going to be pretty unhappy.
Circuit diagram, when the switch is open, current
generated by DC motor flows through diode
The other thing with DC motors that threw me off to start was that there is no negative and positive marking. Up until that point everything with my Arduino was very clearly marked as positive and negative, there was always one way for components to go in your circuit, and suddenly you have this thing that can fry your components, but with no markings. This is because for a motor it doesn't matter, it can go forwards or backwards, you flow current one way, the motor turns, you flow it the other way, it turns the other way.



I'm using a motor similar to this DC Motor, since I kind of guessed at the type of motor I wanted to get when buying my Arduino, this one worked pretty well.

No comments:

Post a Comment