Only difference is that and additional motor driver circuit using a transistor is included in the circuit. The working principle and program of this circuit is same as that of the LED brightness control. The wave form will look something like what is shown below.Ĭircuit diagram of DC motor speed control using arduino is shown in the figure below. The duty cycle of this wave form will be (387/(387+613))*100 which is equal to 38.7%. The result will be a square wave with high time = 387 uS and low time = 613 uS and the time period will be always 1000uS. Then digital pin will be switched on for t1 uS and switched off for t2 uS and the cycle is repeated. Then t2 is subtracted from 1000 and the result which is 387 is stored in variable t1 (high time). This 613 will be saved to variable t2 (low time). Since the analog input voltage here is 3 volts the digital reading will be 3/(5/1023) which is equal to 613. analogRead function in arduino reads the voltage (between 0 to 5V) at the analog input pin,converts it in to a digital value between and stores it in a variable. Since the slider terminal is connected to A0 pin, the voltage at A0 pin will be also 3V. Suppose the slider of the potentiometer is adjusted so that the voltage at its slider is 3V. The following example helps you to understand the stuff better. T1= 1000-t2 // subtracts t2 from 1000 ans saves the result in t1ĭigitalWrite(pwm, HIGH) // sets pin 12 HIGHĭelayMicroseconds(t1) // waits for t1 uS (high time)ĭigitalWrite(pwm, LOW) // sets pin 12 LOWĭelayMicroseconds(t2) // waits for t2 uS (low time) T2= analogRead(pot) // reads the voltage at A0 and saves in t2 PinMode(pot, INPUT) // declares pin A0 as input PinMode(pwm, OUTPUT) // declares pin 12 as output Int pot = A0 // assigns analog input A0 to variable pot int pwm = 12 // assigns pin 12 to variable pwm The step-by-step working is noted in the program below. Necessary calculations are done using this reading and the duty cycle is adjusted according to it. Arduino reads the voltage at the analog input pin A0 (slider of the POT). The working of the program is very simple. The LED is connected at digital pin 12 of the arduino. In the circuit, the slider of the 50K potentiometer is connected to analog input pin A0 of the arduino. Here the brightness of an LED can be controlled using a potentiometer. This one could be the simplest example of PWM control using arduino. Controlling the LED brightness using arduino and motor speed control using arduino. In the above wave forms you can see that the frequency is same but ON time and OFF time are different.Two applications of PWM control using arduino is shown here. PWM waves with various duty cycle are shown in the figure below. The PWM controller accepts the control signal and adjusts the duty cycle of the PWM signal according to the requirements. The control signal contains information on how much power has to be applied to the load. It might be an analog or digital signal according to the design of the PWM controller. The block diagram of a typical PWM power controller scheme is shown below.Ĭontrol signal is what we give to the PWM controller as the input. Where T ON is the time for which the square wave is high and T OFF is the time for which the square wave is low.When duty cycle is increased the power dropped across the load increases and when duty cycle is reduced, power across the load decreases. Duty cycle is usually stated in percentage and it can be expressed using the equation : % Duty cycle = (T ON/(T ON + T OFF)) *100. The duty cycle of this square wave is varied in order to vary the power supplied to the load. PWM signal is essentially a high frequency square wave ( typically greater than 1KHz). This method is very easy to implement and has high efficiency. PWM control is a very commonly used method for controlling the power across loads. We have explained PWM in this tutorial using 2 examples which will help you learn how to control LED brightness using PWM and how to control DC motor speed using PWM. If you are new to electronics, we have a detailed article explaining pulse width modulation. In this article we explain how to do PWM (Pulse Width Modulation) control using arduino.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |