Pages: [1]   Go Down
Author Topic: controlling a super-bright led 3,5 watt  (Read 746 times)
0 Members and 1 Guest are viewing this topic.
Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 153
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

do you think this may work?



Code:
   // 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
      }  
    }  
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

• 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!

Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 153
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

* 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


« Last Edit: April 11, 2012, 12:09:22 pm by onesky » Logged

Global Moderator
Melbourne, Australia
Offline Offline
Brattain Member
*****
Karma: 511
Posts: 19306
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are running a 3.5W LED through a 2W resistor? I suppose that would be OK for short bursts.
Logged

http://www.gammon.com.au/electronics

Please post technical questions on the forum - not to me by personal message. Thanks a lot.

Pages: [1]   Go Up
Jump to: