I built up an LED circuit with an Arduino Uno that will turn on a green, yellow, or red LED based on how long a float switch in a racecar fuel surge tank is closed (low fuel). The project worked exactly as expected (green if switch open, yellow if closed for 10 seconds, red if closed for 60 seconds, blinking red if closed for 90 seconds). There's also a secondary function that reads the Coolant Temp Sensor voltage and turns on a 4th LED if < 0.35V (230F water temp). I tested it for extended periods of time in the car with key on & engine off, and it worked perfectly. Nothing even got warm.
As soon as I started the engine, the 3A fuse to the project blew immediately (while the starter was still engaged) and the project no longer worked. Even with the engine off now it blows any fuse immediately and violently. I cut the power wire to the voltage regulator, and powered up. It didn't blow the fuse anymore, but the Arduino board literally smoked and the Tx (Pin 13) LED on the board no longer illuminates.
I've attached my schematic and uploaded a video showing the startup sequence. Could 12V from the car run backwards through my PN2222 transistors and burn up the voltage regulator and/or the digital outputs? I'm super green (my first Arduino project). Is there something obvious that I missed?
Either you connected power backwards, or spikes on the power rail (automotive power is notoriously noisy - especially when using the starter motor) trashed the regulator, which failed to a short between input and output, putting 12v across the uno and utterly destroying it.
Official Uno's are particularly sensitive to noise on the power rail (the 16u2 used as serial adapter is the weakest link here), but the failure is so dramatic that I think whatever happened would have killed it for sure.
Would adding diodes between the digital pins 8-11 and the 1K resistors correct the issue?
My thought is maybe the 11-15V car power is going backwards through the PN2222 transistors, and into the digital pins. Also, if the digital pin is "HIGH" would it send that same 11-15 volts backwards into the 5V out on the voltage regulator too?
You need to read a bit about Automotive transient protection. You can easily get 40V to 60V for short amounts of time. It gets even worse when you are a long way from the battery. Electronics for taillights needs to withstand +100V and -300V, because the long wires have an inductive characteristic. So, when they are switched off, they create a reverse current.
Google "Automotive Transient Protection" and look for application notes from semiconductor companies.
I would say the first mistake was confusing
the idea of 12V (as it applies to an arduino)
and automotive 13.8 V
13.8V != 12V.
The second mistake is not using opto isolatirs
to isolate the arduino from the auto.
The Arduino is OFFICIALLY NOT recommended
for automotive applications (says ATMEL, re-
garding the ATMega328).
There should be 5000V islation barrier between
the arduino and any inputs or outputs, which of course means the ECU analog voltage needs to be isolated from the arduino A0 and the Analog
Devices AD202KY isolation amplifier is a little
pricey at $80. Everything else could be isolated
cheaply but I don't kniw a cheap way to
idolate an analog input other than an opto isolated
4-20 mA current loop.
Third mistake is using a linear voltage regulator
to step down 12V to 5V. The regulator has to dissipate 7V as heat. That's obsolete.
These days it's done with a switching buck converter.
Fourth mistake is (unless I misread your schematic)
NO current limiting resistors for the leds.
Sixth mistake is using 2N2222s (which described
as PN2222s which have the exact OPPOSITE
PINOUT !) Unknown at this time which one you are using) instead of opto-couplers to drive the leds.
Both are transistors but the opto-couplers have a 5000V isolation barrier.
Where are the led current limiting resistors ?
(with the exception of the white one which
has a 1k)
Seventh mistake is playing with electronics
BEFORE posting HERE for PROFESSIONAL advice
from over a century of electronics experience
(if you add up the working experience of the forum
members who respond).
Electronics has been made easy by the WWW but
that doesn't mean it's easy. Of course I
wouldn't say this about your typical arduino
hobbyist project at home. I'm only saying this
because it's a racecar. (I don't if that makes sense
but there it is)
If you are not a working electronics engineer or
technician you should start with the assumption
you don't know what you are doing until you've
done it successfully at least three times.
Do I know why your circuit fried ?
Quite honestly, no.
I once saw a 2N3906 explode so violently it
blew a crater in the flat face of the transistor
and propelled the ejected piece actoss the room
and off two separate walls before ending up a total
distance of 50 feet ftom where it originated.
I think it would be safe to say that if someones
eye had been close enough it would have
pinched right through their eyeball.
All from a 20 cent part nobody would think
twice about using. I suspect this is why the
company has a "safety goggles required in
labs" policy.
What steps (if any) have you taken in the
way of Fault Analysis ?
ie :
Did you test all the transistors and leds ?
Did you test the voltage regulator ?
You can trash the arduino but everything else
should be good.
That being said, I'd love a ride in your racecar !
Thanks for all the help. Here's some clarification to my original post and additional thoughts:
Here are the PN2222 Transistors I used. The are wired in my circuit as shown on the original post (pin 1 tied to ground). I think raschemmel may be correct... It looks like I may have pins 1 & 3 reversed? If that's the case, would it backfeed car power (~13.8V) backwards into the digital pins 8-11? Strange that it worked correctly with the key on and engine off though:
Here is the DROK buck converter I used to supply the Arduino regulated 5V (it also has a 1.8V, 2.5V, 3.3V, 9V, 12V option). I wired it to the 5V pin on the Arduino. Would it be a better option to use the 9V option from that converter and connect it to the Vin pin instead?
The 12V LEDs are panel mount units with these specs. They're intended for automotive dash applications. Do they need a resistor?
Mounting Cut Hole: 12mm (.472")
Head Diameter: 15.6mm
Head Shape: Flat
Bulb Type: LED
LED Color: Amber/Yellow
Lamp Voltage: 12V DC
Rated Current: 15mA
Terminal type: Screw
Body Material: Aluminum
Protection Rating: IP67/IK10
Operation Temperature: -20C - 50C
Panel Thickness: 1-10mm
Depth behind Panel: 21mm
Standards: CE, TUV Certified
I'll disconnect the ECU from the circuit for now as I don't want a failure in this project to put me out of a race.
The schematic didn't mention they were automotive leds which don't require a resistor
( possibly because automotive users may not know what a resistor is and even if they did it
doesn't mean they would know a led is a nonlinear diode which requires a resistor.
It is safe to assume it was included by the manufacturer. Also, FYI buck converters
are NOT called "voltage regulators" (as you labeled it in your schematic). That
term is reserved for LINEAR monolithic (flat pack with a screw hole mounting tab) regulators
which are NOT efficient like buck converters which,strangely enough, are called "buck converters" (who knew !). If you have access to a multimeter it is quite easy to test the transistors to confirm the pinout.
If a meter is set to DIODE SCALE (diode symbol in the display) and the BLK lead placed on the
EMITTER, and the RED lead placed on the BASE, it will read the diode forward voltage of 0.650 to 0.750 volts. (every time). If it reads 0.1 to 0.3 it is SHORTED. Since you used a buck converter and automotive
leds, that pretty much rules those out as the problem , leaving the transistors as the primary
suspect. I think it is unlikely the ECU would output a voltage geater than 5V to the A0 analog input.
I would ohm out the automotive keds or test them under power to rule out that they are shorted. I would be curious toknow what they read with the BLK lead on the "-" terminal on DIODE SCALE.
Keep looking for short .
Unfortunately it would require an oscilloscope to see the spike on engine start butI would
hope you wired your 12V to the ACC power, and not on the starter side.
If not, that's an "OOPS !".
I'm not confident that the buck converter is rated for automotive use. The DROK website shows a lot of different converters and I can't quickly find that exact one.
Those cheap cigarette lighter plug units for charging cellphones are remarkably good. They are cheap because they make millions of them. They are reliable because the manufacturer cannot read a million complaint emails when expensive phones are destroyed. So they look cheap inside but the engineering that makes them that cheap is actually quite expensive.
Like the difference between a Ford and a Ferrari. The Ford is built with steel, the Ferrari uses titanium. But Ford will build test vehicles and test them for (simulated) years. The number of cars produced for testing on a single model will exceed the total number of Ferraris built of all models. You never see those test cars. They are all crushed after the test is completed. Ferrari will sell prototype #1 to a collector, who will attempt to drive it, and it will probably burst into flames if they drive it more than a thousand miles in its lifetime. Ford spends a lot more on engineering and testing than Ferrari does.
MorganS:
Those cheap cigarette lighter plug units for charging cellphones are remarkably good.
Thank you MorganS for this suggestion! I wired in a $6 cigarette lighter USB plug last night and a new Arduino. Instead of wiring directly to the 5V pin on the Arduino I just used the USB cable supplied with the kit, and made no other changes. Everything works perfectly. I started and engine and shut down 10 or more times, with no issues.
I discovered one other small issue that I thought I'd ask for advice on as well. I'm measuring the car's ECU voltage (0-5V) from the Coolant Temperature Sensor via the A0 channel in the Arduino which is used to turn on an LED when the temperature reaches 212 and flashes when it gets to 230.
With the Arduino powered up, the impedance of the A0 channel is high enough where it just reads the voltage and doesn't change it. But if power is cut to the Arduino the impedance on the A0 changes, and it drops the voltage significantly (what was 3.0V with power on, became 0.75V with power off). So if the Arduino fails during a race, the ECU will get a signal that the engine is running hot and will change the fuel map... Not ideal!
I was thinking I'd just put a relay (SRD-05VDC-SL-C) in line with the signal wire that is switched on by the Arduino. Two questions.... 1) do I need a resistor between the digital pin and the switching side of the relay? What value would I use? 2) This doesn't seem like the most elegant solution, but I'm not package limited and a relay won't affect the signal voltage. Is there a better way that doesn't require an $80 isolation amplifier?
Thanks again for all the help! We're on track next week.... looking forward to using all of our new Arduino features!
"Just a relay" is probably the best solution. But most relays require more current than an Arduino pin can provide. Look for a relay module which includes a transistor or a "reed relay" which uses 20mA or less.
I ended up using this relay module to isolate the car's ECU from the Arduino when it is powered down. It was $5.79 for 2. I ran a 5V power line from the same cigarette lighter USB adapter board, and a digital signal from the Arduino turns it on, requiring only about 5mA. Works great! Thanks again for all the help!
With the Arduino powered up, the impedance of the A0 channel is high enough where it just reads the voltage and doesn't change it. But if power is cut to the Arduino the impedance on the A0 changes, and it drops the voltage significantly (what was 3.0V with power on, became 0.75V with power off). So if the Arduino fails during a race, the ECU will get a signal that the engine is running hot and will change the fuel map... Not ideal!
I'm surprised it didn't come up before, you have no input protection on your A0 input and no capacitors. anywhere (unless you stated they were not on the drawing and I missed it).
For the A0 input I would put a 5k to 10k in series and a 0.1 µF to ground near A0 into the micro. This would protect and filter the input and likely solve the Arduino failure issue. There are other things one could do for the A0 input but this is what I would consider the minimum.
Even with your charger I would add a 0.1µ and a 10 to 100µF on the 5 V input.
I'm assuming you are using the internal pull up on the D3 input to pull up the D3 signal when the float switch is open. That might not be enough in a noisy environment. Perhaps add a 5k from the D3 to +5V.
Now for the ECT wire input (this is apart from the input conditioning mentioned above), every "production" ECU I've worked with used a separate ground for the 5V sensors. This ground has the potential of being over a volt different that where ever you found the ground for the 12V-5V adapter.
There are at least a couple of ways to accommodate this difference but I'll first please let us know if this is even an issue for you.
JohnRob:
I'm surprised it didn't come up before, you have no input protection on your A0 input and no capacitors. anywhere (unless you stated they were not on the drawing and I missed it).
You are correct... I did not put any input protection on the A0 channel. I guess I was just looking at the Arduino like voltmeter and went direct. Good suggestion and I'll plan to do that.
JohnRob:
Even with your charger I would add a 0.1µ and a 10 to 100µF on the 5 V input.
Is this necessary? I'm using a cigarette lighter USB and plugging it in to the USB in on the Arduino with the supplied USB cable. Where would I put the capacitors in this arrangement?
JohnRob:
I'm assuming you are using the internal pull up on the D3 input to pull up the D3 signal when the float switch is open. That might not be enough in a noisy environment. Perhaps add a 5k from the D3 to +5V.
Correct on the D3 pullup. I did put a 1K resistor and diode in this line, mainly because it's teed in with the 12V supply and warning light that is turned on by that same switch (not by the Arduino). Those are shown in my schematic.
JohnRob:
Now for the ECT wire input (this is apart from the input conditioning mentioned above), every "production" ECU I've worked with used a separate ground for the 5V sensors. This ground has the potential of being over a volt different that where ever you found the ground for the 12V-5V adapter.
There are at least a couple of ways to accommodate this difference but I'll first please let us know if this is even an issue for you.
I think the way the ECT works in this case, is there is a single 5V reference supply that branches off to several different sensors, and the ECU reads the ground side of this signal. The ECT (Engine Coolant Temperature) sensor is just 2 wires (not 3 like most newer cars would be). I've compared the return (signal) voltage to a reference table and it seems to be reading correctly, whether it's connected to the Arduino or not, as long as the Arduino is powered up. If the Arduino is off, that signal voltage drops significantly and the engine runs terrible due to incorrect ECT reading. Isolating the ECT from the Arduino with a relay module corrected this so that if the Arduino does lose power, it disconnects the ECT. All that said, I agree it still should have protection for when it is connected and the Arduino is powered up. I'll try your recommended cap and resistor.
Thank you for all the help and suggestions! First race with the Arduino on-board is this weekend!
In the automotive world 12V is not 12 volt the system voltage can range from about Plus or minus from 0 to 24 volts before transients. Before you get upset note the huge amount of electronic parts that are automotive rated. I would suggest anybody that does not have experience in the automotive electronics read a few automotive electronics design manuals. Here is a short section from Automotive Quality Standards 101. This is just a start of what happens. Most of the parts are specified to much tougher standards then military components. For a component to be automotive qualified, manufacturers have to meet specific industry standards throughout the manufacturing and testing process. Three key standards are IATF 16949, AEC-Q100 and AEC-Q200:
IATF 16949. The global automotive industry standard for quality management systems. The automotive industry generally expects parts to be manufactured, assembled and tested in IATF 16949-qualified facilities.
AEC-Q100 & AEC-Q200. During the qualification phase before the release of the device, each component must survive a battery of industry-standard tests:
AEC-Q100 defines the standard tests for active components such as switches and power amplifiers (PAs).
AEC-Q200 covers similar tests for passive devices such as RF filters used in Wi-Fi and cellular communications.
Some of these tests are unique to the automotive industry and aren’t conducted at all on parts intended for commercial use. Examples are the test for early life failure rate (ELFR), which subjects multiple samples of 800 components to temperatures of at least 125°C, and the power temperature cycling (PTC) test, which repeatedly cycles between extremely high (125°C) and extremely low (‑40°C or even lower) temperatures.
Other tests are conducted under harsher conditions — such as higher temperatures — than when testing commercial parts, or using larger lot sizes to provide greater statistical confidence in the reliability of production components.
Also, because cars last much longer than other electronic devices, manufacturers typically must ensure a supply of each automotive component will be available for 10 years. All of this and more will become apparent when looking at automotive rated components.
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil
Is this necessary? I'm using a cigarette lighter USB and plugging it in to the USB in on the Arduino with the supplied USB cable. Where would I put the capacitors in this arrangement?
Necessary or advisable? An automotive electrical system is very electrically "noisy" and going through a race or two without issue does not insure you will not have trouble in the future. I would at the minimum put a 0.1µF ceramic cap right where the regulator you removed was.
I think the way the ECT works in this case, is there is a single 5V reference supply that branches off to several different sensors, and the ECU reads the ground side of this signal.
Your likely correct. The typical circuit is:
Internal ECU 5V - connected to a resistor - the output of this resistor is connected to one terminal of the sensor - the other terminal of the sensor goes back to the 5V ground in the ECU. This means the "gnd" or "common" for the sensor is in the ECU. This common may be.... GM uses a value of 2.5V difference. I've never seen that much, my guess is its probably < 1/2 volt. In your wiring you might have the cigarette lighter adapter wired in very near the ECU so there may be little difference from the lighter ground and the ECU ground. (I'm assuming you wired it into the vehicle harness somewhere).
I mention this only to make you aware of the possibility in case an issue comes up you can consider this when troubleshooting.
Correct on the D3 pullup. I did put a 1K resistor and diode in this line, mainly because it's teed in with the 12V supply and warning light that is turned on by that same switch (not by the Arduino). Those are shown in my schematic.
Again a vehicle is a noise environment. If the float switch is open the diode is reversed biased and essentially the line from the anode of the diode to D3 is an open circuit held at 5V by an internal 10k resistor. This line could easily pickup electrical noise and make D3 think the switch is closed. Note at the digital "high" threshold the pull up current is only 60 µa. Not a lot of current to stave off the effect of electrical noise. You should put a 0.01µf cap from D3 to ground in addition to the stronger pullup to 5V.
Note: The processor is not a robust device. It is a "raw" component. It is nowhere near the input of a typical multimeter, not on the analog inputs, not on the digital I/O and not on the power coming in. Its a device that is usually buried on some circuit board in a product and has a lot of protection on all the pins. Now don't think that because you have an Arduino "board" this protection is there....it is not. I can pretty much guarantee if you device was lying on the bench and you walked across the carpet and touched the junction of D3 and the 1K, you could just throw the device in the garbage.'
I'm not trying to scare you, I just want to give you the right perspective. Most of the folks here (including myself) have already made all these mistakes so we're hoping we can save you some trouble.