Go Down

Topic: arduino can't control LED powered with external power supply (Read 240 times) previous topic - next topic

botan22

Hi
I'm totally new in arduino.
I used external 12v power source to power up my led.

digitalWrite(0) >> its ok and led on !(100% of brightness)
digitalWrite(1) >> the problem is here and led only dimming(50% of brightness) and wont turn off.

in another word my LED never turns off !

why micro can't turn off the led with digitalwrite(1) ?
also I used high value resistor but it didn't help.



LED => 3v 25mA max
Resistor => (12-3)/0.020 = 450 ohm

so whats the problem ?

noiasca

the "schematic" doesn't show the GND connection of your 12V source.
DE: Wie man Fragen postet:
1. was hat man (Sketch und Hardware)
2. was SOLL es machen
3. was macht es: IST (Fehlverhalten, Fehlermeldungen, Serial.Output ...)
4. Eine Frage stellen bzw. erklären was man erwartet

botan22


Paul__B

in another word my LED never turns off !
because the Arduino can never raise the I/O pin higher than its supply voltage - which is of course, 5 V.

So if you write it HIGH, the output will go to 5 V, and you will still have 7 V across the LED and resistor.

If however, you put three white or four other LEDs in series with the resistor, they will (probably) not turn on at 7 V and you can control them from the I/O pin.

As long as the Arduino never loses power while there is any voltage on the 12 V supply.

Grumpy_Mike

Also when you manage to turn off that LED you will be placing 12V across the GPIO pin, which should kill it.

Your updated diagram shows no common ground between your 12V supply and your Arduino. You need one.

You need to drive this LED with a transistor to be safe.

botan22

because the Arduino can never raise the I/O pin higher than its supply voltage - which is of course, 5 V.

So if you write it HIGH, the output will go to 5 V, and you will still have 7 V across the LED and resistor.

If however, you put three white or four other LEDs in series with the resistor, they will (probably) not turn on at 7 V and you can control them from the I/O pin.

As long as the Arduino never loses power while there is any voltage on the 12 V supply.
thank you.

I thought (digitalWrite(1)) will cut the ground and led goes off.

is there any way to fix it ? (without switching or relay)

Paul__B

is there any way to fix it ? (without switching or relay)
I gave you one, otherwise as Mike says.

Go Up