I am new to the site as well as this will be my first project with an arduino. My wife and I agreed to do a christmas tree that will be auctioned off after a show. We have decided to do a thin blue line tree. Basically our tree will be dedicated to all of the Law Enforcement Officers that have been killed in the line of duty.
I would like to do red and blue lights that wig wag like what is on a police cruiser. I know I can accomplish this with an arduino but not really know what I will need to get it to work. I did find this website that gives a simple code for the lights.
What country are you in?
The 'wig-wag' varies from country to country. Here, in the UK, they are only blue, no reds.
How many lights are you planning on using?
And last, but not least, I hope that the proceeds of the auction will go to a police charity to benefit the bereaved.
if you have two strings of lights, you could turn them on and off alternately.
just use an SSR.
it was brought to my attention lately that the e-bay ones are fakes and have chips that are a fraction of the nameplate rating. just seems silly that anyone would bother to make an enclosure, graphics, assemble a circuit, then use one under-rated chip to save money.
but, check your full load amps of each total set of lights. then get an SSR that is capable of 4 times that amount.
for the program, I think you can copy blink-without-delay
if you want, you could
add a switch to make it fade up and down
and add a pot to slow it down
add a couple switches to change things, like all blue or all white, or a 30 second fade....
// pin assignments
const int led_RED = 5; // the number of the LED pin
const int led_BLUE = 6;
// Global variables that will change :
int ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won't change :
const long interval = 1000; // interval at which to blink (milliseconds)
void setup() {
// set the digital pin as output:
pinMode(led_RED, OUTPUT);
pinMode(led_BLUE, OUTPUT);
}
void loop()
{
if(millis() - previousMillis >= interval) {
previousMillis = millis();
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(led_RED, ledState);
digitalWrite(led_BLUE, !ledState)
}
}
The more I think about it, the more I would fade between colors. I personally hate the sharp on/off of LEDs compared to the fade of both fluorescents and incandescents.
of course you would need a relay for each color. typically an SSR. as a mechanical relay will make a noticeable clicking sound.
put all that into a case, bring out the power to the wall,
have two plugs for the two strings of LED lights
have a switch or button to set the pattern.
inside should be a power supply. 120VAC to 5V, like a phone charger.for power if it has the USB port connector.
if you want to use an UNO, you have an option of using a 9volt wall wart with a round (barrel) plug to fit in the Arduino UNO power port.
dave-in-nj:
if you have two strings of lights, you could turn them on and off alternately.
just use an SSR.
I'm not in the US, so my idea may not look right. If I remember correctly, on US police cars, the red lights are not on at the same time as the blue lights. So my thoughts on this was to use an H-bridge.
Connect the blue LEDs in reverse parallel to the red LEDs. That way, there would only be one pair of wires for all the LEDs.
A cheap H-bridge IC will control 750mA at 12V. Wire LEDs in series, 6 reds in one direction and 6 blues in the other, made to look like the lighting bar on top of a police car. You'd have blue, blue, blue, resistor, blue, blue, blue and red, red, red, resistor, red, red, red. Connect the two rows in reverse parallel at each end. I've included two resistors, as the different coloured LEDs may require different values.
There could then be about 30 'bars', depending on the current drawn by the LEDs. Fading would be simple, too.
I think that the OP needs to offer more information.
I assumed he would just buy a string of blue LED's and a string of red LED's and then power each from an extension cord that was controlled by the Arduino.
if you wanted a more custom look, you could arrange blue LED's and red LED's and then power them with lower voltage and use resistors to match the brightness.
AWOL:
Pardon my ignorance, but what is "wig wag" ?
Apparently, it's the way that USian police car lights flash. Nothing like our UK 'blues and twos'.
Either that, or it's a moving hairpiece (the gerbil is still alive?).
Henry_Best:
Apparently, it's the way that USian police car lights flash. Nothing like our UK 'blues and twos'.
Either that, or it's a moving hairpiece (the gerbil is still alive?).
some of the patrol cars on youtube do the same thing.
looks like UK police cars do two flashes left, then two flashes right
the only difference, is that the UK cars use only blue lights
the US does red on the right, blue on the left, with the right/left being your point of view if you are driving the patrol car.or looking in the mirror.