PWM based DC Motor speed control using Raspberry Pi

Call for Price

PWM based DC Motor speed control using Raspberry Pi

SKU: PWM based DC Motor speed control using Raspberry Pi Category:

Description

ABSTRACT

Python programming in Raspberry Pi, which you can control the DC Motor speed using PWM on the GPIO Pins. As Raspberry Pi beginners you will learn how to use PWM for the GPIO pins of Raspberry Pi, This project makes you control the DC Motor speed using PWM by increasing and decreasing the speed of the DC motor. This is used to control the speed of the Robotic car, mainly when the car is getting more input supply to operate DC motor, its speed will be at maximum speed rate, to take control over the car speed you can use this project to add short function on Robotic car

HARDWARE REQUIRED

  • Raspberry Pi
  • SD card
  • Power supply
  • VGA to HDMI converter (Optional)
  • DC Motor

 

SOFTWARE REQUIRED

  • Raspbian Stretch OS      
  • SD card Formatter
  • Win32DiskImager (or) Etcher

PYTHON LIBRARIES USED

  • RPi.GPIO as GPIO (To access the GPIO Pins of Raspberry Pi)
  • Time library (For Time delay)

CODE

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(16,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
p=GPIO.PWM(16,100)
while True:
    p.start(20) #Motor will run at slow speed
    GPIO.output(21,True)
    GPIO.output(20,False)
    GPIO.output(16,True)
    time.sleep(3)
    p.ChangeDutyCycle(100) #Motor will run at High speed
    GPIO.output(21,True)
    GPIO.output(20,False)
    GPIO.output(16,True)
    time.sleep(3)
    GPIO.output(16,False)
    p.stop()

Additional information

Weight 0.000000 kg

Reviews

There are no reviews yet.

Be the first to review “PWM based DC Motor speed control using Raspberry Pi”

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.