Dim an LED using Pulse-Width Modulation with the Raspberry Pi

Поділитися
Вставка
  • Опубліковано 22 жов 2024

КОМЕНТАРІ • 44

  • @jenerps
    @jenerps 8 років тому +6

    Very Good, your explanation is clean.

  • @Vampier
    @Vampier 9 років тому +2

    good explanation, time to start using PWM for visual feedback in some of my applications.
    Thanks for the great video.

  • @osiris1309
    @osiris1309 11 років тому +1

    Brilliantly explained!! Your videos have been greatly helpful. Thanks!

  • @tareqshahriar2587
    @tareqshahriar2587 2 роки тому

    So nice of you, i meant your explanation and illustration

  • @brendoncoetzer6728
    @brendoncoetzer6728 8 років тому

    Great. Thanks for this. Your vids are always easy to follow.

  • @bradgrey3843
    @bradgrey3843 9 років тому +1

    good video. I am looking into getting a Pi to control 10 LED's at different PWM frequencies (10-1500Hz). so each LED will be running at a different Frequency. can this be achieved with the Pi? ( tried using 555 timer oscillators but the frequency is not accurate enough for my application. Cheers

  • @gh0stryt3r
    @gh0stryt3r 8 років тому

    Great info. This will work for my application perfectly. Thanks for sharing!

  • @stijndijkstra3567
    @stijndijkstra3567 8 років тому +2

    so this will work in combination with your RGB LED tutuorial, right?
    but can this also work with LED strips? and could you please do a tutorial on that?

    • @leberkassemmel
      @leberkassemmel 8 років тому

      If you're LED Strip has Infrared control, I would just use that.
      If not, you can use some Transistors to switch the high current for the Strip.

  • @ryansfamily
    @ryansfamily 7 років тому +1

    Thanks. Exactly what I was looking for. Question: What if I wanted to increment (i in range) in "2s or 5s" to speed up fade. How would I go about this? Thanks

  • @fnjyusername
    @fnjyusername 9 років тому

    Hi, have you tried looking at (oscilloscope) the PWM resolution PI can sweep? can it sweep a PWM at divisible of less than 1 micro seconds or say in nano seconds.? IThanks nice video.

  • @FIXDIY
    @FIXDIY 4 роки тому

    Thanks for explaining that

  • @zeurumvr
    @zeurumvr 3 роки тому +1

    Im getting an error with the except keyboardinterrupt thing
    Any help?

  • @calebdrake3544
    @calebdrake3544 5 років тому

    So it is possible to control a group of cree xm-l LEDs using meanwell drivers that utilize PWM to control the brightness?
    How do you set it up so I can have a sunrise/sunset effect on a fish tank?

  • @SammyHerring
    @SammyHerring 9 років тому +1

    Hi,
    Thank you for making the tutorial that seems to be the only one that actually works!
    However, I have noticed that the LED will suddenly change from High to Low, rather than a nice slow transition... any suggestions?
    Many Thanks,
    Sam

  • @easy-stuffs
    @easy-stuffs 8 років тому

    excellent video!!!! explained very well!! thank you

  • @updowndown
    @updowndown  11 років тому

    Yeah, that's the issue with software PWM. If you check out my video on controlling a servo with PWM, you'll see that it behaves erratically when the program is busy.

  • @lampmanjosh
    @lampmanjosh 9 років тому

    Gaven,
    I really like your videos.
    Could you please do a video on Pi-Blaster(PWM)?

  • @beasterG11
    @beasterG11 10 років тому

    Great tutorials for the Pi but i'm having trouble with PWM. my code seems to be in tact, but when when I attempt to run it I get an attribute error on this line:
    p= GPIO.PWM(7, 50)
    The error says:
    AttributeError: 'module' object has no attribute 'PWM'
    I've tried re installing python, and even re flashing the SD card all together, but nothing seems to work. Please help

  • @ThatGuy0102030101
    @ThatGuy0102030101 7 років тому +1

    is there a similar way to do this in c/c++ ??

  • @christophertelford
    @christophertelford 6 років тому

    What are those strange right angle things that I can't find on my keyboard that look a bit like full stops?

  • @technikyou8921
    @technikyou8921 7 років тому

    Hy, great Video can also make a duty Cycle of "7.5%"???

  • @osiris1309
    @osiris1309 11 років тому

    Can I use multiple GPIO pins as PWM pins in order to control multiple LEDs??
    Will it cause any problem?

  • @CrystalDataMusic
    @CrystalDataMusic 5 років тому +8

    My sister has a duty cycle of 50%, since she's high 50% of the time.

  • @MarioHenkel
    @MarioHenkel 10 років тому

    Great video! Thanks for sharing

  • @ElefantenEsser1
    @ElefantenEsser1 11 років тому

    But if you run other programms on the Raspy, and theyre laggin, the PWM is incorrect, right?

  • @updowndown
    @updowndown  11 років тому

    Yep, you can use software PWM on multiple GPIO pins without worry.

    • @Un_Pour_Tous
      @Un_Pour_Tous 4 роки тому

      How whould i stop the dim with a command? like if I want to stop it dimming instead of keybord interupt.

  • @easy-stuffs
    @easy-stuffs 8 років тому

    expecting more videos on NTC thermistor, 555timer, PNP, NPN etc. Thank you..

  • @kubilayozer9613
    @kubilayozer9613 4 роки тому

    How can ı give power as an output just for a predefined time ?

  • @saamyytube8289
    @saamyytube8289 9 років тому

    In the same code, I see the same affect even if the frequency is 100. what is the relation between frequency and duty cycle?

    • @leberkassemmel
      @leberkassemmel 8 років тому

      With higher Frequency the LED doesn't look like it flashes really fast.
      The Duty Cycle defines how long the signal is on. In the end, how bright your LED glows.

  • @derbob6546
    @derbob6546 8 років тому

    This Video is brillant

  • @barryblack1411
    @barryblack1411 7 років тому

    Hi,
    Just tried that and have an error at line 15 the marker is under the 'i'. I have reinserted the 'i' but the error persists. Can someone offer some help please?

  • @rakeshanand2008
    @rakeshanand2008 10 років тому

    Hi Gaven, need help. Shows error.
    Traceback (most recent call last):
    File "dim_led.py", line 9, in
    p = start(0)
    NameError: name 'start' is not defined

    • @derbob6546
      @derbob6546 8 років тому

      Rakesh Anand
      Wont help YOU anymore, but perhaps people who r still watching this
      I t ' s. p.start(0)
      w i t h a d o t

  • @charlescham2024
    @charlescham2024 8 років тому

    i like the vid. thanks. pls upload more. thanks a lot.

  • @SaiboLP
    @SaiboLP 8 років тому

    will it damage the LED (faster)?

  • @moreczbogdan
    @moreczbogdan 9 років тому

    please help, in this code what do i have to modify to light up 2 leds 16+18 let's say
    import RPi.GPIO as GPIO
    import time
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(16, GPIO.OUT)
    p = GPIO.PWM(16, 500)
    p.start(0)
    try:
    while True:
    for i in range(100):
    p.ChangeDutyCycle(i)
    time.sleep(0.03)
    time.sleep(5)
    for i in range(101):
    p.ChangeDutyCycle(100-i)
    time.sleep(0.03)
    time.sleep(5)
    except Keyboardlnterrupt:
    pass
    p.stop()

    • @leberkassemmel
      @leberkassemmel 8 років тому

      You set up the second LED and add it to the For loops?