SHOPEE COMPRAR AGORA
All of that and more are discussed in this previous tutorial about DC motor control with L293D driver. Check it out and come back to resume developing our DC motor driver library for STM32 microcontrollers.
Brushed DC motors have been in use for about two hundred years. Although more recent technologies have partially replaced them, they are still popular in different industries and applications.
Note that: I’ve deleted the Automóvel-generated TIM2 initialization function and its parameter. Since our DC Motor library will handle that, we don’t need that function at all.
The 555 Timer is capable of generating PWM signal when set up in an astable mode. In you are not familiar with the 555 Timer you can check my previous tutorial where I explained in details what’s inside and how the 555 Timer IC works.
So I’ve decided to use that function instead to keep the code more generic across all STM32 microcontrollers. Without having to figure out a way to find out which pin belongs to which timer’s channel and all that stuff.
The output of the IC needs to be connected to the base of the transistor through a resistor, and in my case I used 1k resistor. For preventing any voltage spikes produced by the motor we need to use a flyback diode which is connected in parallel with the motor.
The speed of rotation can be controlled by controlling the rate at which the phases change. We use the name “120-degree conducting control” to the 6-mode control method described here.
BDC motors may have a very simple design and are easy to control (some of them may not even need a controller). This is a cost-effective solution that can perfectly fit low voltage devices powered by lithium-ion batteries, including robotics and consumer electronics.
Most of us at the beginning think that only the duty cycle controls the DC motor speed. However, it’ll turn out to be not exactly true, also the FPWM has a strong effect if not picked correctly as we’ll see.
If you need a controller for a BDC motor, you can use an off-the-shelf device that fully meets your requirements. Or you can build your own solution with a tailor-made circuit design and custom firmware.
When the entire field is connected, the motor runs at the lowest speed. The speed can be further increased in steps by cutting out the resistance in the series turns. This method of speed control is used in electric traction.
The resistors can be any value but getting the exact speed needed from the motor requires testing with a certain range of resistors. The values of the resistors add up linearly so it is easy to calculate how to increase or decrease the motors speed by simply adding the values together. For example, two 1kΩ resistors wired together will act the same as a 2kΩ resistor.
I would like to have a little give though with the transistor, so that if I later get a fan with a slightly higher wattage, it wont burn out the system; hence want to switch from the 800mA limit on the 2n2222a.
The output of the 555 timer can sink or source a current of 200mA to the load. So if the motor that we want to control exceeds this rating we need to use a transistor or a MOSFET for driving the motor. In this example, I used a (TIP122) Darlington transistor which can handle a current up to 5A.
SHOPEE COMPRAR AGORA