Shop OBEX P1 Docs P2 Docs Learn Events
PWM issue with LED — Parallax Forums

PWM issue with LED

SiriSiri Posts: 220
edited 2009-11-22 21:34 in Propeller 1
I am trying to use PWM to drive a 5V LED.
The LED is connected as shown in the circuit diagram-[noparse][[/noparse]Attached] and also the spin code is also attached.

The the LED works as it is intended but the problem is when the USB cable is disconnected the LED brightness is only about 50%. - when USB cable is
re-connected the LED glows brighter.

The voltage accross the LED is ---> 4.87V when USB is connected
----> 2.1V when USB is disconnected.

Can someone explain this issue.

Thanks ,

Siri

Post Edited (Siri) : 11/21/2009 11:41:14 PM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-11-21 23:01
    Siri,

    Your schematic link is not working.

    -Phil
  • SiriSiri Posts: 220
    edited 2009-11-21 23:35
    Phil,

    I uploaded it again.

    Thanks

    Siri
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-11-22 00:03
    It would seem your usual power supply cannot provide the current that the led is drawing. Is it suitably current limited?

    With the LED removed or turned off does the supply return to 5v?

    Graham
  • SiriSiri Posts: 220
    edited 2009-11-22 01:15
    Graham,

    The power supply is rated at 5V dc @ 4 Amps

    The voltage across the power at the point of entry to the board is always 5.1v.

    Yes - when the LED is removed and USB disconnected the power where the LED was connected is 5.0v. and when the LED re-inserted the power drops to 2.0v.

    Siri
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-22 03:16
    You need a resistor in series with the LED (between LED cathode and NPN collector.)· Try 470ohms.
  • SiriSiri Posts: 220
    edited 2009-11-22 04:48
    Allen,

    The LED I am using is a 5V one - you think I still need a resistor.

    If so - please explain it to me.

    Thanks.

    Siri
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-11-22 07:41
    Do have the specs of the LED ?

    how much is current maximum ? If it is a more or less standard-LED it has 20mA.
    As the voltage drops down to 2V I'm pretty sure it is NOT a 5V LED, then the voltage would stay at 5V when connected

    Can you post a typ-Nr or are buy-number ?

    best regards

    Stefan
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-11-22 10:48
    Siri,

    You say it is a 5v LED, does this mean it includes a current limiting resistor or constant current circuit built in?

    Another quick test, put the LED straight across the supply and see what your voltage and current is. I can't see why this would have anything to do with your PWM control it seems more likely that a large current is being pulled from the supply and this is causing it to current limit lowering the voltage.

    Another test is to see if the always on brightness changes, make the propeller turn the led on and try with and without USB.

    Graham
  • SiriSiri Posts: 220
    edited 2009-11-22 15:07
    @phil,Draham,Stephan,Allen,

    I resolved the issue.- but needs explanation.

    While I was connecting/disconnecting the USB to the Propeller Education Board - I noticed that I did not really have to totally connect the USB
    but as soon as the casing touched the USB cable - the LED became bright.My conclusion was a bad GROUND. ?? Correct.

    The I proceed to Ground the Propeller Chip's Gnd pin ----> to house AC ground.

    The LED now is bright and the spin program works as intended.

    Why do other programs including the LCD examples and the power indicator LED on the Propeller Education Board function normally without
    this additional ground.

    Thanks,

    Siri
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-11-22 15:26
    Siri,

    During normal operation of your circuit do you have two supplies one for the prop and one for the LED?

    If the ground that the emitter of the transistor is connected to was not also connected with the ground of the prop chip you might have problems because the output voltage of the propeller pin would not be referenced to the same 0v so it might not turn the transistor on fully.

    Because voltage is all about potential differences you need to tie the 0V lines together but you should not need to connect to AC ground.

    Cheers,

    Graham
  • SiriSiri Posts: 220
    edited 2009-11-22 21:34
    Graham,

    Thanks .

    I did exactly what you suggested and now it works well.

    Siri
Sign In or Register to comment.