This Repository will explain my 2nd task in Electronics and Electrical Power departmentt at SMART METHODS summer training.
- Control the DC motor using H-Bridge in clockwise and then counter clockwise direction.
- Use potentiometer to control the speed of DC motor, and push button to swap the direction of DC motor.
-
Connect the circuit diagram in Tinkercad website.
- Use L293D H-bridge IC (datasheet) which is similar to L298D.
- Vss=5v from controller, Vs= 5v to 36v power supplay, Enable= PWM control, Input= Direction control.
- Circuit digram with direction and speed control (see the code with explination in comments).
-
Now, use potentiometer and push button to control the speed and direction of DC motors (see the code with explination in comments).
- Note that the potentiometer read an analog value from 0-1023 and we should convert it using map() command into PWM which is from 0-255.
- To consider safety, the motors will not start until the push button is pressed for the first time.
-
Printing the max value of potentiometer which is max PWM value
- Task is Done 😍