Mechatronics Lab – PWM speed control of a dc motor, adjustable by a numeric keypad



here's an example pic microcontroller project where a numeric keypad is being used to set the speed for a pulse width modulation driver for a small DC motor only three keys are being used on the keypad the one key the four key and the asterisk and the functions they serve are to increase or decrease the speed of the motor and to start the motor turning at that speed by attaching the rows and column of the keypad through a network of resistors in a series capacitor we can use the pic basic pro-pot to command to read the effective resistance of the keypad at any moment and that allows us to determine which key is being held down the motor is a permanent magnet DC motor rated at 1.5 to 3 volts it's powered by the same supply as the pic so it's 5 volts but it's powered with a pulse width modulation signal that has a duty cycle and to increase the speed the pulse representing the on time is made larger than the remainder of the pulse where the Miller is off so by changing the duty cycle or the percentage of time the motorists pulse on you can alter the speed of the motor here's a close-up of the electronics we have the pic microcontroller in the centre motor is controlled by a mosfet power transistor and is controlled by the pulse width modulation signal coming out of the pic microcontroller the microcontroller also controls these four LEDs the green LED is the least significant bit and the three Reds are higher order bits these bits provide a visual display of the current speed setting which can vary from 0 to 15 because we have 4 bits finally there is a switch that is used to stop motor motion and allow the user to readjust the speed here is the project in action first the power supply is turned on as you can see the pic assumes a medium speed in this case 7 because we have 1 + 2 + 4 so that's a medium speed in the 0 to 15 range the user can increase or decrease that speed with these buttons if I decrease down to the lower speed and press the Enter key the motor is turning at a fairly low speed right now again it's controlled by pulse width modulation signal I can stop at any time with the button input I can now increases be a little bit by pressing the one key and when I hit enter the motor turn to the slightly faster speed I can stop it again increase the speed further this is a medium speed you can see the motor is turning much faster and finally we can increase it much more to a larger speed and again the motors turning even faster

2 Comments

  1. Abdulmajeed a said:

    where is the digram .?

    June 28, 2019
    Reply
  2. Claudiu B. said:

    why didn`t you activated all keys?, so when you press a key, the pwm value will be set at the value you introduce by the keypad

    June 28, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *