Go Down

Topic: Automotive and Arduino (Read 3147 times) previous topic - next topic

Firefurter

I am using an Arduino to control a lot of LEDs. But I feel like there is something I'm not understanding that could damage my circuit and all my leds. I think its called load dump?
Because the Arduino being powered through my car cigarette lighter with a 5volt regulator.

I'm worried my car alternator might spike and toast my Arduino and LEDs. Is there something I should look in too for protecting my stuff? Or did I just miss read something along the line

dephwyggl

I am using an Arduino to control a lot of LEDs. But I feel like there is something I'm not understanding that could damage my circuit and all my leds. I think its called load dump?
Because the Arduino being powered through my car cigarette lighter with a 5volt regulator.

I'm worried my car alternator might spike and toast my Arduino and LEDs. Is there something I should look in too for protecting my stuff? Or did I just miss read something along the line
In an automotive environment, you definitely do have to look after ensuring power transients are managed - and not just load dumps. I've been pursuing exactly this goal. Latest topic on this is at the topic Automotive Human switching and power management. Happy to have you join us there. :)

Cheers!
Dirk

Firefurter

Yeah I saw that after I posted this, Looked over it but it just got me little more lost >.<

dephwyggl

Yeah I saw that after I posted this, Looked over it but it just got me little more lost >.<
I hear you. Managing automotive power turned out to be far more challenging than I anticipated. There are 3 primary things to manage:
  • reverse polarity
  • under-voltage
  • over-voltage
  • Reverse polarity can be handled simply with a diode. There are nuances here though that can be explored - mostly that of voltage drop (which tends to be high) across diodes.
  • Under-voltage can be handled with a comparator or zener. I'm taking the latter approach.
  • Over-voltage is a little trickier; the voltage variances seen in automotive environments can be extreme (-28V to +120V). The negative voltage is handled as above. The 0 to +120 needs to be broken into parts which can be managed separately. A Transient Voltage Suppressor (TVS) can be used to filter out the extreme stuff (over 26V). The 0 to +26V which remains can be handled with a comparator or zener. I'm taking the latter approach with this also.
My goal is to get +10 to +18V at up to 20A (actually, my approach may provide for an arbitrarily high current carrying capability). I've run into all sorts of issues and had to effectively start over and break down the project into much smaller chunks. Currently, I'm working on managing the 0 to +26V window which involves the 0 to +10V, +10 to +18V, and +18 to +26V stretches. That starts here. Currently, that conversation is at the "limit to a minimum of 10V" stage. Coming up is reverse polarity; I'll be exploring using a reversed p-channel MOSFET instead of a diode to minimize voltage drop. After that it will hopefully end with the +26 to +120V(?) stuff and voltage spikes.

NB There may be much simpler - or even single-chip - solutions if your current requirements are significantly lower (say, less than 5A).

Cheers!
Dirk

MorganS

Because the Arduino being powered through my car cigarette lighter with a 5volt regulator.
Then you are perfectly fine. Most 5V adaptors have pretty good protection. Of course there may be a fault or it's designed by an idiot but that is actually quite unlikely.
"The problem is in the code you didn't post."

Firefurter

#5
Mar 12, 2017, 04:45 am Last Edit: Mar 12, 2017, 04:58 am by Firefurter
I heard little and friend told me while ago something like this might be enough to help the problem (if not drawn backwards) but to me it looks like just bunch parts stuck together.


dephwyggl

If all you need powered is the Arduino, I agree with Morgan's comment.

I heard little and friend told me while ago something like this might be enough to help the problem (if not drawn backwards) but to me it looks like just bunch parts stuck together.
It's not drawn "backwards". Roughly (from left to right):
  • D1 (diode) prevents reverse polarity
  • V1 (MOV) does gross limitation to 15V
  • D2 (zener) does finer grained limitation to 15V
  • C# (capacitor - all C items) mitigate spikes/decouple
  • 5V Regulator limits voltage to 5V
If you're trying to power other things - particularly if at a different voltage, then other things may need to be considered.

Cheers!
Dirk

ardy_guy

]D1 (diode) prevents reverse polarity
I thought a polarity protection diode went in series. If the battery's backwards won't that one just short straight across?

dephwyggl

I thought a polarity protection diode went in series. If the battery's backwards won't that one just short straight across?
Ack! Quite right. D1 should be inline. (It just looked nice and symmetrical. :P )

Thanks for the correction, Ardy. :)

Cheers!
Dirk

Firefurter

#9
Mar 12, 2017, 07:06 am Last Edit: Mar 12, 2017, 07:17 am by Firefurter Reason: Because I can't spell
I'm powering two things, the arduino off 5volts and my LEDs off the battery while the car is running.  I don't think I could pull the power for my LEDs through D1. Because I saw you said about it being inline
Ack! Quite right. D1 should be inline.
So I go my LEDs hooked before the diode showed in photo3. Didn't fix D1 in the photo yet

The LEDs are on printed circuit board that hold 120 5mm blue LEDs. The leds are arranged so there is three in series with a resistor (see photo pcbforLEDs.png) The power each board should be using is 10.2volt and 800mA. I have total of 16 of these PCBs. So I totally need find a way to keep the LEDs safe as well since it going take alot of work to make to make the boards.



dephwyggl

Firefurter, I appreciate what you're trying to do, but you won't get very far - and will likely burn out a lot of components - until you learn a bit more about electronics generally. For example, the first thing you need to do is determine exactly what your LED arrays require as far as voltage, current, and control is concerned; the way you have it drawn, your LED arrays are powered directly from the voltage source - without filtering, without regulation, etc. (They are unlikely to survive very long in an automotive environment this way.)

It would help if you understood a bit better how and what the Arduino can do with hardware. For example, you show 8 pins controlling your LED arrays. Depending on the specific Arduino you're using, you may have very few options remaining to actual signal ("tell") the Arduino what you want done with the pins to which your LED arrays are attached. Also, the way you drew your diagram is not going to help you understand what you're attempting to do. Maybe take a look at (simpler) example circuits on controlling LEDs directly, as well as controlling external loads (like you've attempted to draw) with Arduinos. This site's search and Google are your friends. :)

Cheers!
DIrk

Firefurter

#11
Mar 12, 2017, 09:20 am Last Edit: Mar 12, 2017, 09:25 am by Firefurter
I see I forgot a resistor between my transistor and output of my Arduino. Also I've ran these LEDs for hours on my bench power supply to test them, never had any problems. I'm not going lie don't know few of the words you're talking about like filtering and regulation. I just know what I've done so far hasn't damaged my stuff. Could you please tell me what I'm doing wrong in this photo maybe?







Also here an example of a code I'm using as well

Code: [Select]


const int patternCount = 2;

int P13=13; //P# is output pin number being used on the arduino
int P12=12;
int buttonPin=2;
static unsigned long lastButtonTime = 0;

void setup() {
  pinMode(P13,OUTPUT);
  pinMode(P12,OUTPUT);
  pinMode(buttonPin,INPUT);
  
}

void loop()
    {
    static int pattern = 0;  
//  If the button is down and the last time it went down was more than 1/10th second ago.
   if (digitalRead(buttonPin) && (millis() - lastButtonTime) > 100)
    
        {
        lastButtonTime = millis();
        
        pattern = (pattern + 1) % patternCount;
        
        }
    
    switch (pattern)
        {
      
   case 1:
   digitalWrite(P13,HIGH);  
   delay(200);
   digitalWrite(P13,LOW);  
   delay(200);
   digitalWrite(P12,HIGH);
   delay(200);
   digitalWrite(P12,LOW);
   delay(200); //end of pattern 1
   break;
  
   case 2:
   digitalWrite(P13,HIGH);  
   delay(100);
   digitalWrite(P13,LOW);  
   delay(500);
   digitalWrite(P12,HIGH);  
   delay(100);
   digitalWrite(P12,LOW); //end of pattern 2
   break;
      }
    }

oswe

Leds are directly to battery? Try to protect at least put zener,diode and surge... Transistor can handle current? Then it can be OK...but leaving base open of a transistor inside a car env can give you residual light. Code doesn't look much optimized but if you only manage those LEDs it is ok I think!! Why don't you count rpm as well? Now that you have a computer running pattern in LEDs I mean...

dephwyggl

That does not resemble what you said earlier:

The LEDs are on printed circuit board that hold 120 5mm blue LEDs. The leds are arranged so there is three in series with a resistor (see photo pcbforLEDs.png) The power each board should be using is 10.2volt and 800mA. I have total of 16 of these PCBs.
Figure out what you'll actually be using and get a schematic that reflects exactly that. (According to this, you'll need something other than 14.5V to feed them, and total power will be north of 180W.)

I'll reiterate what oswe said: You will need some kind of filtering and regulation. A "car battery" is not just a battery; it's the battery, the alternator, and everything vibration, corrosion, cranking, poor connections, etc. a car throws at its electrical system; a 14.5V power supply on a bench is not the same thing. I've outlined what's needed to provide reasonably clean power in an automotive environment. If you insist on continuing on this path, you may get things to work. For a while. I wouldn't bet on it, though.

As for the sketch, it'll likely do something with the array you have attached to pin 13. Not sure why you have code for pin 12 though, and I don't see anything attached to pin 2 to signal the Arduino.

NB I'd suggest get the hardware figured out. Then maybe re-broach the software thing in a more appropriate area.

Cheers!
Dirk

panther3001

#14
Mar 25, 2017, 11:06 pm Last Edit: Mar 25, 2017, 11:11 pm by panther3001
Ack! Quite right. D1 should be inline. (It just looked nice and symmetrical. :P )

Thanks for the correction, Ardy. :)

Cheers!
Dirk
Here's a correction to the correction: D1 isn't a reverse-polarity protection diode. It is a transient undervoltage clipping diode. It clips all negative voltage spikes to -0.7V or so, keeping them from damaging the circuits from negative voltage spikes coming from the alternator on the 12V battery feed. As shown, the circuit in discussion doesn't have a reverse-polarity protection diode. Leave D1 as it is, but add a reverse-polarity diode in series too.

Notice that D1 and D2 (the zener) work together. They each clip negative voltages to ~-0.7V, but the 15V Zener also clips positive voltage spikes down to only 15V. I wonder if D1 is needed at all actually, on second thought, since D2 will clip negative voltages down to -0.7V or so by itself anyway. See the "Zener Diode Clipping" section of the link below, for instance.

See more examples here: http://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html
Visit my RC aircraft, electronics, & Arduino website at http://www.electricrcaircraftguy.com

Go Up