SlideShare a Scribd company logo
1 of 13
www.techvilla.org.in
TECHVILLA
www.techvilla.org.in
www.techvilla.org.in
Interfacing rgb led with raspberry-pi
 RGB leds.
 Brief theory of pulse width modulation.
 Write a code in python to glow rgb led.
www.techvilla.org.in
RGB Leds
 RED-GREEN-BLUE Light Emitting Diode.
www.techvilla.org.in
Types of rgb led
www.techvilla.org.in
Pulse Width Modulation
 Pulse-width modulation (PWM), or pulse-duration modulation
(PDM), is a commonly used technique for controlling power to
inertial electrical devices, made practical by modern
electronic power switches.
 The PWM switching frequency has to be much faster than
what would affect the load, which is to say the device that
uses the power.
 The main advantage of PWM is that power loss in the
switching devices is very low.
 PWM has also been used in certain communication systems
where its duty cycle has been used to convey information
over a communications channel.
www.techvilla.org.in
Types of PWM
 Three types of pulse-width modulation (PWM) are
possible:
 The pulse center may be fixed in the center of the time
window and both edges of the pulse moved to
compress or expand the width.
 The lead edge can be held at the lead edge of the
window and the tail edge modulated.
 The tail edge can be fixed and the lead edge
modulated.
Principle
 Pulse-width modulation uses a rectangular
pulse wave whose pulse width is
modulated resulting in the variation of the
average value of the waveform.
 The simplest way to generate a PWM signal
is the intersective method, which requires
only a sawtooth or a triangle waveform
(easily generated using a simple oscillator)
and a comparator
 When the value of the reference signal (the
red sine wave in figure 2) is more than the
modulation waveform (blue), the PWM
signal (magenta) is in the high state,
otherwise it is in the low state.
Applications
www.techvilla.org.in
Telecommunications
 In telecommunications, the widths of the pulses correspond to
specific data values encoded at one end and decoded at the
other.
 Pulses of various lengths (the information itself) will be sent at regular
intervals (the carrier frequency of the modulation).
 The inclusion of a clock signal is not necessary, as the leading edge
of the data signal can be used as the clock if a small offset is added
to the data value in order to avoid a data value with a zero length
pulse.
www.techvilla.org.in
Power delivery
 PWM can be used to control the amount of power
delivered to a load without incurring the losses that
would result from linear power delivery by resistive
means.
 Potential drawbacks to this technique are the pulsations
defined by the duty cycle, switching frequency and
properties of the load.
 With a sufficiently high switching frequency and, when
necessary, using additional passive electronic filters, the
pulse train can be smoothed and average analog
waveform recovered.
www.techvilla.org.in
Audio effects and amplification
 PWM is sometimes used in sound (music) synthesis, in particular
subtractive synthesis, as it gives a sound effect similar to
chorus or slightly detuned oscillators played together.
 he ratio between the high and low level is typically
modulated with a low frequency oscillator, or LFO.
 In addition, varying the duty cycle of a pulse waveform in a
subtractive-synthesis instrument creates useful timbral
variations.
www.techvilla.org.in
Wiring rgb with gpio pins.
www.techvilla.org.in
code
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(21, GPIO.OUT) #set pin 21 to output
p = GPIO.PWM(21,50) #set the PWM on pin 21 to 50%
p.start(0)
try:
while True:
for i in range (100):
p.ChangeDutyCycle(i)
time.sleep(0.02) #These last three lines are going to loop and increase the power from 1% to
100% gradually
for i in range(100):
p.ChangeDutyCycle(100-i)
time.sleep(0.02) #These three lines loop and decrease the power from 100%-1% gradually
except KeyboardInterrupt:
pass
p.stop()

More Related Content

What's hot

Communications
CommunicationsCommunications
CommunicationsWaqas !!!!
 
Communication Engineering- Unit 1
Communication Engineering- Unit 1Communication Engineering- Unit 1
Communication Engineering- Unit 1RemyaRoseS
 
Communication system 1 chapter 3 - am-power
Communication system 1 chapter 3 - am-powerCommunication system 1 chapter 3 - am-power
Communication system 1 chapter 3 - am-powerBetelihemMesfin1
 
pulse modulation
pulse modulation pulse modulation
pulse modulation Herin Gala
 
Umts interview questions and answers
Umts interview questions and answersUmts interview questions and answers
Umts interview questions and answersIwasanmi Daniel
 
Introduction to communication systems
Introduction to communication systemsIntroduction to communication systems
Introduction to communication systemsMohsen Sarakbi
 
White paper on Why Power Line Communication is the best fit for AMI In india
White paper on Why Power Line Communication is the best fit for AMI In indiaWhite paper on Why Power Line Communication is the best fit for AMI In india
White paper on Why Power Line Communication is the best fit for AMI In indiaSameer Patil
 
Ec8395 ce by www.learn engineering.in
Ec8395 ce by www.learn engineering.inEc8395 ce by www.learn engineering.in
Ec8395 ce by www.learn engineering.inKarpoora Sundari
 
Digital communication viva questions
Digital communication viva questionsDigital communication viva questions
Digital communication viva questionsishan0019
 
Ece interview questions with answers
Ece interview questions with answersEce interview questions with answers
Ece interview questions with answersmanish katara
 
Digital Communication 1
Digital Communication 1Digital Communication 1
Digital Communication 1admercano101
 
multi standard multi-band receivers for wireless applications
multi standard  multi-band receivers for wireless applicationsmulti standard  multi-band receivers for wireless applications
multi standard multi-band receivers for wireless applicationsHossam Hassan
 
Subsampling Multi-standard receiver design, Part-1
Subsampling Multi-standard receiver design, Part-1Subsampling Multi-standard receiver design, Part-1
Subsampling Multi-standard receiver design, Part-1Ahmed Sakr
 
Introduction to communication system lecture2
Introduction to communication system lecture2Introduction to communication system lecture2
Introduction to communication system lecture2Jumaan Ally Mohamed
 
Introduction to Communication Systems 3
Introduction to Communication Systems 3Introduction to Communication Systems 3
Introduction to Communication Systems 3slmnsvn
 
Traffic wireless(eee499.blogspot.com)
Traffic wireless(eee499.blogspot.com)Traffic wireless(eee499.blogspot.com)
Traffic wireless(eee499.blogspot.com)slmnsvn
 
Wireless tv audio transmitter
Wireless tv audio transmitterWireless tv audio transmitter
Wireless tv audio transmitterVikram Shankar
 

What's hot (20)

Communications
CommunicationsCommunications
Communications
 
Communication Engineering- Unit 1
Communication Engineering- Unit 1Communication Engineering- Unit 1
Communication Engineering- Unit 1
 
PAM
PAMPAM
PAM
 
Communication system 1 chapter 3 - am-power
Communication system 1 chapter 3 - am-powerCommunication system 1 chapter 3 - am-power
Communication system 1 chapter 3 - am-power
 
pulse modulation
pulse modulation pulse modulation
pulse modulation
 
Lecture6 modulation
Lecture6 modulationLecture6 modulation
Lecture6 modulation
 
Umts interview questions and answers
Umts interview questions and answersUmts interview questions and answers
Umts interview questions and answers
 
Introduction to communication systems
Introduction to communication systemsIntroduction to communication systems
Introduction to communication systems
 
White paper on Why Power Line Communication is the best fit for AMI In india
White paper on Why Power Line Communication is the best fit for AMI In indiaWhite paper on Why Power Line Communication is the best fit for AMI In india
White paper on Why Power Line Communication is the best fit for AMI In india
 
Ec8395 ce by www.learn engineering.in
Ec8395 ce by www.learn engineering.inEc8395 ce by www.learn engineering.in
Ec8395 ce by www.learn engineering.in
 
Digital communication viva questions
Digital communication viva questionsDigital communication viva questions
Digital communication viva questions
 
Ece interview questions with answers
Ece interview questions with answersEce interview questions with answers
Ece interview questions with answers
 
Digital Communication 1
Digital Communication 1Digital Communication 1
Digital Communication 1
 
multi standard multi-band receivers for wireless applications
multi standard  multi-band receivers for wireless applicationsmulti standard  multi-band receivers for wireless applications
multi standard multi-band receivers for wireless applications
 
Subsampling Multi-standard receiver design, Part-1
Subsampling Multi-standard receiver design, Part-1Subsampling Multi-standard receiver design, Part-1
Subsampling Multi-standard receiver design, Part-1
 
Introduction to communication system lecture2
Introduction to communication system lecture2Introduction to communication system lecture2
Introduction to communication system lecture2
 
Introduction to Communication Systems 3
Introduction to Communication Systems 3Introduction to Communication Systems 3
Introduction to Communication Systems 3
 
Traffic wireless(eee499.blogspot.com)
Traffic wireless(eee499.blogspot.com)Traffic wireless(eee499.blogspot.com)
Traffic wireless(eee499.blogspot.com)
 
Wireless tv audio transmitter
Wireless tv audio transmitterWireless tv audio transmitter
Wireless tv audio transmitter
 
Modulation Techniques for Mobile Radio
Modulation Techniques for Mobile RadioModulation Techniques for Mobile Radio
Modulation Techniques for Mobile Radio
 

Similar to Control RGB LED with Raspberry Pi Using PWM

Pulse width modulation (PWM)
Pulse width modulation (PWM)Pulse width modulation (PWM)
Pulse width modulation (PWM)amar pandey
 
Efitra1006
Efitra1006Efitra1006
Efitra1006matavulj
 
Speed control of DC motor using pulse width modulation technique
Speed control of DC motor using pulse width modulation technique Speed control of DC motor using pulse width modulation technique
Speed control of DC motor using pulse width modulation technique Imanul Mazarbhuiya
 
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...IJSRD
 
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...IJERA Editor
 
Iisrt z pranoti kumbhare
Iisrt z pranoti kumbhareIisrt z pranoti kumbhare
Iisrt z pranoti kumbhareIISRT
 
pulse width modulated inverter techniques
pulse width modulated inverter techniquespulse width modulated inverter techniques
pulse width modulated inverter techniquesSAURABH KUMAR
 
analog communication system for undergraduate .pdf
analog communication  system for undergraduate .pdfanalog communication  system for undergraduate .pdf
analog communication system for undergraduate .pdfAlaAwouda
 
iaetsd Software defined am transmitter using vhdl
iaetsd Software defined am transmitter using vhdliaetsd Software defined am transmitter using vhdl
iaetsd Software defined am transmitter using vhdlIaetsd Iaetsd
 

Similar to Control RGB LED with Raspberry Pi Using PWM (20)

Pulse width modulation
Pulse width modulationPulse width modulation
Pulse width modulation
 
A pwm modulator
A pwm modulatorA pwm modulator
A pwm modulator
 
Pulse width modulation (PWM)
Pulse width modulation (PWM)Pulse width modulation (PWM)
Pulse width modulation (PWM)
 
Pwm ppm no1
Pwm ppm no1Pwm ppm no1
Pwm ppm no1
 
Efitra1006
Efitra1006Efitra1006
Efitra1006
 
Speed control of DC motor using pulse width modulation technique
Speed control of DC motor using pulse width modulation technique Speed control of DC motor using pulse width modulation technique
Speed control of DC motor using pulse width modulation technique
 
077 c211
077 c211077 c211
077 c211
 
pwm.pptx
pwm.pptxpwm.pptx
pwm.pptx
 
T044069296
T044069296T044069296
T044069296
 
About Sine Pulse Width Modulation
About Sine Pulse Width Modulation About Sine Pulse Width Modulation
About Sine Pulse Width Modulation
 
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...
Field Programmable Gate Array (FPGA) - Based Pulse Width Modulation for Singl...
 
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...
Design of Low Power & High Speed Comparator with 0.18μm Technology for ADC Ap...
 
Iisrt z pranoti kumbhare
Iisrt z pranoti kumbhareIisrt z pranoti kumbhare
Iisrt z pranoti kumbhare
 
pulse width modulated inverter techniques
pulse width modulated inverter techniquespulse width modulated inverter techniques
pulse width modulated inverter techniques
 
SIGNAL_CONVERSION.docx
SIGNAL_CONVERSION.docxSIGNAL_CONVERSION.docx
SIGNAL_CONVERSION.docx
 
ARRHYTHMIA.pptx
ARRHYTHMIA.pptxARRHYTHMIA.pptx
ARRHYTHMIA.pptx
 
Pulse Shaping FIR Filter for WCDMA
Pulse Shaping FIR Filter for WCDMAPulse Shaping FIR Filter for WCDMA
Pulse Shaping FIR Filter for WCDMA
 
analog communication system for undergraduate .pdf
analog communication  system for undergraduate .pdfanalog communication  system for undergraduate .pdf
analog communication system for undergraduate .pdf
 
En34855860
En34855860En34855860
En34855860
 
iaetsd Software defined am transmitter using vhdl
iaetsd Software defined am transmitter using vhdliaetsd Software defined am transmitter using vhdl
iaetsd Software defined am transmitter using vhdl
 

More from Techvilla

Raspberry pi Part 26
Raspberry pi Part 26Raspberry pi Part 26
Raspberry pi Part 26Techvilla
 
Raspberry pi Part 25
Raspberry pi Part 25Raspberry pi Part 25
Raspberry pi Part 25Techvilla
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24Techvilla
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23Techvilla
 
Raspberry pi Part 22
Raspberry pi Part 22Raspberry pi Part 22
Raspberry pi Part 22Techvilla
 
Raspberry pi Part 21
Raspberry pi Part 21Raspberry pi Part 21
Raspberry pi Part 21Techvilla
 
Raspberry pi Part 20
Raspberry pi Part 20Raspberry pi Part 20
Raspberry pi Part 20Techvilla
 
Raspberry pi Part 19
Raspberry pi Part 19Raspberry pi Part 19
Raspberry pi Part 19Techvilla
 
Raspberry pi Part 18
Raspberry pi Part 18Raspberry pi Part 18
Raspberry pi Part 18Techvilla
 
Raspberry pi Part 17
Raspberry pi Part 17Raspberry pi Part 17
Raspberry pi Part 17Techvilla
 
Rasperry pi Part 15
Rasperry pi Part 15Rasperry pi Part 15
Rasperry pi Part 15Techvilla
 
Rasperry pi Part 13
Rasperry pi Part 13Rasperry pi Part 13
Rasperry pi Part 13Techvilla
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12Techvilla
 
Rasperry pi Part 10
Rasperry pi Part 10Rasperry pi Part 10
Rasperry pi Part 10Techvilla
 
Rasperry pi Part 9
Rasperry pi Part 9Rasperry pi Part 9
Rasperry pi Part 9Techvilla
 
Rasperry pi Part 8
Rasperry pi Part 8Rasperry pi Part 8
Rasperry pi Part 8Techvilla
 
Rasperry pi Part 7
Rasperry pi Part 7Rasperry pi Part 7
Rasperry pi Part 7Techvilla
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6Techvilla
 
Raspberry pi Part 5
Raspberry pi Part 5Raspberry pi Part 5
Raspberry pi Part 5Techvilla
 
Raspberry pi Part 4
Raspberry pi Part 4Raspberry pi Part 4
Raspberry pi Part 4Techvilla
 

More from Techvilla (20)

Raspberry pi Part 26
Raspberry pi Part 26Raspberry pi Part 26
Raspberry pi Part 26
 
Raspberry pi Part 25
Raspberry pi Part 25Raspberry pi Part 25
Raspberry pi Part 25
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23
 
Raspberry pi Part 22
Raspberry pi Part 22Raspberry pi Part 22
Raspberry pi Part 22
 
Raspberry pi Part 21
Raspberry pi Part 21Raspberry pi Part 21
Raspberry pi Part 21
 
Raspberry pi Part 20
Raspberry pi Part 20Raspberry pi Part 20
Raspberry pi Part 20
 
Raspberry pi Part 19
Raspberry pi Part 19Raspberry pi Part 19
Raspberry pi Part 19
 
Raspberry pi Part 18
Raspberry pi Part 18Raspberry pi Part 18
Raspberry pi Part 18
 
Raspberry pi Part 17
Raspberry pi Part 17Raspberry pi Part 17
Raspberry pi Part 17
 
Rasperry pi Part 15
Rasperry pi Part 15Rasperry pi Part 15
Rasperry pi Part 15
 
Rasperry pi Part 13
Rasperry pi Part 13Rasperry pi Part 13
Rasperry pi Part 13
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12
 
Rasperry pi Part 10
Rasperry pi Part 10Rasperry pi Part 10
Rasperry pi Part 10
 
Rasperry pi Part 9
Rasperry pi Part 9Rasperry pi Part 9
Rasperry pi Part 9
 
Rasperry pi Part 8
Rasperry pi Part 8Rasperry pi Part 8
Rasperry pi Part 8
 
Rasperry pi Part 7
Rasperry pi Part 7Rasperry pi Part 7
Rasperry pi Part 7
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6
 
Raspberry pi Part 5
Raspberry pi Part 5Raspberry pi Part 5
Raspberry pi Part 5
 
Raspberry pi Part 4
Raspberry pi Part 4Raspberry pi Part 4
Raspberry pi Part 4
 

Recently uploaded

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 

Control RGB LED with Raspberry Pi Using PWM

  • 2. www.techvilla.org.in Interfacing rgb led with raspberry-pi  RGB leds.  Brief theory of pulse width modulation.  Write a code in python to glow rgb led.
  • 5. www.techvilla.org.in Pulse Width Modulation  Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a commonly used technique for controlling power to inertial electrical devices, made practical by modern electronic power switches.  The PWM switching frequency has to be much faster than what would affect the load, which is to say the device that uses the power.  The main advantage of PWM is that power loss in the switching devices is very low.  PWM has also been used in certain communication systems where its duty cycle has been used to convey information over a communications channel.
  • 6. www.techvilla.org.in Types of PWM  Three types of pulse-width modulation (PWM) are possible:  The pulse center may be fixed in the center of the time window and both edges of the pulse moved to compress or expand the width.  The lead edge can be held at the lead edge of the window and the tail edge modulated.  The tail edge can be fixed and the lead edge modulated.
  • 7. Principle  Pulse-width modulation uses a rectangular pulse wave whose pulse width is modulated resulting in the variation of the average value of the waveform.  The simplest way to generate a PWM signal is the intersective method, which requires only a sawtooth or a triangle waveform (easily generated using a simple oscillator) and a comparator  When the value of the reference signal (the red sine wave in figure 2) is more than the modulation waveform (blue), the PWM signal (magenta) is in the high state, otherwise it is in the low state.
  • 9. www.techvilla.org.in Telecommunications  In telecommunications, the widths of the pulses correspond to specific data values encoded at one end and decoded at the other.  Pulses of various lengths (the information itself) will be sent at regular intervals (the carrier frequency of the modulation).  The inclusion of a clock signal is not necessary, as the leading edge of the data signal can be used as the clock if a small offset is added to the data value in order to avoid a data value with a zero length pulse.
  • 10. www.techvilla.org.in Power delivery  PWM can be used to control the amount of power delivered to a load without incurring the losses that would result from linear power delivery by resistive means.  Potential drawbacks to this technique are the pulsations defined by the duty cycle, switching frequency and properties of the load.  With a sufficiently high switching frequency and, when necessary, using additional passive electronic filters, the pulse train can be smoothed and average analog waveform recovered.
  • 11. www.techvilla.org.in Audio effects and amplification  PWM is sometimes used in sound (music) synthesis, in particular subtractive synthesis, as it gives a sound effect similar to chorus or slightly detuned oscillators played together.  he ratio between the high and low level is typically modulated with a low frequency oscillator, or LFO.  In addition, varying the duty cycle of a pulse waveform in a subtractive-synthesis instrument creates useful timbral variations.
  • 13. www.techvilla.org.in code import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(21, GPIO.OUT) #set pin 21 to output p = GPIO.PWM(21,50) #set the PWM on pin 21 to 50% p.start(0) try: while True: for i in range (100): p.ChangeDutyCycle(i) time.sleep(0.02) #These last three lines are going to loop and increase the power from 1% to 100% gradually for i in range(100): p.ChangeDutyCycle(100-i) time.sleep(0.02) #These three lines loop and decrease the power from 100%-1% gradually except KeyboardInterrupt: pass p.stop()