 These little DC motors change the world. Today we're going to learn about how they work and how you can wire and implement them for your next project. Motors are at the core of high-tech objects such as drones, robots, and cars. The great thing about motors is that they can actually convert electrical energy into mechanical energy. That means they can take electricity and create movement out of it. Tons of motor types exist as you can see here, but the three common motor types used by DIY makers and enthusiasts like us are stepper motors, brushless motors, and the brushed DC motor. We'll be focusing on the brushed DC motor since it's the easiest motor to implement. The reason it's so easy to implement is because unlike brushless motors or stepper motors we do not need a separate driver's circuit for the brushed DC motor. We just need a DC power source. Let's dive a little deeper and actually understand how motors can convert electricity into movement. If we look at a DC motor and tear it apart, we can see that there are two main parts. There's a stator and there's a rotor. The stator is like the casing or like the shell of the motor. It contains a permanent magnet with two poles, the north pole on one side and the south pole on the other side. The rotor meanwhile is a lot more interesting. Look carefully and you'll see multiple electrical windings in the rotor. What this does is actually creates a electromagnet. So when we apply voltage to the terminals of our motor, the voltage is passed down through these tiny little brushes to the rotor. So when the rotor spins, the brushes can provide electrical contact to the rotor as it spins and power the electromagnet that creates this electric force and in turn lets the motor spin. These brushes are in fact unique to this kind of motor and that's why this motor is called the brushed DC motor. Next let's dive one step deeper and actually understand how this electromagnetic force creates movement in the motor. Remember the stator that we talked about? The stator is the outer casing with the two permanent magnets. What this does is create a magnetic field within the motor. Now the rotor interacts with this magnetic field and can create force. Using the left hand rule, we can determine this force. What's really cool about the way motors work is that the direction of the current actually changes as it goes through the rotor. As it enters the rotor, it's going in one direction, then it loops around the rotor and then comes out in the other direction. Because of this, what happens is that one side of the rotor faces or creates a force in this direction and the other side of the rotor creates a force in this direction. What this allows us to do is actually rotate. Next we come to the really ingenious part about how these motors work. Remember the permanent magnet magnetic field will never change. So as the rotor actually rotates 180 degrees and comes to the other side, what happens is that the brushes actually reverse the contact on the rotor. That means if brush number one was touching the left side and brush number two was touching the right side, now they're flipped and brush number one is touching the other side and brush number two is touching the other side. What this does is basically reverse the current flow. So instead of flowing maybe clockwise, now I'll be flowing counterclockwise. What this creates is a force in the exact same direction which allows the motor to keep spinning in that direction. So no matter how many times it spins, every time it rotates 180 degrees, the polarity switches within the motor and creates a force in one direction that lets the motor spin infinitely. Now imagine that we swapped the polarity of the power going into the motor. That means we swapped the connections. What's going to happen is that the current is going to flow in the opposite direction and the force generated within the motor will be in the opposite direction and in turn the motor will spin in the opposite direction. That means by simply swapping the leads, the power leads on your motor, we can cause it to spin in the other direction. This allows us to use circuits such as each bridges here to control which direction we want our motor to spin. So we learned that providing a voltage to the motor will actually cause it to spin. But what if we don't provide voltage to the motor? What if imagine an electric car is going down a hill? We're not accelerating it but because of the hill, the electric motor in the wheels runs faster and faster. What this does is actually create a voltage. The electric motor actually now becomes a power generator. You must add something like a diode to prevent against this voltage coming out of the motor and damaging your circuit. This is actually called back EMF and by adding something as simple as a diode we can protect our circuits against it. Next let's do a short demo of the electric motor, how we can attach it to microcontroller such as the Arduino and the Raspberry Pi and how we can control it and just see how it works. For this demo we'll be using something called the transistor. I've done a whole tutorial on what the transistor is and how it works but basically a transistor allows us to control high current devices such as a motor by just using our GPIO pins or digital pins on the Raspberry Pi and Arduino respectively. Okay so I wired up the circuit using the transistor and I've written simple code for the Arduino and for the Raspberry Pi as you can see here. The code is very simple in the sense that it'll basically turn on and turn off the motor in every one second interval. So here let's actually go ahead plug it in and test how it works. So as you can see every second it'll turn on and then turn off. So again like this you can use different sensors to turn on and turn off digital pins on the Arduino or GPIO pins on the Raspberry Pi to control your motor using transistors. I'm using my Arduino as a power source because it's a low current motor but if it's a high current or high voltage motor that cannot be powered using your Arduino Raspberry Pi then please do use an external power source. Lastly let's talk about the disadvantages of the brushed motor. As the name implies brushed motor the brushes are actually one of the biggest problems with these motors. As the brushes provide electrical contact to the rotors while the rotor is spinning the brushes create a lot of friction and heat. Furthermore because the brushes are constantly rubbing against the rotor this creates a lot of wear on the brushes and leads these motors to have a low lifespan. In conclusion the DC brushed motor is a great little device. Sure it has its cons but its ease of use, affordability and versatility really make it second to none. If you have any questions about this tutorial you can drop them down in the comments below. If you like this video do give me a like and if you want to subscribe to future tutorials such as a tutorial on brushless motors and stepper motors like I mentioned in this video do subscribe for that. Thanks