I have a small project i've been working on to control the offroad lights on my jeep with an arduino,
Im using a arduino mega, and 4x VND5025 High side drivers ( Each has 2x switching <15amps )
Im using these and the arduino to replace the relays and fuses, more for a project than anything.
What i need help with is some of my switches switch to ground and some send 12v out,
I want a way of making it software configurable on if the input is triggered by being pulled high with a voltage divider, or low being shorted to ground.
Whats the best way of doing this? attached is what my first version used but now i want to make it software configurable
i have never really done any electronics project and this seemed like a fun way to learn
Have I got correct. Your problem is not the high side driver, it is simply reading your switches, some of which deliver +12v when in the "On" position and others which short to ground in the "On" position ?
You want to define in software how to handle each switch.
A low side switch, that is one which shorts to ground when switched "on" requires a pull up resisitor.
A high side switch, that is one which delivers 12 volts when switched "on" requires a pull down resistor.
Not all arduinos have a switchable pull down resistor.
My first thoughts would be use jumpers to set a pull down resistor for the high side switches and use digital pins for the inputs.
Alternatively, use the analog pins, putting the switch output and the input pin in the middle of a voltage divider and testing the voltage to determine the position of the switch.
What you do is configure the LED input of the opto to work with a gnd circuit or power circuit.
The Phototransistor in the opto is then connected to the appropriate Arduino input.
DuchessAus:
I have a small project i've been working on to control the offroad lights on my jeep with an arduino,
Im using a arduino mega, and 4x VND5025 High side drivers ( Each has 2x switching <15amps )
From what I see in the datasheet that driver has internal current limiting, and you are driving
presumably large halogen bulbs?
There's a risk in trying to power tungsten bulb with a current limiting device - it even can lockup
in a low voltage state.
Tungsten bulb filaments have about 10 to 15% of their hot resistance when cold.
So a 100W 12V bulb will take 8.3A once hot, but starts off wanting about ~ 60A inrush current.
Limit that inrush substantially (say 10A) and there can be issues:
With a plain fixed current limit the bulb may take quite a while to heat up during the current
limit, as the power to the filament is a lot less - this might be annoying if the limit is set too
close to the actual normal current. It will also mean the current limiting device will dissipate
lots of power during this process, probably requiring a heat-sink as we are talking 100's of
watts.
If the current limiting has any kind of fold-back, the bulb may simply never get to glow at all
even if the limit is well above the normal operating current, as the foldback will see the low
resistance of the cold filament and drop the voltage too.
The diagram looks weird to me. Without D1 it won't work for switch to GND, and with D1 the output cannot become higher than the two diodes forward voltage and a switch to GND is ineffective.
Your ground detection circuit will hold the Arduino pin at a constant 1.4 volts or whatever the voltage drop is across D1 and the opto led which are in series to ground.
Use two different and separate circuits. You cannot combine active high and active low input detection on the same input pin without some form of hardware switching.
It appears that the OP was hoping to have a single circuit which would handle both a high side and a low side switch, but that would not easily be possible since both types of switch have an open circuit state, but on the high side switch that state means OFF and on the low side switch it means ON.