Go Down

Topic: controlling a super-bright led 3,5 watt (Read 767 times) previous topic - next topic

onesky

do you think this may work?



Code: [Select]
   // Esempio 01: accendi il led appena รจ premuto il pulsante  
     
   #define LED 7                // LED connected to the digital pin 7  
   #define BUTTON 9              // pin input button  
   int  val = 0;                 // status input   pin
     
   void setup() {  
     pinMode(LED, OUTPUT);       //  pin as output  
     pinMode(BUTTON, INPUT);     // pin as input  
   }  
     
   void loop() {  
     val = digitalRead(BUTTON);  // read the pin value and save it
     
     // control that input is HIGH (button pressed)  
     if (val == HIGH) {  
       digitalWrite(LED, HIGH);  // led  turn on
     }  
     else {  
       digitalWrite(LED, LOW);   // led  turn off
     }  
   }  

madworm

If you want to start a fire, then yes.

A few observations:

* The 2N2222 is not good for 1A
* Why is there a 10k resistor in the current return path
* If the LED gets warm (and it will), it's forward voltage will go down --> more current --> gets even warmer ... etc

Constant current LED drivers are the way to go. Either get one on ebay for almost no money or build one (most likely more expensive).
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

onesky

#2
Apr 11, 2012, 04:41 pm Last Edit: Apr 11, 2012, 07:09 pm by onesky Reason: 1

* The 2N2222 is not good for 1A

um.. you are right
this is the specs of the 2N2222T i bought:
Quote

Manufacturer Part No: 2N2222A
ROHS: Yes
Current Rating: 0.8A
Voltage Rated: 40V
Transistor Type: NPN
Features: General Purpose
Package: TO-92


so if i use a resistor that limit the ampere to 0,7A it should be fine.. (altought i will lose a bit of light), or i may just use another transistor model that support 1A (as the 2SC1384)

Quote
* Why is there a 10k resistor in the current return path

i corrected the resistors position

Quote
* If the LED gets warm (and it will), it's forward voltage will go down --> more current --> gets even warmer ... etc

the LED will not be permanently ON, it will be installed on a replica gun to simulate the fire of the shot

i also changed the power supply of the led, now i connected it directly to the arduino 5volt



Nick Gammon

You are running a 3.5W LED through a 2W resistor? I suppose that would be OK for short bursts.
http://www.gammon.com.au/electronics

Go Up