Electronics- Pulse Width Modulation Sensorsdenethor.wlu.ca/pc320/lectures/pwmbeam.pdf · Terry...

Post on 19-Apr-2020

42 views 1 download

Transcript of Electronics- Pulse Width Modulation Sensorsdenethor.wlu.ca/pc320/lectures/pwmbeam.pdf · Terry...

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

ElectronicsPulse Width Modulation Sensors

Terry Sturtevant

Wilfrid Laurier University

February 1, 2018

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Pulse Width Modulation Sensors

Analog information can be communicated over digital signalsThis can be done by varying the width or spacing of digitalpulsesThis is called Pulse Width Modulation, PWMThis document gives a few examples.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Pulse Width Modulation Sensors

Analog information can be communicated over digital signals

This can be done by varying the width or spacing of digitalpulsesThis is called Pulse Width Modulation, PWMThis document gives a few examples.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Pulse Width Modulation Sensors

Analog information can be communicated over digital signalsThis can be done by varying the width or spacing of digitalpulses

This is called Pulse Width Modulation, PWMThis document gives a few examples.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Pulse Width Modulation Sensors

Analog information can be communicated over digital signalsThis can be done by varying the width or spacing of digitalpulsesThis is called Pulse Width Modulation, PWM

This document gives a few examples.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Pulse Width Modulation Sensors

Analog information can be communicated over digital signalsThis can be done by varying the width or spacing of digitalpulsesThis is called Pulse Width Modulation, PWMThis document gives a few examples.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensingdoesn’t use PWMIncremental rotary encodinguses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensing

doesn’t use PWMIncremental rotary encodinguses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensingdoesn’t use PWM

Incremental rotary encodinguses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensingdoesn’t use PWMIncremental rotary encoding

uses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensingdoesn’t use PWMIncremental rotary encodinguses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoders

Absolute position sensingdoesn’t use PWMIncremental rotary encodinguses PWM

As long as you know the initial position, you can update if you cansense changes.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder wheelTwo sensors will allow determination of rotation speed andangle

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder wheel

Two sensors will allow determination of rotation speed andangle

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder wheelTwo sensors will allow determination of rotation speed andangle

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Counter-clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Counter-clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Counter-clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

AB

Counter-clockwise

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing11

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing01

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing01

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing01

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing00

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing00

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing10

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing10

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing10

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Shaft encoder timing11

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Speed of rotation from frequency of either channel

Angle of rotation from combination

Here’s an example from an actual motor.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Speed of rotation from frequency of either channelAngle of rotation from combination

Here’s an example from an actual motor.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Speed of rotation from frequency of either channelAngle of rotation from combination

Here’s an example from an actual motor.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

00

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

10

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

11

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

01

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

00

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

01

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

11

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

10

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

One direction

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Other direction

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 5 divisions

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

�� ��Period is 5 divisionsTime scale is 500µS per division

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 5 divisions → 2500µS = 2.5mSTime scale is 500µS per division

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 5 divisions → 2500µS = 2.5mS30 slots per revolution × 2.5mS

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 2.5mS30 slots per revolution × 2.5mS → 75ms per revolution

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 2.5mS × 30 → 75ms per revolution75/1000 seconds per revolution → 13.33 rev./second

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Period is 2.5mS × 30 → 75ms per revolution75/1000 seconds per revolution → 13.33 rev./second× 60 → 800 RPM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Ultrasonic sensors

Transmitter sends out pulseReceiver registers echo

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Ultrasonic sensors

Transmitter sends out pulse

Receiver registers echo

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Ultrasonic sensors

Transmitter sends out pulseReceiver registers echo

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

transmit

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmit

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmit

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmit

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmitreceive

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmitreceive

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmitreceive

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

-

transmitreceive

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Time from beginning of transmit to beginning of receiveallows distance to be calculated

since 2d = vtwhere v is the speed of sound

Why is it 2d?

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Time from beginning of transmit to beginning of receiveallows distance to be calculatedsince 2d = vtwhere v is the speed of sound

Why is it 2d?

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

Time from beginning of transmit to beginning of receiveallows distance to be calculatedsince 2d = vtwhere v is the speed of sound

Why is it 2d?

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

V to F and F to V converters

V to F converters take in an analog voltage and produce astring of digital pulses where the frequency is proportional tothe input analog voltageF to V converters take in a string of digital pulses andproduce an analog voltage where the analog voltage isproportional to the input frequency

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

V to F and F to V converters

V to F converters take in an analog voltage and produce astring of digital pulses where the frequency is proportional tothe input analog voltage

F to V converters take in a string of digital pulses andproduce an analog voltage where the analog voltage isproportional to the input frequency

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Shaft encodersUltrasonic sensorsV to F and F to V converters

V to F and F to V converters

V to F converters take in an analog voltage and produce astring of digital pulses where the frequency is proportional tothe input analog voltageF to V converters take in a string of digital pulses andproduce an analog voltage where the analog voltage isproportional to the input frequency

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequencyp.start(dc)start at given duty cycle (percent)p.ChangeFrequency(freq)change frequencyp.ChangeDutyCycle(dc)change duty cycle (percent)p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequency

p.start(dc)start at given duty cycle (percent)p.ChangeFrequency(freq)change frequencyp.ChangeDutyCycle(dc)change duty cycle (percent)p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequencyp.start(dc)start at given duty cycle (percent)

p.ChangeFrequency(freq)change frequencyp.ChangeDutyCycle(dc)change duty cycle (percent)p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequencyp.start(dc)start at given duty cycle (percent)p.ChangeFrequency(freq)change frequency

p.ChangeDutyCycle(dc)change duty cycle (percent)p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequencyp.start(dc)start at given duty cycle (percent)p.ChangeFrequency(freq)change frequencyp.ChangeDutyCycle(dc)change duty cycle (percent)

p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM Control

p = GPIO.PWM(channel, frequency)open channel at given frequencyp.start(dc)start at given duty cycle (percent)p.ChangeFrequency(freq)change frequencyp.ChangeDutyCycle(dc)change duty cycle (percent)p.stop()stop PWM

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM sample code

impor t t imeimpor t RPi . GPIO as GPIOGPIO . setmode (GPIO .BOARD)GPIO . s e tup (12 , GPIO .OUT)p = GPIO .PWM(12 , 50) # chan=12 f r e q =50Hzp . s t a r t (0 )t r y :

w h i l e 1 :f o r dc i n range (0 , 101 , 5 ) :

p . ChangeDutyCycle ( dc )t ime . s l e e p ( 0 . 1 )

excep t K e y b o a r d I n t e r r u p t :pa s s

p . s top ( )GPIO . c l eanup ( )

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Python PWM sample codeimpor t t imeimpor t RPi . GPIO as GPIOGPIO . setmode (GPIO .BOARD)GPIO . s e tup (12 , GPIO .OUT)p = GPIO .PWM(12 , 50) # chan=12 f r e q =50Hzp . s t a r t (0 )t r y :

w h i l e 1 :f o r dc i n range (0 , 101 , 5 ) :

p . ChangeDutyCycle ( dc )t ime . s l e e p ( 0 . 1 )

excep t K e y b o a r d I n t e r r u p t :pa s s

p . s top ( )GPIO . c l eanup ( )

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.

Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.

(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)

PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.

i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.

PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.

i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors

Pulse Width Modulation SensorsRaspberry Pi Python PWM Control

Raspberry Pi PWM pins

The Raspberry Pi has 2 built-in PWM channels.Each channel has 2 associated pins.(So only one pin can be used at a time.)PWM0 uses (BOARD) 12 and 32.i.e. (BCM) GPIO18 and (BCM) GPIO12.PWM1 uses (BOARD) 33 and 35.i.e. (BCM) GPIO13 and (BCM) GPIO19.

Note: These pins are shared with the audio subsystem.

Terry Sturtevant Electronics Pulse Width Modulation Sensors