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


debrat.pranay (author)2017-07-31

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.

jessey (author)2016-02-11

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

saarp18 (author)2013-09-02

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

Veda88 (author)2013-08-04

What kind of motor are you using?

jgrecoarroyo (author)Veda882013-08-05

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

pratyadi (author)2013-07-03

A modified Sketch that actually works with HS 422 servo, Gertboard and Raspberry Pi:

You do not need servo.h library

rclear (author)2012-09-10

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

alien200049655 (author)2012-01-09

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

Here is a link to the code:

And here the code itself:

int motor = 9;
int potenciometer = 5;

void setup(){

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
  Serial.println(motor_speed);//for testing purposes

agreco5 (author)2011-12-12

Useful and straight to the point - keep them coming!

jgrecoarroyo (author)agreco52011-12-12

Thanks, they will be more comming for sure :)

About This Instructable




More by jgrecoarroyo:LED experiment: choose correct resistor!EEG - brain computer interfacePWM with Arduino - step by step guide
Add instructable to: