I am building a police light set up (wait wait, I know, but this is only for my self for demo purposes and to use for offroad use). This will be a simple set up:
2 pods in the back window: each has 12 blue leds (two rows of 6) and 12 red leds (2 rows of 6)
4 pods in the grill each consisting of 4 leds: two blue and two red pods
Totaling 64 leds. I will be using 3mm piranha leds from superbrightleds.
So far I have built one pod ( 24 leds) on a breadboard where each pin connects to two leds (I figured that's at most what it can handle from each pin as its rated up to 40ma)
At this point I am not sure how to proceed to connect the rest 40 leds and make them work together. I have a mega which will easily accommodate this, but don't want to waste it. Or I can build another clone using atmega 328 to use for the other pod(s).
should I use Charlieplexing? Is this the easiest way to accomplish my task? That way I can use just one board?
This will be connected to the car. I have searched topics on connecting it to the car and have gotten a few diff ways to do it.
Therefore I am wondering, if I tap into the radio or perhaps some other source will it be enough to power my 64 leds?
What is the easiest and safest way to connect my clone or uno/mega to my car to have it work?
Just realized that i can use one pin for one color in each pod. BECAUSE i will not be running individual patterns on the leds but rather a bunch at a same time doing the same thing (blink blue , blink red, blink blink blue, blink blink red)
Do i need some kind of led driver for this? i understand that i can basically make this set up work with 2 pins?
pin 12 = all blue (total 32 leds)
pin 11 = all red leds (total 32)
That's pretty straightforward.
Arrange your LEDs in strings of 8 LEDs connected in series with a current limit resistor, 4 strings per color.
Each string will require <=20 mA from a 16-20V source. Wire the 4 strings in parallel.
Obtain a DC upconverter from pololu.com such as this Pololu Adjustable Boost Regulator 4-25V
to convert the car's 12-14V up to the 20V or as needed for your particular LEDs.
Then a single NPN or MOSFET transistor such as IRF3707Z can be driven by the arduino to turn each LED collection on & off.
Here's an example of 4 strings of LEDs wired in parallel, driven by a 12V source. The transistor that drives them is elsewhere (and is in fact in this case a 7406 IC, a hex driver that is good for higher currents (40mA) and up to 30V outputs).
If you're really driving at 20mA, then just hook up 2 strings per output pin.
Just a point, I wouldn't wire two LEDs in parallel as they won't share current equally. You need a resistor in the cathode of each LED, then you can wire the LED / resistor combination in parallel.
Sharing current - is that really more of a concern where LEDs with different characteristics are used? I have 8 digits with 7 segments each made of 3 parallel LEDs & decimal points made of 2 parallel LEDs being driven by a MAX7221, multiplexing at 800 Hz (not user changeable). Some digits use Red LEDs, some digits use yellow LEDs, some digits use Orange LEDs. I have been testing with this setup for a while, letting it run for hours at a time, and I am not seeing any visual difference in intensity anywhere.
I also have some really bright (10,000)mCD capable white LEDs paired up in parallel, driven by a 7406, that are not turned on anyhwere nearly as often as the digits, that seem to be doing okay.
I'll have to break open a couple of lines and stick a really low value resister in, measure the voltage across it on a scope and see what current they're actually running at.
i made a diagram of what i understand it to be. However i tried searching for the IRF3707Z or 7406 ic but to no avail. Please point me in the right direction. is it also availbale from pololu? so i can order everything at once? I tried radioshack and the like and none have IRF3707Z.
Your schematic is not quite correct.
Make sure to connect up like I have shown - 20V is the top of LEDs in series, finish with the resister going to the Drain pin of the MOSFET, with the Source pin to ground. With this MOSFET you are opening & closing the circuit on the Ground side, and not on the high voltage side.
Connect the Arduino pin to the gate thru a 1K resistor, with a 10K to ground.
You are oh so close! Just needed to show the 2nd driver:
sketch would be simple - I didn't compile this, just writing from scratch, should be pretty close
// define pins used
byte red = 11;
byte blue = 12;
byte on_off_pin = 10;
byte button_state = 1;
void setup(){
// define how the pins are used
pinMode (red, OUTPUT);
pinMode (blue, OUTPUT);
pinMode (on_off_pin, INPUT);
digitalWrite (red, LOW);
digitalWrite (blue, LOW);
digitalWrite (on_off, HIGH); // turns on internal pullup resister
}
void loop()
button_state = digitalRead (on_off_pin);
if (button_state == 1){ //button normally open, 1 - lights are off)
// do nothing
}
if (button_state == 0){ // button is closed, input is low
digitalWrite (red, HIGH); // turn on red lights
delay (500); // on for 1/2 second
digitalWrite (red, LOW); // red lights off
delay (100); // gives a chance adjust?
digitalWrite (blue, HIGH); // turn on lblue lights
delay (500); // on for 1/2 second
digitalWrite (blue, LOW); // blue lights off
delay (100); // gives a chance adjust?
} // end of read button state
} // end of void loop
Sorry Roman, was out of the house tonight.
What Mosfet do you have?
PSMN035?
Middle pin is the drain where the resistors meet up.
The riight hand pin is the Source, which goes to 9V-/ground.
Sounds like you have them swapped.
You are running the sketch I drafted? If so pin 10 is an input with an internal pullup resistor.
You can fake it being a switch by connecting/disconnecting to ground.
Disconnected, it is 'open' and the LEDs shouldbe off.
Connected to ground, it is 'closed' and the LEDs should blink on & off.
BTW an important detail, dont forget a fuse to battery!
If your fuse block dont have a spare you can use an old style cop car black plastic fuse holder about the size of a deck of cards, made for under-hood installation, mounts with a single screw and a snap on weather cover / insulated lid. These fuse holders show up in the flea market or tail gate section of your local ham radio rally, usually for just a buck or two. They are resistant to weather, oil, heat, UV and are darn near unbreakable. Just unsnap the lid hose it down with WD-40, let it set a few hours then run it thru the dishwasher it will come out clean as new.