Arduino is a very powerful hardware+software tool for rapid prototype development based on microcontrollers and embedded systems. It is very widely used nowadays for many different embedded applications. It is the first choice for hobbyists, trainers, teachers, students, scientists and even professionals for developing any embedded system application.
For given application of DC motor speed control, the Arduino can be the best choice because the Arduino microcontroller is AVR ATmega328 that has built in 8-bit PWM output that can be used to vary the speed of DC motor. Here in given application, the potentiometer is used to vary DC motor speed. The set speed and motor speed is displayed on LCD and Darlington transistor TIP122 is used to drive DC motor.
The given project very accurately and linearly controls the speed of DC motor from minimum to maximum as the pot is varied from minimum to maximum and it displays set speed and motor speed as 0 – 100 % on LCD.
1. Data pins D4, D5, D6 and D7 of LCD are connected to Arduino digital pins 5, 4, 3 and 2 respectively. En pin is connected to pin 11 and Rs pin to pin 12. RW pin is connected to ground.
2. A 10K pot is connected to 3rd pin VEE of LCD to vary its brightness. LED+ terminal and LED- terminal are connected to +5 V and ground to turn on LED backlight.
3. Connect pot to an analog input pin A0 as shown. Connect its sliding terminal to A0 and other two terminals to +5 V and ground.
4. Analog output pin 9 is connected to the base input of TIP22 through a current limiting resistor of 470E. The emitter of TIP122 is connected to ground.
5. DC motor is connected between the collector of TIP122 and 12 V external power supply.
• As the pot is varied, it will vary analog input voltage to A0 pin. When it is varied from min to max the analog input to pin varies from 0 to 5 V. Arduino will read this analog voltage and convert it into digital value from 0 to 1023.
• This value from 0 to 1023 is displayed as 0 to 100 % of set motor speed on LCD – means if the value is 1023 the set motor speed is displayed as 100% and vice versa.
• This analog input is used to vary the width of the output pulse on analog output pin 9. The pulse width is also varied from 0 to 100% as the pot is varied from min to max.
• As analog input varies from 0 to 1023 the analog output varies from 0 to 255 and it is also displayed on LCD as 0 to 100% of motor speed.
• Because this PWM output is given to DC motor through TIP122, the motor speed increases as pulse width increases and vice versa.
• The PWM output on pin 9 can be observed on CRO/DSO. One can see the increase in pulse width as the pot is turned CW and also observe an increase in speed of the motor. Similarly, as the pot is turned CCW the pulse width will be decreased and so does the speed of the motor.
The program does the following tasks -:
• Reads the analog voltage on pin A0 and gives corresponding analog output value from 0 to 1023
• Maps this analog input value from 0 to 1023 into analog output from 0 to 255 to vary pulse width on pin
• Displays set speed and motor speed as 0 to 100% on LCD.
The program is edited and compiled in Arduino IDE software. Then it is uploaded into Arduino board microcontroller ATMega328.