last day (15 days later) » 

10:41
1
A: Switching 12V vehicle headlights with Arduino / Mosfet combination

Christianidis VasileiosI would say yes to your last thought. Just keep those two separated from the whole circuit and hook your arduino and mosfet there. Keep the connections from the rest of the circuitry as little as possible. For example you can take the output from this "LIGHNING SWITCH" and use it as an input to ...

Yeah the more I dig into these things the more I appreciate how complex these things are, and how much thought and planning went into it - and how far I am from that methodical approach :D separating the circuit for headlights is good approach - what would be the problem if I went with pMos, logic level?
Thanks a bunch for the detailed explanation! I'm looking at the wiring diagram...and the idea of separating headlights, what about actually tapping into headlight wires, just before the bulb connectors? Unplug the headlight relay and run two nMos from the headlight grounds?
something like this - i.imgur.com/gndCPCU.jpg
Bad idea to interrupt the grounds. By doing this you open up the possibility of ‘sneak circuits’ ie paths that aren’t obvious. The positive side is switched for a reason. I’d suggest using automotive relays and using small mosfets to drive the coils. One thing to note - the fuses protect the wire. If you short your average piece of wire across your battery (not suggested you do this) the wire will melt and smoke. You don’t want this to happen. So use a fuse or ensure your power is via a fuse and the wire is rated for the fuse current.
@Kartman the more you know! Thanks for the heads up, yeah my idea of tapping into the back of the bulbs is a total hack approach. Damn. On the vehicle there are "old school" relays from the OEM specs 20 year old things, is there perhaps a newer "faster" relay to replace these OEM units - is it ludicrous to think about solid state relays instead of "common ones" - or do you just suggest pinging the existing relays with mosfet arduino combination? It does sound like the simplest approach, but for whatever reason I always think of relays as "slow"...but then again I'm a newb :D
Slow? Do you want to run pwm in order to vary the brightness or just turn the headlights on and off? Mechanical relays are hard to kill, mosfets in the other hand need protection. Infineon have some nice high side switches that might suit. They even have four of them on an Arduino like board. That would take care of the evil you face.
@Kartman I will look into the high side switches then, seems like isolated breadboard tests and actual 12V vehicle circuits are two different things :D My main concern is keeping the functionality the same - for example the Passing switch - it triggers the high beam light as long as you keep it pressed. If I want to have this function controlled by Arduino, how would I make use of 12V signal there...or perhaps another idea would be to rewire that button so it's connected straight to Arduino, remove it from the original 12V loom. I got a lot of homework to do :)
10:41
If all you want to do is turn the headlights on and off, use relays. For the passing switch - relay. The relay contacts across the switch. Have the Arduino control the relay via a small low side logic level mosfet. In my part of town we have a number of auto dismantlers - we pay $2 to get in. Exit with a pocketful of bolts, lamps, fuses and for you, some relays.
I will look into the actual circuit on the bike and test with Arduino, my only concern is how to actually drive the signal from the switch to the Arduino, if I'm correct that is how the sequence will go; press the "Pass" button, input that signal into the Arduino, execute code from that signal, output it from Ardu to the mosfet gate to the relay. But if 12V is on all those wires I need to figure out how to make Arduino intercept that signal and get it down to 5V.
what are you wanting to do? What value is the Arduino adding to all this?
So one of the functions I coded is to have that "Passing" switch work automatically - at the moment its a very "manual" type of switch, you press it, light comes on, release it, light is off. I coded and tested with mosfet how to have the LED bulb go on-off 2 times automatically with a single press of a button. This is what I'd like to achieve with this - have the "Passing" pushdown button on the bike trigger the Arduino code that starts the automatic on-off sequence.
As I'm learning all of these things, I found out logic level nMos would be ideal for this in conjunction with Arduino - and it worked easily on the test bench - however making it work within the bike wiring is another challenge
 
2 hours later…
12:24
you need 2 x 10k 1/4W resistor, 1 x 22k 1/4W resistor, 100nF ceramic capacitor, logic level mosfet, 1N4004 diode and a relay.
https://electronics.stackexchange.com/questions/43498/how-can-i-use-a-12-v-input-on-a-digital-arduino-pin
R1 = 22K, R2 = 10K. 100nF capacitor across R2.
https://i.sstatic.net/Igdet.gif
resistor is 10K. diode is 1N4004
12:43
Ace! I'll look into it, thank you for your time and help! I just need to read more about this, to learn, and to be sure these things are safe in 12V environment like a vehicle, I know the voltage can jump to 15 on rare occasions so the 5V arduino has to be bulletproof signal. I did see an article on optocouplers for this purpose, would you think that's also a good solution for this?
optos are useless. you rarely see an opto in an automotive environment
use Fritzing or similar to draw the layout. That way we have something to work from
I'm GMT+11. Time for bed.

last day (15 days later) »