Flashing Hazard LED's

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Flashing Hazard LED's

Post by jasiu »

I wanted to put some type of flashing LED's on a triangular hazard sign, the type you see when a car breaks down. Should I use Neopixels or generic strips? Arduino micro? Can I run it from the auxiliary lighter plug?

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Flashing Hazard LED's

Post by Franklin97355 »

Do you need color changes, color animation, how many leds do you need? You can run it from 12v with the proper voltage regulator. Processor depends on just what you want it to do.

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

Well, the easy answer is, I'm not sure. Let's assume the triangular stand is comprised of three equilateral sides (maybe 12").. Some animation would be nice although I just need to draw attention to her incapacitated car. I would imagine the analog RGB strip would require less "fiddling" to make it work

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Flashing Hazard LED's

Post by Franklin97355 »

This will run from 12v and can change colors but has no animation, the whole strip will be the same color. https://www.adafruit.com/products/285 These will change color and have animation but require 5v so you would need a vlotage converetr https://www.adafruit.com/products/1426 You can also get neopixel strips. Just a heads up, you will need to check the local laws to make sure your colors are legal to display on a vehicle. In some states you can't display red or blue in front or blue at all.

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

You could do some very basic 'animation' using the 12v analog strips: https://www.adafruit.com/products/285
You could control color and/or brightness of each of the 3 sides of the triangle separately. Not real fancy, but the real goal is to attract attention, not mesmerize oncoming drivers.

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

Can I use an Arduino to make the LED strips "blink" SOS?

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

Sure. That would be pretty straightforward.

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

So, this is what I am using to blink SOS on one LED. What type of changes would I need to make to blink SOS on an LED string?

// LED connected to digital pin 10
int ledPin = 10;

// run once, when the sketch starts
void setup()
{
// sets the digital pin as output
pinMode(ledPin, OUTPUT);
}

// run over and over again
void loop()
{
// 3 dits
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(150); // waits for 150ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// 100ms delay to cause slight gap between letters
delay(100);
// 3 dahs
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(400); // waits for 400ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// 100ms delay to cause slight gap between letters
delay(100);

// 3 dits again
for (int x=0; x<3; x++) {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(150); // waits for 150ms
digitalWrite(ledPin, LOW); // sets the LED off
delay(100); // waits for 100ms
}

// wait 5 seconds before repeating the SOS signal
delay(3000);
}

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

If you are using the 12v analog strips switched by MOSFET, there would be no change to the code to do a monochrome SOS flash pattern. Every time you set the pin HIGH, the MOSFET would switch the 12v directly to the strip.

Of course, that is only one color. If you wanted to take advantage of the other colors the strip is capable of, you would need 3 pins and 3 MOSFETs and the code to match.

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

So I think I am going to go with a monochromatic orange color. Is there and easy way to find the correct combination of red and yellow to give me orange?

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

Is there and easy way to find the correct combination of red and yellow to give me orange?
Well, yellow is a combination of Red and Green. So to get orange, you would probably want full intensity red and somewhat lower intensity green.

To control the intensity, you can use "analogWrite()" on a pair of PWM pins and connect those pins to your MOSFETs.
On an Arduino UNO, PWM is available on pins 3, 5, 6, 9, 10, and 11.

Code: Select all

for (int x=0; x<3; x++) 
{
analogWrite(redPin, 255); // max intensity red
analogWrite(greenPin, 128) // half intensity green
delay(400); // waits for 400ms
analogWrite(redPin, 0); // off
analogWrite(greenPin, 0) // off
delay(100); // waits for 100ms
}

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

I was looking at the RGB strips you mentioned and they seemed to suggest that it is analog only and will not work with an Arduino

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

They work very well with an Arduino. The Arduino supports "analogWrite()" to the PWM pins. Wire them as shown in the tutorial: https://learn.adafruit.com/rgb-led-strips/usage

Image

User avatar
jasiu
 
Posts: 35
Joined: Mon Oct 14, 2013 1:47 pm

Re: Flashing Hazard LED's

Post by jasiu »

Thanks so much for your reply. One more silly question,, do the ends of the RGB strip, not going to the arduino, need to be terminated in some way

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Flashing Hazard LED's

Post by adafruit_support_bill »

No need for termination. Although it is a good idea to make sure that the contacts are covered so they don't accidentally short out against anything.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”