Automotive usage : LED driving

Hi everybody !

Sorry in advance about my bad English.

I've done some Arduino basics and now feel a little bit more friendly withe the beast :slight_smile:

I know how powerful Arduino can be and I recently encountered an issue on my car that an Arduino with some MOSFET and power resistor could solve !

Here is the situation : I want to change all bulbs of the car (from hallogen to LED). Think quite easy on a lot of cars but not on mine (Opel Vectra C).

When I decide to replace a bulb by a LED, I got of course the issue on the OBD telling me that a bulb is faulty but, I know that well calculated power resistors in // can solve this.

The main issue is the way the car detects if a bulb is faulty, it sends short pulses (aprox. 100ms) of +12v every 3 sec on every bulbs (not at the same time). With a fillament, it does not have the time to heat and it's okay. But as LED draw much less current, they blink / flicker / stobe (don't know which term is the good one ^^).

This is happening on each bulb when the car is unlocked (while driving, when stopped and so on).

Still the LEDs work fine :smiley:

The issue is that people on the road stop me to tell my that christmas is passed from two months xD.

Here are the things I know :

  • The LED all flicker at a frequency of 0.33 Hz for a peak at 11.7v lasting 100ms.
  • The do not flicker at the same time
  • Almost all of the bulbs are driven by +12 DC when on and 0V DC when off.
  • Some of them (rear tail light, rear break light) are working with a PWM signal when on. Which has a frequency of 68 Hz, Ton = 3mS / Toff = 11.7mS) and reaching 11v aprox.)
  • The total resistance of the circuit should be 120 ohm so the OBD does not find any error.

So, I was thinking about a program that would read every wire going to a specific bulb and decide whether it's the flicker, a PWM signal and a normal 0/1 signal.

The arduino would be between the LEDS and the ECU's watching and routing the signals without the "flicker issue" that I got.

The program would do a routine every .... (I still don't know) and make sure every LED are OK, knowing that the anoying signal that flicker could be used for that, how ?

As the user would switch a light on, some +12 V DC or PWM signal would be sent to the arduino that would send it to the correct LED bulb.

And when the light is off (from the user), "catch" the flicker signal and use it or filter it...

The command would work with MOSFET transistors at each OUTPUT of the arduino and a tension divider would make the INPUTS at 5V so it does not dammage the arduino.

That's it for the idea, hope you understand what I mean, if not tell me :smiley:

About the code part, that's where I strugle a lot...

Here are some ideas that I had but have no clue of how to put them together...

  • PulseIN was a good idea for the PWM signal, but I saw that the Arduino cannot watch other pin while counting on a PIN. PinChangeInt library seems to be a good idea but I don't know how to use it in my case (read a lot about it before asking you friends).
  • About the strobe signal, I do not know how to handle it, PulseIN was also a good idea but still the same problem and 100ms peak is too short maybe ? I also thought acting like a push button making a state that would remain for a certain time so the test can be done without strobering LEDs.
  • For the DC +12v / 0v, I thought about simple inputs and outputs...

Hope my explainations are clear enough and my English good enough... And also sorry for being a newbie that wanna learn :frowning:

By advance, I thank you.

Regards

I think it's not worth trying to understand or decode the OBD signals. You don't fully know what characteristics it's testing for, but all you have to do is make a circuit that behaves the same way as a bulb because that is a known.

I would not put a single arduino in charge but rather use a smallet AVR in every cornet of the car like an ATtiny13, although that may not even be needed.
If would start bypassing a bulb with a resistor to prevent the OBD from complaining.
Then on the positive side of the resistor i would branch off with a resistor of a higher value, beyond which you can put a capacitor to remove the ripple and only giving out a high voltage when driven with a constant voltage, and you can use that to control a mosfet that provides GND to the bulb.

This is an issue of course, that means they flicker when normally on (technically speaking) and it will be harder to differentiate between a testing pulse and normally on.

Which is it ? at .33Hz, that means it has a wavelength of 300ms, you are saying that the test pulse is longer than normally on for some of the lights ?

It's possible that a resistor alone would fix it. I'm surprised you haven't tried it. If you did, you didn't mention it.

Thank you for all your replies !

I already tried a resistor in //. It's working (I mean switching off the MIL one the dashboard), but the test flicker is still there.

Deva_Rishi : The test signal is just a peak of 11 V aprox. every 3 seconds, the time it rises and falls takes 100 ms :slight_smile: .

aarg : I know the risk I can take, but it's not like I was doing a Speeduino :p, it's "simple" signals that I was able ta catch with an oscilloscope (lights off / on then tested every bulbs so I can make sure the test signal is the same everywhere and the PWM command is only present onto rear tail & break lights).

Hope i managed to anwser your questions :confused:

More or less. Yeah you could use an AVR, but it does require some programming. Receiving the PWM signal may be a bit tricky, Regardless of it all, use opto-couplers to interface with any of the 'data' lines. A car produces a lot of noise.
For the normal 12+ signal, you can simply 'poll' every individual line, And on turn on the output once the signal has been HIGH ,or LOW, actually if you connect an Opto between the input pin and GND and use the internal pullups., for longer than the time of the test pulse.
For receiving the PWM i would use interrupts to confirm that that is what you are receiving. For that polling probably isn't going to work. Since since every signal will need to pins, and you may not a really big board,
It might be more practical to use 2 or more units, it also depends a bit on how the wiring is physically accessible.

Thanks to you it's now really clear in my head, well clearer than it was before.

If I get it right, you want me to use Arduino boards based on ARM architecture ?

In my readings, I've read that ARM architecture were more likekly with interruptions, aren't they ?

If so, I would less stugle to manage PWM inputs ? (more PIN available for clean interrupts ?)

Concerning octocouplers, I was hesitating between that and MOSFET (the size is to be watched).

Their role would be to clear the signal comming from the car (noise due to alternator and so on), and they can be used as "relay" as well ?

I don't really understand that part ? (sorry, even though I'm French, I try to come to you guys cause I know that English speaking people are more skilled.... as far as I've seen and read on forums)

I get that you want me to use onboard pullup resistors and code as if it was a common LED on a breadboard (if user switches / set the output on etc.) ? But for the test signal and the notion of time, I'm not quite sure I come to get what you mean ?

Concerning the number of boards, this car has a UEC and a REC (Underhood Electrical Center & Rear Electrical Center), It would be wise, as I have the wiring diagrams to add something in there ?

Command wires and wires leading to bulbs are all gathered into this units).

As long as I don't have a board & octo on each bulb it's fine to me :smiley:

If everything I just said goes with you meaning (except the time concept), I'll give it a try :slight_smile: .

Nevertheless I have to thank you for your kind help, I wasn't excpecting someone helping me that much and that quick !

If you need more informations or diagrams do not hesitate, language border can be tricky.

You don't need to read the PWM. You just need to determine "something different from test signal" is being sent and turn on the LEDs. For this some simple logic should be enough. Since the test signal takes looong 100ms you don't need interrupts. Polling should be enough.
For the logic consider:

  1. Occasional test pulse passed to the LEDs is ugly but not a show stopper.
  2. You can delay turn on of the LEDs by a few milliseconds without any issue (from your description the original lights take more than 100 ms to turn on).
  3. Delay turn on by hundreds of ms or even whole second is a serious fault that should NEVER happen.

In other words Arduino should turn off the LEDs only if it is absolutely sure only the test signal is present and the default state should be LEDs on.

Consider turning off the burden resistors when LEDs are on to reduce power dissipation in the resistors.

Optocouplers are for

  1. Isolation
  2. Level shifting

Your application needs neither. Of course you need some protection for the pins but the input LED of the optocoupler is probably more vulnerable than an Arduino pin and so it will need similar protection.

Perhaps you could have a system where you switch between the LED and a resistor with a SPDT relay. So when the LEDs are supposed to be OFF, current flows through the resistor and when ON, the LED is connected.

Alternatively keep the resistor in circuit permanently and connect/disconnect the LED.

Thank you for you time and idea :slight_smile:

I've tried this and it's working but only on bulbs that work with 0 or 1 signals.

The rear tail light and the break bulbs recieve a PWM signal so the break lights are lit brighter than the tail lights so it does a contrast for other people on the road :slight_smile:

When I use a relay on those bulbs (also turn signals), the switch insides goes crazy (as it's a 68 Hz PWM signal).

Also it's a really big installation (lot of wires etc.).

With the arduino I was hopping reducing the amount of wires, and pilot the LED as I want them to light (brightness).

Thanks for your help too, people here are really kind and helpful :slight_smile:

You idea seems to fit for my problem, I still don't know how I am going to test it (perhaps using time measurement in conditions ?)

About this part : I'm not quite sure I get your meaning, 100 mS is the time the pulse test signal takes to go to 0V to 12V and so every 3 seconds.

So if I get it right, the aim would be to

  • Check every ..... (mS, S or uS) what kind of signal is comming as an input
  • If it's the test pulse signal (which by the way is not sendt when the bulb is lit) => OUTPUT a 1 to a load resistor
  • If it's PWM, which I need to know as I need to ajust brightness of some bulbs => OUTPUT a PWM signal
  • If it's a 12V signal => OUTPUT a 1 to the bulb

What about the time between each test peak where the signal is 0 ?

Right, so for the main headlamps follow the simpler non-arduino approach....? That will atleast solve half of your problem...

In summary, you want to "fool" the ECU (or whatever is controlling the electricals) into thinking that there is a bulb present even when there isn't one, right?

Using the particular technique that's being used makes sense since the car uses ordinary bulbs (cheap) and the manufacturer wanted to have this "cool" feature in it which shows which bulb is blown - its useful and good for marketing as well.

Although you may get away with the headlamps, tail and brake lamps, the turn indicators rely on the bulbs' resistance (or current) to time the "ticking" or blinking. Any one blows and the indicators will blink at a faster rate which itself is an indication of a blown turn light.

That's it :wink:

I want the units to think there is a bulb (and if possible tell me when it's blown, even though If this feature is no longer available I wouln'd care that much).

I know that the "relay solution" is going to work on every bulb that's not driven by PWM.

I just need to figure out the value in Ohm that this thing is excpecting, which I can do with a pot.

Still, it's a lot of wires and less easy to "hide" than an Arduino...

If I want my problem to be completely solved, I'll still have to manage the PWM signal comming to rear bulbs...

But I agree, for less programming and less mind twisting I could use a relay on bulbs I know that don't use PWM...

I am suggesting an AVR architecture not ARM. A Nano, Pro-mini, micro or a lose Atmega 328p or 32u4 or even an ATtiny processor. It depends on how many signals per unit you want to control.

They are but how many PWM signal;s are you trying to confirm ?

There is no either or in this case. My suggestion is to use opto-couplers on the input side of the MCU to separate the MCU from the car, and use mosfets on the output side to drive the bulbs.

Only the first thing ! , mind you, you will still have to filter the power the MCU.

It is a really long sentence saying 2 things at once.

This refers to the programming.

This refers to how to wire up the input signal.

How many signals per Electrical Center ? maybe just 2 boards would be the best. If the number of signals on the rear would be less than 10, you could use a single pro-mini (or nano) to do the whole thing without to much issue. It does depend on the nr of PWM signals.

For normal HIGH / LOW signals, the notion is simple. You 'Poll' the input, and only switch the output is the input has been active for a period longer than that 100ms test signal (or however long it reads active at the input)

[quote="Smajdalf, post:8, topic:959473"]
You don't need to read the PWM. You just need to determine "something different from test signal" is being sent and turn on the LEDs. For this some simple logic should be enough.
[/quote] Issue is that the test signal is longer than the pulse of a PWM signal, so for those input signals you need to actually measure the pulse length, or at least determine a rough length measurement to distinguish between the 2.

I would increase their value a tad since i am suggestion an opt-coupler + resistor in parallel, which, although much higher in resistance still drops the total resistance.

Sure, you are just going to connect the MUC to the 12v system with all it's spikes.

In what universe ?

So that actually means we are talking about a single input signal that uses PWM. No problem using an ATmega 328P (pro-min or Nano) but even a smaller ATtiny of some kind would easily suffice.

It is not such a big deal programming.

For the main headlamps does it matter how much current is being drawn while it is polling for failure? If yes, Since the bulb is rated for 12V at 60W, its current is 5A and resistance is 2.4 ohms and that is the resistor you need to use. Change this as per the actual bulb wattage. And you might not need a 60W resistor if its not going to be permanently connected - 20W should be fine for just the purpose of switching in when LEDs are not in use (to let the ECU poll it).

If not, then its much easier - just start with a 1k resistor and adjust it as per need.

Ah and now i realize that you will actually not only will need to 'listen' for the PWM signal, but you will also have to determine it's duty-cycle, since that is the duty-cycle that you will have to reproduce on the output line. I am sticking to my suggestion of using interrupts to do so. BTW i did not know that is an approved system, since it means it uses the same signal-wiring-bulb for both the tail-lights and brake-lights. If a single endpoint is faulty that will result in both of those not working, possibly blacking out a side of the car.

Deva_Rishi, thank you for that long reply !

You're right I only have 4 bulbs driven by PWM (Stop lights and Rear Tail Light) as far as I know. but can be considered as 2 cause they light together.

I was already considering a Nano for that usage, tiny and performance is not what's needed there :slight_smile:

About octocouplers, I wasn't sure of how to use them, I was about to use simple resistor on each input which is not a good idea :slight_smile: , octo are much better for safety indeed.

I'll try to anwser your questions and ask you some ^^', sorry I'm a newbie but when I decided to do this I wanted this to be a little challange for myself and a clean solution instead of wires everywhere :confused:

  • 4 bulbs driven by PWM but 2 - 2 lit at the same time. So 2
  • Right ! It's like a RC circuit that filters then. About power supply for MCU I have bought a 9-32V to 12V 4A converter which I think is going to filter aswell.
  • 100 % agree
  • One unit is handling the front and one the rear, it's nano has enough inputs I think.
  • I think it's a misunderstanding, breake + tail light have their own wires and own PWM signals. So if I had hallogen bulbs and break would be faulty I'd know, same for tail light.

Otherwise, It would be rad (It's maybe to much to ask, you already helped me a lot). Could you show me a quick sketch of your idea for coding this ?

Thank you all for you help, I really apreciate

Just a small advise before you jump into it - modifying the car electricals might void road-worthiness of the car (it might fail govt inspections), and warranty too (which probably the car is long out of).

Also, while using microcontrollers and everything to sort of hack into it might seem cool, it may not always be the best thing to do - a much simpler non-microcontroller or ordinary approach may do the job without adding a lot of complexity.

If I were you, I would let the turn, brake and tail lights be as they are, given the way they are driven with PWM and detection and all (not to mention how important these are as warning lights for other drivers and safety as a whole), and just concentrate on the main headlamps as these are the most power hungry component among lights, and it makes sense to replace them with more efficient lights - its easier on the car's battery and charging system. All said, check local regulations to be sure.

BTW, in my own car which does not have this blown lamp detection feature, I have replaced the tail and brake lamps with LEDs, the main head lamps with a HID system (in projectors). I have left the turn lights untouched though.

I understand what you mean, about the safety part... The car is from 2008 so I don't have to bother with warranty. And govt inspections in France are not really annoying like in other countries, they just make sure it works.

But as you say it's "cool", not the way "oh ! cool" but a personnal challange to myself... Which I think if done correctly is not going to be a problem.

I must say that you may be right about turn lights, their signal is specific and might be hard to make. Still here in France it has to be between 60 and 120 beats per minute, which can be simulated quite easily.