Results 1 to 6 of 6
  1. #1
    300+ Forum Addict Tom_G_2010's Avatar
    Join Date
    Mar 2011
    Location
    Central Mass
    Posts
    440
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Wiring an LED to 2 output pins ?

    I've come to the point in writing the code for my annunciator panel where I am accounting for the presence of bus voltage. Meaning if the bus voltage drops to low then the annunciator panel won't work at all. So I added another if statement to my low voltage annunciator code. The low voltage alarm comes on at <24 volts and a second if detects if the voltage drops below 18 volts to flag that the panel should not work at all. I may change those values but that's not the point of this thread.

    My first shot at shutting off all the various annunciators was to add an if statement to each annunciators code so that it could not turn on if the above < 18v flag was set. For a variety of reasons this has issues and complexities that I'd like to avoid.

    This morning I started thinking that maybe I could use an electrical solution in combo with the code that might in fact be much simpler if the Arduino can handle it. Can I tie the anode of an LED (with dropping resistor of course) to one output pin, and the cathode to another output pin without damaging the Arduino?

    If the low output for the cathode was seen as ground potential then by doing so I could use the anodes to drive whether the annunciator should be on or off based on various alarm conditions and use the pin tide to the cathode to allow the LED to light (low) or disallow (high) based on bus voltage logic.

    The other question then is electrically how much current could the cathode pin handle as I add 2, 3, 4 annunciators commonned together? I gues worst case I could use an external relay as a ground tie...
    https://www.facebook.com/mycessnasim PC: Intel Core i7 Haswell @ 3.8GHz, 8Gb Ram, Win 7 64Bit, dual SSDs, GeFroce 780 SIM: P3Dv4.1, FSUIPC5, Link2FSMulti, ASN16, Orbix, REX, BFF Force Feedback

  2. #2
    10+ Posting Member
    Join Date
    Dec 2012
    Location
    France
    Posts
    10
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wiring an LED to 2 output pins ?

    Hi, just a loose answer that might help: "Each pin can provide or receive a maximum of 40 mA"

    which means that with one Resistor and two parallel inverse LEDs connected between two i/o pins you can drive the ports both 'high' or 'low' for 'OFF' and differentially to switch either LED on or off, say one is Red and the other is Green.

    Microcontroller ATmega2560
    Operating Voltage 5V
    DC Current per I/O Pin 40 mA

    To answer your question, 40mA divided by LED current, say 5mA gives 8 LEDS on at any one time but don't over do it as the heat has to go somewhere. A neater solution would be to switch a series transistor supplying the common LED current
    from your designated 'power-fail' output.
    Last edited by Didactech; 12-09-2012 at 10:20 AM. Reason: Format

  3. #3
    25+ Posting Member zulucat's Avatar
    Join Date
    Sep 2012
    Location
    Southern SoCal
    Posts
    36
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wiring an LED to 2 output pins ?

    For a variety of reasons this has issues and complexities that I'd like to avoid.
    Perhaps you could explain what the problem is because a software solution seems to be better than adding additional hardware.

    Doug -

  4. #4
    300+ Forum Addict Tom_G_2010's Avatar
    Join Date
    Mar 2011
    Location
    Central Mass
    Posts
    440
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wiring an LED to 2 output pins ?

    Quote Originally Posted by Didactech View Post
    Hi, just a loose answer that might help: "Each pin can provide or receive a maximum of 40 mA"

    which means that with one Resistor and two parallel inverse LEDs connected between two i/o pins you can drive the ports both 'high' or 'low' for 'OFF' and differentially to switch either LED on or off, say one is Red and the other is Green.

    Microcontroller ATmega2560
    Operating Voltage 5V
    DC Current per I/O Pin 40 mA

    To answer your question, 40mA divided by LED current, say 5mA gives 8 LEDS on at any one time but don't over do it as the heat has to go somewhere. A neater solution would be to switch a series transistor supplying the common LED current
    from your designated 'power-fail' output.
    Thanks! I suspect I'll have between 8 and 10 LEDs so I'll either have to use more than one common pin or as you suggest use a transistor, but I believe I have a handful floating around in my project parts so I can experiment with that as well.

    Quote Originally Posted by zulucat View Post
    Perhaps you could explain what the problem is because a software solution seems to be better than adding additional hardware.

    Doug -
    Doug,

    I'll post some code soon, my big challenge all circle around the idea of getting some of the LEDs to blink. If I run them steady state the logic for bus voltage and other variables works fine. As soon as I attempt to get then blinking I run into numerous timing issues that lead to them blinking randomly or not at all. I have attempted using the framework you suggested and a few others with similar results. By going the hardware route the overall code simplifies greatly so I'm hoping that balances the scale with the added hardware complexity.

    As I said, I'll be posting some code soon I have a couple more annunciators to code and then some clean up and commenting to add.
    https://www.facebook.com/mycessnasim PC: Intel Core i7 Haswell @ 3.8GHz, 8Gb Ram, Win 7 64Bit, dual SSDs, GeFroce 780 SIM: P3Dv4.1, FSUIPC5, Link2FSMulti, ASN16, Orbix, REX, BFF Force Feedback

  5. #5
    10+ Posting Member
    Join Date
    Dec 2012
    Location
    France
    Posts
    10
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wiring an LED to 2 output pins ?

    Quote Originally Posted by zulucat View Post
    Perhaps you could explain what the problem is because a software solution seems to be better than adding additional hardware.

    Doug -
    Yes, it was not clear to me what you were trying to do but I answered your question about LED driving though I did not see the point as you could bring out the <18v Flag to switch off a bank of LEDs. You cannot keep loading up the Arduino without overheating the poor little chip.

    You are now suggesting more than 8 and 'blinking' so it is 'growing like Topsy'.

    A matrix drive might be the answer but it depends on the question(s).

  6. #6
    300+ Forum Addict Tom_G_2010's Avatar
    Join Date
    Mar 2011
    Location
    Central Mass
    Posts
    440
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wiring an LED to 2 output pins ?

    Quote Originally Posted by Didactech View Post
    Yes, it was not clear to me what you were trying to do but I answered your question about LED driving though I did not see the point as you could bring out the <18v Flag to switch off a bank of LEDs. You cannot keep loading up the Arduino without overheating the poor little chip.

    You are now suggesting more than 8 and 'blinking' so it is 'growing like Topsy'.

    A matrix drive might be the answer but it depends on the question(s).
    Not to worry. Yes more than 8, but no not commonned to one pin. At least not directly. The final setup will use either a transistor arrangement as you suggest above, or a solid state relay. The common pin will see no more load than a single device.

    The reason I've decided to go this route is that it is electrically simple and simplifies my code quite a bit so from a coding newbie perspective this is a win/win.

    I;m coming down the home stretch on my annunciator code and hope to have it cleaned up tonight after I do the last couple tests. I'll post it after that.
    https://www.facebook.com/mycessnasim PC: Intel Core i7 Haswell @ 3.8GHz, 8Gb Ram, Win 7 64Bit, dual SSDs, GeFroce 780 SIM: P3Dv4.1, FSUIPC5, Link2FSMulti, ASN16, Orbix, REX, BFF Force Feedback