PWM With Arduino - Step by Step Guide

74,142

28

11

Introduction: PWM With Arduino - Step by Step Guide

Small step by step guide on how to use the PWM (Pulse Width Modulation) of the Arduino board. The video includes the components needed and an easy to follow connection guide, as well as a demo of the results obtained. The code is also included. Try it out yourself, enjoy! :D

Be the First to Share

    Recommendations

    • Home and Garden Contest

      Home and Garden Contest
    • Woodworking Contest

      Woodworking Contest
    • Origami Speed Challenge

      Origami Speed Challenge

    11 Comments

    0
    debrat.pranay
    debrat.pranay

    4 years ago

    In this video i will describe how to generate PWM signal from arduino uno that means generate variable output voltage from digital device. Because variable voltage is essential for speed control of dc motor and angular position control of servo motor.
    In arduino six pin 3,5,6,9,10,11 used for pwm. PWM means analog signal in digital form. https://youtu.be/82SfYWhw6fA

    0
    jessey
    jessey

    6 years ago

    Hi, anyone know what type or value the pot is for this?

    0
    saarp18
    saarp18

    8 years ago on Introduction

    What about doing it with Synapse modules rf engines?
    Have you heard about them?

    0
    jgrecoarroyo
    jgrecoarroyo

    Reply 8 years ago on Introduction

    The motor used in the example is just a cheap regular DC motor. The kind of you can find in "science kits" for kids.

    0
    pratyadi
    pratyadi

    8 years ago on Introduction

    A modified Sketch that actually works with HS 422 servo, Gertboard and Raspberry Pi:
    http://www.linuxcircle.com/?p=640

    You do not need servo.h library

    0
    rclear
    rclear

    9 years ago on Introduction

    Very nice elaboration.
    Will you specify what transistor you were using?

    0
    alien200049655

    The code is a bit difficult to read in the video, could you please post it on your instructable?

    0
    jgrecoarroyo
    jgrecoarroyo

    Reply 10 years ago on Introduction

    Here is a link to the code: https://docs.google.com/document/d/1sVM4R4C8etX_34tTUtQkLbK3lBE_LEjYgY0WJMRuDi0/edit?pli=1

    And here the code itself:

    int motor = 9;
    int potenciometer = 5;

    void setup(){
      pinMode(9,OUTPUT);
      pinMode(5,INPUT);

      Serial.begin(9600);
    }

    void loop(){
      int value = analogRead(potenciometer);
                         //read input value: range between (0,1023)
      int motor_speed = value/4;
                        //PWM can only ouput 255 different values

      analogWrite(motor,motor_speed);

      Serial.println(motor_speed);//for testing purposes
    }

    0
    agreco5
    agreco5

    10 years ago on Introduction

    Useful and straight to the point - keep them coming!