LED not blinking when using a transistorLED Cube lighting wrong LEDs randomlyArduino continually resets when...

Are polynomials with the same roots identical?

LED not blinking when using a transistor

Electricity free spaceship

Amplitude of a crest and trough in a sound wave?

Math cases align being colored as a table

empApi with Lightning Web Components?

What does the pair of vertical lines in empirical entropy formula mean?

Write a function that checks if a string starts with or contains something

The usage of kelvin in formulas

Why are MBA programs closing in the United States?

How can I use the SpendProofV1 to prove I sent Monero to an exchange?

How long is it safe to leave marker on a Chessex battle map?

What would be the way to say "just saying" in German? (Not the literal translation)

Who is "He that flies" in Lord of the Rings?

What would prevent chimeras from reproducing with each other?

Increase speed altering column on large table to NON NULL

Why does this query, missing a FROM clause, not error out?

How to write a convincing religious myth?

Why does smartdiagram replace the Greek letter xi by a number?

Why does a file move/copy function only move one file at a time when using the “*” wildcard?

What is the best color to differentiate male and female?

Was planting UN flag on Moon ever discussed?

How do free-speech protections in the United States apply in public to corporate misrepresentations?

C++ logging library



LED not blinking when using a transistor


LED Cube lighting wrong LEDs randomlyArduino continually resets when connected to external power supply, but not USBArduino, 74HC595N, magicHow come my transistor doesn't work?Arduino + SIM808 HTTP GET POST headersConfusion over Transistors for a switching circuit with an Arduino Mega 2560Arduino keeps blinking when LED is in highDim a led using a NPN transistorWhat happens when I exceed amp limit on Arduino 5v pin?Arduino LED PWM dimmer starts blinking on low PWM values













2















I want to control an led using a transistor. The led gets it‘s power from an external 5v dc power supply.



For the transistor I use an 1kΩ base resistor. The transistor is a BC547C (npn). The datashet is available here.
The led is red (3mm), draws 20mA of current and needs 2V.



I‘ve got a very simple Arduino sketch and wiring setup:



Code:



#define ledPin 6

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}


Wiring diagram:



wiring diagram



Problem:




  1. The led is not blinking but shining at full power constantly.

  2. Disconnecting ledPin 6 from the Arduino (to mimic digitalWrite(ledPin, LOW)) still lets the led shine, just not as bright. The LED should be off in that case, not just dimmed to 50% brightness.


What I tried so far:




  1. I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.

  2. I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting pin 6.

  3. I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.

  4. Connecting the led directly to the Arduino without the transistor and external power supply let’s the led blink exactly how it was defined in code.


Any ideas?
I several-times-checked the wiring in my setup. It should not be the problem.










share|improve this question







New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 4





    You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

    – smajli
    8 hours ago











  • @smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

    – Sim Son
    8 hours ago











  • @WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

    – Sim Son
    8 hours ago











  • @Sim Son I agree, but we have to start somewhere...

    – smajli
    8 hours ago






  • 1





    majenko.co.uk/blog/importance-sharing-grounds

    – Majenko
    5 hours ago
















2















I want to control an led using a transistor. The led gets it‘s power from an external 5v dc power supply.



For the transistor I use an 1kΩ base resistor. The transistor is a BC547C (npn). The datashet is available here.
The led is red (3mm), draws 20mA of current and needs 2V.



I‘ve got a very simple Arduino sketch and wiring setup:



Code:



#define ledPin 6

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}


Wiring diagram:



wiring diagram



Problem:




  1. The led is not blinking but shining at full power constantly.

  2. Disconnecting ledPin 6 from the Arduino (to mimic digitalWrite(ledPin, LOW)) still lets the led shine, just not as bright. The LED should be off in that case, not just dimmed to 50% brightness.


What I tried so far:




  1. I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.

  2. I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting pin 6.

  3. I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.

  4. Connecting the led directly to the Arduino without the transistor and external power supply let’s the led blink exactly how it was defined in code.


Any ideas?
I several-times-checked the wiring in my setup. It should not be the problem.










share|improve this question







New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 4





    You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

    – smajli
    8 hours ago











  • @smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

    – Sim Son
    8 hours ago











  • @WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

    – Sim Son
    8 hours ago











  • @Sim Son I agree, but we have to start somewhere...

    – smajli
    8 hours ago






  • 1





    majenko.co.uk/blog/importance-sharing-grounds

    – Majenko
    5 hours ago














2












2








2


1






I want to control an led using a transistor. The led gets it‘s power from an external 5v dc power supply.



For the transistor I use an 1kΩ base resistor. The transistor is a BC547C (npn). The datashet is available here.
The led is red (3mm), draws 20mA of current and needs 2V.



I‘ve got a very simple Arduino sketch and wiring setup:



Code:



#define ledPin 6

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}


Wiring diagram:



wiring diagram



Problem:




  1. The led is not blinking but shining at full power constantly.

  2. Disconnecting ledPin 6 from the Arduino (to mimic digitalWrite(ledPin, LOW)) still lets the led shine, just not as bright. The LED should be off in that case, not just dimmed to 50% brightness.


What I tried so far:




  1. I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.

  2. I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting pin 6.

  3. I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.

  4. Connecting the led directly to the Arduino without the transistor and external power supply let’s the led blink exactly how it was defined in code.


Any ideas?
I several-times-checked the wiring in my setup. It should not be the problem.










share|improve this question







New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I want to control an led using a transistor. The led gets it‘s power from an external 5v dc power supply.



For the transistor I use an 1kΩ base resistor. The transistor is a BC547C (npn). The datashet is available here.
The led is red (3mm), draws 20mA of current and needs 2V.



I‘ve got a very simple Arduino sketch and wiring setup:



Code:



#define ledPin 6

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}


Wiring diagram:



wiring diagram



Problem:




  1. The led is not blinking but shining at full power constantly.

  2. Disconnecting ledPin 6 from the Arduino (to mimic digitalWrite(ledPin, LOW)) still lets the led shine, just not as bright. The LED should be off in that case, not just dimmed to 50% brightness.


What I tried so far:




  1. I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.

  2. I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting pin 6.

  3. I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.

  4. Connecting the led directly to the Arduino without the transistor and external power supply let’s the led blink exactly how it was defined in code.


Any ideas?
I several-times-checked the wiring in my setup. It should not be the problem.







arduino-uno led transistor






share|improve this question







New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 8 hours ago









WalterBeiterWalterBeiter

1111




1111




New contributor



WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




WalterBeiter is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










  • 4





    You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

    – smajli
    8 hours ago











  • @smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

    – Sim Son
    8 hours ago











  • @WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

    – Sim Son
    8 hours ago











  • @Sim Son I agree, but we have to start somewhere...

    – smajli
    8 hours ago






  • 1





    majenko.co.uk/blog/importance-sharing-grounds

    – Majenko
    5 hours ago














  • 4





    You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

    – smajli
    8 hours ago











  • @smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

    – Sim Son
    8 hours ago











  • @WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

    – Sim Son
    8 hours ago











  • @Sim Son I agree, but we have to start somewhere...

    – smajli
    8 hours ago






  • 1





    majenko.co.uk/blog/importance-sharing-grounds

    – Majenko
    5 hours ago








4




4





You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

– smajli
8 hours ago





You need to provide common ground. Add wire connecting negative '-' connector of your battery with GND in your Arduino.

– smajli
8 hours ago













@smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

– Sim Son
8 hours ago





@smajli that doesn't explain why the led stays on when the base is not connected to the gpio...

– Sim Son
8 hours ago













@WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

– Sim Son
8 hours ago





@WalterBeiter could you post a picture of your setup? Are you sure that you have assigned the correct pins at the BC547? From the info you provided and the troubleshooting you already did I don't see anything that could be wrong.

– Sim Son
8 hours ago













@Sim Son I agree, but we have to start somewhere...

– smajli
8 hours ago





@Sim Son I agree, but we have to start somewhere...

– smajli
8 hours ago




1




1





majenko.co.uk/blog/importance-sharing-grounds

– Majenko
5 hours ago





majenko.co.uk/blog/importance-sharing-grounds

– Majenko
5 hours ago










1 Answer
1






active

oldest

votes


















2














I'm not familiar with that transistor, but leaving a floating (not driven) signal-line means that signal level is unknown (and quite likely, not constant and picking up electrical noise from the environment). You can't assume that the base is at ground in that condition (and without a common ground, "ground" is rather meaningless to talk about anyway). How does the transistor respond to random noise on its base? I'd ignore that behavior, at least for now.



Without a common reference (ground) between the Arduino power supply and the external power-supply, again, you have a floating base, as you can't know what the Arduino's 5v output (or local ground) looks like to the external circuit.



Connect the two grounds. That should correct the LED brightness with respect to the Arduino output pin level. Then, if you need the external circuit to behave in a specific way when the base is disconnected from the Arduino, add a 10K resistor from the transistor base to the external +5 if you want the LED to be on, or to ground, if you want it to be off. Again, I'm guessing at both the pullup/pulldown value (but 10K should be in the ballpark) and the switching sense ('On' or 'Off' for base at +5), but from the expectation state in your point (2.), I think I have it right.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("schematics", function () {
    StackExchange.schematics.init();
    });
    }, "cicuitlab");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "540"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    WalterBeiter is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f66133%2fled-not-blinking-when-using-a-transistor%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I'm not familiar with that transistor, but leaving a floating (not driven) signal-line means that signal level is unknown (and quite likely, not constant and picking up electrical noise from the environment). You can't assume that the base is at ground in that condition (and without a common ground, "ground" is rather meaningless to talk about anyway). How does the transistor respond to random noise on its base? I'd ignore that behavior, at least for now.



    Without a common reference (ground) between the Arduino power supply and the external power-supply, again, you have a floating base, as you can't know what the Arduino's 5v output (or local ground) looks like to the external circuit.



    Connect the two grounds. That should correct the LED brightness with respect to the Arduino output pin level. Then, if you need the external circuit to behave in a specific way when the base is disconnected from the Arduino, add a 10K resistor from the transistor base to the external +5 if you want the LED to be on, or to ground, if you want it to be off. Again, I'm guessing at both the pullup/pulldown value (but 10K should be in the ballpark) and the switching sense ('On' or 'Off' for base at +5), but from the expectation state in your point (2.), I think I have it right.






    share|improve this answer




























      2














      I'm not familiar with that transistor, but leaving a floating (not driven) signal-line means that signal level is unknown (and quite likely, not constant and picking up electrical noise from the environment). You can't assume that the base is at ground in that condition (and without a common ground, "ground" is rather meaningless to talk about anyway). How does the transistor respond to random noise on its base? I'd ignore that behavior, at least for now.



      Without a common reference (ground) between the Arduino power supply and the external power-supply, again, you have a floating base, as you can't know what the Arduino's 5v output (or local ground) looks like to the external circuit.



      Connect the two grounds. That should correct the LED brightness with respect to the Arduino output pin level. Then, if you need the external circuit to behave in a specific way when the base is disconnected from the Arduino, add a 10K resistor from the transistor base to the external +5 if you want the LED to be on, or to ground, if you want it to be off. Again, I'm guessing at both the pullup/pulldown value (but 10K should be in the ballpark) and the switching sense ('On' or 'Off' for base at +5), but from the expectation state in your point (2.), I think I have it right.






      share|improve this answer


























        2












        2








        2







        I'm not familiar with that transistor, but leaving a floating (not driven) signal-line means that signal level is unknown (and quite likely, not constant and picking up electrical noise from the environment). You can't assume that the base is at ground in that condition (and without a common ground, "ground" is rather meaningless to talk about anyway). How does the transistor respond to random noise on its base? I'd ignore that behavior, at least for now.



        Without a common reference (ground) between the Arduino power supply and the external power-supply, again, you have a floating base, as you can't know what the Arduino's 5v output (or local ground) looks like to the external circuit.



        Connect the two grounds. That should correct the LED brightness with respect to the Arduino output pin level. Then, if you need the external circuit to behave in a specific way when the base is disconnected from the Arduino, add a 10K resistor from the transistor base to the external +5 if you want the LED to be on, or to ground, if you want it to be off. Again, I'm guessing at both the pullup/pulldown value (but 10K should be in the ballpark) and the switching sense ('On' or 'Off' for base at +5), but from the expectation state in your point (2.), I think I have it right.






        share|improve this answer













        I'm not familiar with that transistor, but leaving a floating (not driven) signal-line means that signal level is unknown (and quite likely, not constant and picking up electrical noise from the environment). You can't assume that the base is at ground in that condition (and without a common ground, "ground" is rather meaningless to talk about anyway). How does the transistor respond to random noise on its base? I'd ignore that behavior, at least for now.



        Without a common reference (ground) between the Arduino power supply and the external power-supply, again, you have a floating base, as you can't know what the Arduino's 5v output (or local ground) looks like to the external circuit.



        Connect the two grounds. That should correct the LED brightness with respect to the Arduino output pin level. Then, if you need the external circuit to behave in a specific way when the base is disconnected from the Arduino, add a 10K resistor from the transistor base to the external +5 if you want the LED to be on, or to ground, if you want it to be off. Again, I'm guessing at both the pullup/pulldown value (but 10K should be in the ballpark) and the switching sense ('On' or 'Off' for base at +5), but from the expectation state in your point (2.), I think I have it right.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        JRobertJRobert

        10.3k21438




        10.3k21438






















            WalterBeiter is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            WalterBeiter is a new contributor. Be nice, and check out our Code of Conduct.













            WalterBeiter is a new contributor. Be nice, and check out our Code of Conduct.












            WalterBeiter is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Arduino Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f66133%2fled-not-blinking-when-using-a-transistor%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...