DC motor is an electromechanical device that converts electric energy into mechanical, i.e. it converts direct current into circular motion, but can also work in the opposite direction and convert circular motion into electric energy. Small DC motors are devices operating on a DC voltage, which can be concluded because of their name, their speed is easily controlled and that is why they are suitable for various hobby projects. DC motors are widely used in different devices, so if you have ever disassembled a toy or a device that had some movable parts, within there was a DC motor that made everything work.
The main parts of the motor are rotor and stator, as with any other motor, but this type of motor also has a commutator with carbon brushes. DC motors are performed with an independent, serial or complex excitation, or there can be a permanent magnet located on the stator as an excitation. We will describe the DC motor that has a permanent magnet on the stator, and on the rotor there are windings that are connected to the power supply using commutator and carbon brushes. Commutator consists of lamellas that are connected to the rotor windings and by which the direction of current through the windings changes two times at every rotor turn.
HOW DOES IT WORK?
The basic principle used by all motors is that force is applied to the conductor through which the current flows in a magnetic field. With DC motors, the magnets on the stator create a magnetic field, and through windings of the rotor the current is passed and the force which turns the rotor is applied on the windings. Lamella 1 is connected to the plus, and lamella 2 to the minus. As the winding is located in the magnetic field, the force is applied to it and and it turns the winding. During the turn of the winding lamella 1 and 2 are switched and now lamella 1 is connected to the minus, and lamella 2 to the plus and because of that the rotor still turns and the entire cycle is repeated. The rotor contains several windings in order to get more power, and because of more windings there are more lamellas to which we connect the windings. Animation shows how it looks like and it is easier to understand how the motor works and how the winding constantly turns.
If the rotor of the DC motor is turned on its terminals we will get the voltage proportional to the motor rotation speed, so these motors can serve as electricity generators.
HOW TO USE IT?
The DC motor has 2 terminals, one is connected to the plus pole of the power supply and the other to the minus. If we want to change the direction of the motor rotation we just need to switch the plus and minus poles and the motor will rotate in the opposite direction. We change the motor speed with the change of motor power supply, but we have to make sure that the motor does not bring too much voltage to damage it. If we want to control the motor with Croduino, we should use MOSFET as a switch, and to change the direction of the motor and the speed control, use the H bridge.
SPEED CONTROL USING DASDUINO
In this tutorial we will make an example of using Dasduino for motor speed control using potentiometer.
We connect the components according to the scheme, move the displayed code to Dasduino and we are ready to work
//variable to which we save the potentiometer value
//variable to which we save motor speed
//pin to which we connect the gate of MOSFET
//defining pin to which we connect MOSFET as an OUTPUT
//turning the motor off
//from the analog input A0 we read the potentiometer values
//variable pot which has values from 0 to 1023 is turned into variable speed with values from 0 to 255
// set the value speed to motorPin to which we have connected MOSFET