• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Need circuit help? Post them in the comments! I've answered over 50,000!

Blog | Categories | About | Contact | Calculators-online
You are here: Home / Arduino Projects / Arduino PWM Signal Generator Circuit

DIY Circuits | Learn Basics | Arduino Coding




Arduino PWM Signal Generator Circuit

Last Updated on January 26, 2026 by Swagatam Leave a Comment

In this post we elaborately study how to make an Arduino based PWM signal generator circuit, which can be set or adjusted with a potentiometer or a pot to any preferred duty cycle ratio.

WHAT IS PWM?

pwm or pulse width modulation as the name itself suggest is  modulation of width of the pulses  i.e. how long the pulse is high or low in a given time period. This changes duty cycle of the pulse which eventually determines the average value of pulse as duty cycle is on time divided by total time period.

And frequency plays very important role in pwm, which must be high enough to generate stable output

Pwm is done for variety of purposes like driving a device that works on low voltage or for switching purposes like in SMPS.

PWM USING ARDUINO UNO

Pwm is also one of the factors that make arduino a simplest development board, as pwm can be done by adding just one line code to your program. Note that there are separate digital pins available on arduino UNO for pwm which means these pins can give pwm output.

There are total 6 pwm pins available on arduino UNO that are 3, 5, 6,9,10 and11 out of 14 digital pins. Note that number of pwm pins vary from one type of arduino board to another.

Now there are two ways in which pwm can be performed by arduino:

1. By directly assigning an analog value to the pwm pin between 0 and 255.

Since digital pins in arduino can provide maximum of 5v that means 0 analog value is equal to 0 volts and 255 is equivalent to 5 volts.

And to perform this you have to just add this code to your program:

analogWrite( PWM pin no, value between 0 to 255);

For example:   analogWrite(10,64);// write 64 analog value to pwm pin no 10.

Now this means:: (5/255)*64 volts=  1.25volts i.e. 25% duty cycle.

2. By assigning value according to the input received from analog pins of arduino.
Input can be taken from components like an IR sensor or a potentiometer.

Note that arduino receive analog input in terms of  value between 0 to 1023 which is equivalent to 0 to 5 volts.  So to perform pwm on a pin you must convert this input value in equivalence to number between 0 to 255 and this is called mapping in arduino’s language.

There is a simple code for this:

y= map(x,0,1023:0,255);// where x is the input variable

After this you can perform pwm on a pin using:

analogWrite(PWM pin no,y);// write received mapped value to pin 10

PWM EXAMPLE:

We are going to learn both the technique with this example. For this you need:

1. A potentiometer
2. Two  leds
3. Two 100 ohm resistors

Make connections as shown in circuit diagram:

CIRCUIT DIAGRAM:

CODE:

int x;   // Variable to store ADC value from potentiometer
int y;   // Variable to store mapped PWM value

void setup()
{
  pinMode(10, OUTPUT);   // PWM output pin (Case 2)
  pinMode(9, OUTPUT);    // PWM output pin (Case 1)
  pinMode(A0, INPUT);    // Potentiometer input
}

void loop()
{
  // Case 1: Fixed PWM output
  analogWrite(9, 125);

  // Read potentiometer value (0 to 1023)
  x = analogRead(A0);

  // Map ADC value to PWM range (0 to 255)
  y = map(x, 0, 1023, 0, 255);

  // Case 2: PWM output controlled by potentiometer
  analogWrite(10, y);
}

How it Works

The basic working of the proposed Arduino PWM signal generator project can be studied from the following paragraph

Pin no 9 can be assigned arbitrary pwm value whereas pin no. 10 gives pwm value in accordance to the position of the potentiometer with respect to ground. Keep changing this arbitrary value for pin 9 as well as rotate potentiometer to see different pwm output on both pins.

You'll also like:

  • gsm car central lock circuitGSM Car Ignition and Central Lock Circuit Using Arduino
  • Receiver12312 2Wireless Servo Motor Control Using 2.4 GHz communication link
  • P 20160419 235234Digital Clock Circuit Using 16×2 LCD Display
  • LCD connxArduino Automatic School/College Bell System

Filed Under: Arduino Projects Tagged With: Arduino, Generator, PWM, Signal

About Swagatam

I am an electronics engineer and doing practical hands-on work from more than 15 years now. Building real circuits, testing them and also making PCB layouts by myself. I really love doing all these things like inventing something new, designing electronics and also helping other people like hobby guys who want to make their own cool circuits at home.

And that is the main reason why I started this website homemade-circuits.com, to share different types of circuit ideas..

If you are having any kind of doubt or question related to circuits then just write down your question in the comment box below, I am like always checking, so I guarantee I will reply you for sure!

Previous Post: « High Current Motor Control Circuit using Arduino
Next Post: 2.4 GHz 10 Channel Remote Control Switch Circuit »

Reader Interactions

Need Help? Please Leave a Comment! We value your input—Kindly keep it relevant to the above topic! Cancel reply

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

Primary Sidebar

circuit simulator image



Subscribe to get New Circuits in your Email



Categories

  • Arduino Projects (95)
  • Audio and Amplifier Projects (133)
  • Automation Projects (18)
  • Automobile Electronics (103)
  • Battery Charger Circuits (87)
  • Datasheets and Components (109)
  • Electronics Theory (149)
  • Energy from Magnets (27)
  • Games and Sports Projects (11)
  • Grid and 3-Phase (20)
  • Health related Projects (27)
  • Home Electrical Circuits (13)
  • Indicator Circuits (16)
  • Inverter Circuits (95)
  • Lamps and Lights (159)
  • Meters and Testers (71)
  • Mini Projects (28)
  • Motor Controller (68)
  • Oscillator Circuits (28)
  • Pets and Pests (15)
  • Power Supply Circuits (91)
  • Remote Control Circuits (50)
  • Renewable Energy (12)
  • Security and Alarm (64)
  • Sensors and Detectors (106)
  • SMPS and Converters (34)
  • Solar Controller Circuits (60)
  • Temperature Controllers (43)
  • Timer and Delay Relay (49)
  • Voltage Control and Protection (42)
  • Water Controller (37)
  • Wireless Circuits (31)





Other Links

  • Privacy Policy
  • Cookie Policy
  • Disclaimer
  • Copyright
  • Videos
  • Sitemap



People also Search

555 Circuits | 741 Circuits | LM324 Circuits | LM338 Circuits | 4017 Circuits | Ultrasonic Projects | SMPS Projects | Christmas Projects | MOSFETs | Radio Circuits | Laser Circuits | PIR Projects |

Social Profiles

  • Twitter
  • YouTube
  • Instagram
  • Pinterest
  • My Facebook-Page
  • Stack Exchange
  • Linkedin



Recent Comments

  • Swagatam on How to Manufacture Automobile Electronic Parts and Earn a Handsome Income
  • Swagatam on Door Security Alarm Circuit for Alerting if Door was Opened
  • Swagatam on High Wattage Brushless Motor Controller Circuit
  • Swagatam on Arduino 2-Step Programmable Timer Circuit
  • Duff on Door Security Alarm Circuit for Alerting if Door was Opened

© 2026 · Swagatam Innovations