I've been racking my brain over the best way to do this for a few days now, and you guys are a lot smarter than me, here's the situation:
Backstory:
We converted our car to electric, a 24V Nissan Patrol. We decided to switch to 12V due to ease of sourcing components.
Now the harnass is all still the 24v wires which means, double the current through said wires. Eventhough I'm sure the super rugged and overbuilt Nissan could handle it, I think a CAN bus conversion would be fun, and useful for checking the bulbs on our terrible trailers.
I came up with:
A custom PCB with some microcontroller (probably STM32 or Atmega32u4)
17 MOSFETs (4 for left, 4 for right and 5 for trailer, I chose 1 per bulb for future flexibility/fun animations etc)
And some sort of resistance or current measurement to notify the driver of any broken bulbs.
In the spirit of the vehicle being a Patrol, I want to do this as foolproof as possible (I primarily have overvoltage and over current scenario's in my mind), but still as simple as possible (price isn't as big of a concern within reasonable limits). So in the spirit of that I sourced an aluminium ECU type case with some fake ampseal connectors I can use to wire up every light and the trailer plug.
(I thought giving as much information as possible would be helpful in case I'm overseeing something huge here)
TL;DR
I have a MOSFET controlling a lightbulb, and I want to be able to detect if said lightbulb goes out, in the most unbreakable way possible.
This is hard to answer as we have no idea of your experience both electronic and automotive. It appears resources are not a problem which is good. What is the structure of the vehicle systems like? Is this vehicle going on the road, if so what are your local and federal regulations. You are working with safety circuits and there are a lot of laws governing them. Also consider the liability if these fail or somebody gets injured or killed. You need to define under and over voltage. Most existing US vehicles will operate from about 6V up to 24V for a short time the exact value OEM and model dependent. You might want to take a step back and properly define your problem. Currently it looks like you have chosen parts (solution) looking for a problem.
Probably the easiest is measuring the voltage from drain to source of the fet when the lamp is supposed to be on using a analog to digital converter. But that is assuming the fet is working and the pin on the micro is also working correctly. You would need a voltage divider for the adc and
the voltage divider will also act as a pull down if the filiment burns out so you would measure
0 volts or so when not working.
Hi,
If you use a low side MOSFET to switch the bulb.
All you need to do is monitor the drain of the MOSFET and see if it is at battery potential when the lamp is OFF.
OR
A current sense resistor in the source circuit to detect when the lamp is ON.
I want to dictate that based off what is most rugged, both seems unnecessary. But if there's a circuit that can handle reverse polarity, short circuiting, spikes of a 100v, and the other one breaks at 12.9V, then I know my answer
This comment is exactly why I want to make this as rugged as possible, we currently don't have laws concerning the internal circuitry of a car (aka do whatever you want as long as your lights work) but if we ever sell this thing, it will go to some hillbilly offroad fanatic. He will absolutely not care or know about any sensitive circuitry etc
In the first instance the drain should be pulled high when you have it turned off, so if you don't detect any voltage, then someone has swiped your globe or its blown
In the second instance when you turn on the globe you should detect a volt drop across the series resistor.
In the first instance you can tell if you have a lamp problem without having to turn it on.
You may need a high value pull-down resistor.
This is the fun part, you will have to experiment.
That makes a lot of sense, smart thinking.
Do you think the microcontroller will detect the (in the case of a broken bulb) floating pin? Or should I add a very high value pulldown resistor?
Just a bit of information. We all know low side switching is much less expensive than high side switching. The reason for the bulk of automotive OEMs to use high side switching is incase of a short. For example assume your airbag triggers with a low side switch and that wire rubs and shorts to ground!!! If it were high side then nothing would happen except possibly of blowing a fuse and lighting a fault indicator.
A trick for sensing loads is to place a resistor in series with the load, it can be switched with several others so there is no off current except during test. You turn them on and when the unit is operating simply turn it off for a millisecond, read the voltage and turn it on. at that point you know if the load is open. You do not have to do this every second.
Or if using high side switching, still monitor the drain of the P-CH MOSFET, just check when MOSFET is turned OFF, that the drain is at near gnd potential.
Sound reasoning there.
I've also noticed they also use a lot of relays vs other switching methods. Is this for ease of repair/ replacement or is it about reliability?
Interesting, but I have a few questions on how to implement this.
it can be switched with several others so there is no off current except during test.
others?? off current?
You turn them on and when the unit is operating simply turn it off for a millisecond, read the voltage and turn it on. at that point you know if the load is open
Could you elaborate? I don't quite get how this would work.
It took a long time for Automotive to accept solid state devices, even transistors. Automotive OEMs (Origional Equipment Manufacturer) may make several million of the same device and A failure costs a lot of money in a recall.
Ten years ago failure was measured in ppb (parts per billion), probably now trillion I do not know for sure. At that time they had zillions of hours of reliable operation over many years behind them with relays, they work why change them. No so with MOSFETs, just primarily the vendor's word.
Several things entered into it, cost, weight, reliability, and many more. Electronics did bring features that were inexpensive and profitable to sell. The more they used the more reliability data they had proving they were OK. They used more and more. I believe discounting the radio which was not that reliable years ago (they were tubes) there was a transistor in the ignition system. I remember when cars had 1 microcontroller in it. Reliability enters into in the design as well, the vehicle electrical system is one of the worst to design electronic parts for. Relays survived transients, electronics don't. To qualify a part for automotive is extremely difficult and expensive. Not all OEMs have the same requirements so that was even expensive doing all the testing.
Testing for failed lamp Assume a low side switch. Use an NPN transistor with maybe a 10K connected to the load, same point the output MOSFET or whatever would be connected. To test you would turn the the transistor on MOSFET off . Then read the output voltage. Turn The MOSFET back on and the transistor off. If the reading was high the lamp is good, if low it is bad. The resistor compensates for stray wiring capacitance etc. This can be accomplished with ICs and or microcontroller. If you work with 8 bits you can read eight at once. With tungsten the light will not noticeably even blink. When and how often you test is up to you. You can also test before turning anything on, just read the value with the resistors on. Hopefully this helps.