Shop OBEX P1 Docs P2 Docs Learn Events
Simple LED question — Parallax Forums

Simple LED question

TCTC Posts: 1,019
edited 2014-05-03 19:35 in General Discussion
Hello all,

I just want to confirm what I am figuring out. Could someone please tell me if I am right or not?

I have a dual color (green/red) 2 pin LED that I do not have the specs for. Currently I have a 33Ω resister on each leg of the LED, and each resister is going to 1 I/O pin on the prop(using 2 prop I/O pins). And the red die is brighter than the green die. Mark_T suggested using 2 "1N4148" diodes, placed in opposite directions with A resister for one of the two colors. From what I am understanding from the datasheet of the diodes, there is about a 1V drop (depending what company I would pick) across the diode.

Normally I would use R = ( Vs - Vf ) / I to find the required resister. But now I would have another part in series with the led and resister.

I was thinking I would have to change the formula to account for the diode. R = ( Vs - Vf of diode - Vf of led) / I

And if I am right, and using the max values I could find for a led like what I have. Green would be 2.2V@20mA, and red would be 2.1V@20mA. I should need resister values of;

( 3.3V - 1V - 2.2V ) / 20mA = 5Ω for the green die
( 3.3V - 1V - 2.1V ) / 20mA = 10Ω for the red die

Am I correct on my calculations?

Thanks
TC

Comments

  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 05:27
    I'd get a dual LED with separate leads(or two LED's) and separate resisters and tune the brightness to what looks naturally balanced.
  • TCTC Posts: 1,019
    edited 2014-05-02 05:31
    T Chap wrote: »
    I'd get a dual LED with separate leads(or two LED's) and separate resisters and tune the brightness to what looks naturally balanced.

    I can't. I replaced a incandescent light bulb inside of a SPDT button. I want to make the button show green for go, and show red for stop. There is only two contacts inside of the button.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 05:58
    Well, I can't wait to see this gadget working. Please post some vids. You can always pipe the light in if you have a hole to get a fiber into it.
  • TCTC Posts: 1,019
    edited 2014-05-02 06:42
    T Chap wrote: »
    Well, I can't wait to see this gadget working. Please post some vids. You can always pipe the light in if you have a hole to get a fiber into it.

    I thought of using fiber, but, except for the cover that covers the LED(light bulb) the button is sealed. I do not know where the contacts are at.

    And for a couple videos I have already. The flicker you see is not from the display, but it is my camera.

    This video is my first proof of concept of a reflow profile. The values on the display are fake, and just there to get an idea of location.

    This video is one idea(proof of concept) I made for the menu of my reflow oven. I was using an encoder to go between options, and using the encoder push to select/change options.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 06:54
    Very cool stuff! Way OT but have you determined if your cool down will be sufficiently fast without external air or opening the door( manually or solonoid)?
  • TCTC Posts: 1,019
    edited 2014-05-02 07:20
    T Chap wrote: »
    Very cool stuff! Way OT but have you determined if your cool down will be sufficiently fast without external air or opening the door( manually or solonoid)?

    Thank you. I wanted this oven to push me for hardware and programming.

    Right now (still prototyping) I know the cool down is to slow. I wanted to add a servo that would hold the door open based on how fast/slow the oven is cooling down. But I gave up the idea (for now) when I could not figure out the best way to protect the servo from the heat. I might still do it later on. I have accounted for the servo for later use. power suppy, wire, etc...

    But for now I am just going to prop the door open when it hits the cool down cycle.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 08:18
    Well the servo can be remotely attached with linkage.
  • RDL2004RDL2004 Posts: 2,554
    edited 2014-05-02 08:36
    Instead of just toggling the pins on and off, could you just pwm the LEDs with the Propeller to control the brightness?
  • TCTC Posts: 1,019
    edited 2014-05-02 09:45
    T Chap wrote: »
    Well the servo can be remotely attached with linkage.


    It would have to be, But I dont want the servo outside of the oven case. I am trying to keep stuff covered as much as I can. Just a personal want, that's all.

    RDL2004 wrote: »
    Instead of just toggling the pins on and off, could you just pwm the LEDs with the Propeller to control the brightness?

    I might do that later on, right now I want to keep it simple. I have a lot on my plate, and right now I don't want to add something as trivial as PWMing LED's, when I have harder problems I have to figure out.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 10:04
    Sounds good. But can you do us a favor, when and if you do try to run a servo inside the oven, can you please get that on video and share it?
  • RDL2004RDL2004 Posts: 2,554
    edited 2014-05-02 10:23
    I might do that later on, right now I want to keep it simple. I have a lot on my plate, and right now I don't want to add something as trivial as PWMing LED's, when I have harder problems I have to figure out.

    That's understandable. I guess you won't be worrying about a little difference in brightness of the LEDs right now then, eh? :)
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-05-02 10:52
    I'm late to the discussion, so you probably know this.

    With a 2-lead bi-color LED, the only thing you can do to balance the brightness is to use PWM. The reason, of course, is the you have a simple series circuit and whether you use one resistor or two, both will affect each LED. It comes down to the voltage drop. If you switch to a 3-lead LED, then you can balance with resistors; this happens because you have separate current paths.
  • TCTC Posts: 1,019
    edited 2014-05-02 11:39
    T Chap wrote: »
    Sounds good. But can you do us a favor, when and if you do try to run a servo inside the oven, can you please get that on video and share it?

    I defiantly will. I can promise you that.

    RDL2004 wrote: »
    That's understandable. I guess you won't be worrying about a little difference in brightness of the LEDs right now then, eh? :)

    Nope, not right now. It just annoys me where the red is insanely bright, and the green is half the brightness of the red. I would say this and the other post about the LED is only because I have issues, and something like a LED that is not where it should be bugs the boogers out of me. :lol:

    JonnyMac wrote: »
    I'm late to the discussion, so you probably know this.

    With a 2-lead bi-color LED, the only thing you can do to balance the brightness is to use PWM. The reason, of course, is the you have a simple series circuit and whether you use one resistor or two, both will affect each LED. It comes down to the voltage drop. If you switch to a 3-lead LED, then you can balance with resistors; this happens because you have separate current paths.

    Like I said in post #3 that the LED is replacing A incandescent light bulb in A button like this (just older). And I only have 2 connections to work with.

    Chance's are, I will be going with PWM later on. I just want to get it working better than it is right now.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-02 11:47
    You only need two connections on the Prop. Set one color that is too bright with PWM on one pin, the other to LOW. Then for the LED that is not too bright, turn on the other pin fully. No problem.



    Pin1 Use a counter in some duty mode drives RED LED
    Pin2 LOW


    Pin1 LOW
    Pin2 HIGH drives green

    PUB  REDon(brightness) |  f       ' some value brightness between 0 and 4billion(or 2.2b?)
         Dira[LEDa]~~   'red
         outa[LEDa]~
         Dira[LEDb]~~   'green
         outa[LEDb]~   'low
         ctra := %00110  << 26 +  LEDa
        
         repeat
           frqa :=   brightness
    
    PUB  GRNon
         ctra~
         Dira[LEDa]~~   'red
         outa[LEDa]~
         Dira[LEDb]~~   'green
         outa[LEDb]~~      'high
    
    

    Or something to this effect
  • TCTC Posts: 1,019
    edited 2014-05-02 12:21
    T Chap wrote: »
    You only need two connections on the Prop. Set one color that is too bright with PWM on one pin, the other to LOW. Then for the LED that is not too bright, turn on the other pin fully. No problem.



    Pin1 Use a counter in some duty mode drives RED LED
    Pin2 LOW


    Pin1 LOW
    Pin2 HIGH drives green

    PUB  REDon(brightness) |  f       ' some value brightness between 0 and 4billion(or 2.2b?)
         Dira[LEDa]~~   'red
         outa[LEDa]~
         Dira[LEDb]~~   'green
         outa[LEDb]~   'low
         ctra := %00110  << 26 +  LEDa
        
         repeat
           frqa :=   brightness
    
    PUB  GRNon
         ctra~
         Dira[LEDa]~~   'red
         outa[LEDa]~
         Dira[LEDb]~~   'green
         outa[LEDb]~~      'high
    
    

    Or something to this effect


    I currently have an object similar to that. Just no PWM.

    This is from my memory since I am not at my home computer.
    PUB start(_pin1, _pin2)
    
       pin1 := _pin1
       pin2 := _pin2
    
       dira[pin1] := 1
       dira[pin2] := 1
    
    PUB off
    
       outa[pin1] := 0
       outa[pin2] := 0
    
    PUB red
    
       outa[pin1] := 1
       outa[pin2] := 0
    
    PUB green
    
       outa[pin1] := 0
       outa[pin2] := 1
    
    

    Then in my main program, I would have
    OBJ
    
       LED : "led_driver"
    
    

    That way I can put in my code
       LED.red     ' to turn on the red led
       LED.green ' to turn on the green led
       LED.off      ' to turn off the LED
    
    


    See, simple. until I take care of the more important things.
  • MrBi11MrBi11 Posts: 117
    edited 2014-05-03 16:07
    BiLED.JPG



    R1 controls one color, R2 controls other
    Make Pin1 high and Pin2 Low for one color
    Make Pin1 Low and Pin2 High for other

    (sorry doesn't show a bi color LED)
    752 x 422 - 23K
  • TCTC Posts: 1,019
    edited 2014-05-03 19:35
    MrBi11 wrote: »
    BiLED.JPG



    R1 controls one color, R2 controls other
    Make Pin1 high and Pin2 Low for one color
    Make Pin1 Low and Pin2 High for other

    (sorry doesn't show a bi color LED)

    I did that exact idea earlier today. I was not happy with the outcome, so I went with what everyone has been suggesting. I went with a PWM object.
Sign In or Register to comment.