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
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:
Problem:
- The led is not blinking but shining at full power constantly.
- Disconnecting
ledPin 6
from the Arduino (to mimicdigitalWrite(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:
- I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.
- I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting
pin 6
. - I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.
- 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
New contributor
add a comment |
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:
Problem:
- The led is not blinking but shining at full power constantly.
- Disconnecting
ledPin 6
from the Arduino (to mimicdigitalWrite(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:
- I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.
- I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting
pin 6
. - I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.
- 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
New contributor
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
add a comment |
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:
Problem:
- The led is not blinking but shining at full power constantly.
- Disconnecting
ledPin 6
from the Arduino (to mimicdigitalWrite(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:
- I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.
- I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting
pin 6
. - I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.
- 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
New contributor
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:
Problem:
- The led is not blinking but shining at full power constantly.
- Disconnecting
ledPin 6
from the Arduino (to mimicdigitalWrite(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:
- I tried using different base resistors. I tried 2kΩ, 3kΩ, 2.5kΩ, 470Ω, 1.5kΩ. The behavior did not change.
- I tried using different leds. Same behavior. LEDs are shining constantly, not blinking, and are dimmed when disconnecting
pin 6
. - I used another BC547C to see if the first one was broken. It wasn’t. I still got the same behavior.
- 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
arduino-uno led transistor
New contributor
New contributor
New contributor
asked 8 hours ago
WalterBeiterWalterBeiter
1111
1111
New contributor
New contributor
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered 3 hours ago
JRobertJRobert
10.3k21438
10.3k21438
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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