Using a ground trigger with Arduino

Thread Starter

Ping pong

Joined Feb 13, 2022
78
Hey, i have a super simple Arduino project in mind that involves using the car door triggers (when the door is opened) to initiate a task.
the car uses a ground signal as a trigger to let the ECU know that the door is opened. when closed there is no current present in the wires. Below is the factory wiring diagram to give you a clearer idea on how this system works.
View attachment Toyota-2009-2010-Electrical-Wiring-Diagram.jpg
Now this project would have been pretty simple to implement, just connect the trigger wires (green, white and brown) to the Arduino and use the internal pull up resistor to stop the trigger from randomly switching when not active. However, this means that when the trigger is not active (aka door not open), there is 5v flowing from the Arduino down to the ECU. This could potentially damage it as there was never supposed to be positive voltage flowing through this wire in the first place.
Kinda stuck as this point as I can't think of a suitable method to use the ground signal without the pullup resistor charging the line with 5v. Can i use a transistor of some kind? I don't really know as I still haven't used them ever and don't understand how they work. Can't think of a way to use relays or optocouplers either without the same problem so don't really know what to do...
 
Last edited:

boostbuck

Joined Oct 5, 2017
517
I'm not very familiar with modern cars, but would a simple blocking diode be sufficient? The only query would be if the ECU can ignore the half-volt drop in the diode.

1708565671334.png
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
I'm not very familiar with modern cars, but would a simple blocking diode be sufficient? The only query would be if the ECU can ignore the half-volt drop in the diode.
That would work yes, however it would require me to cut the wires going to the ECU in order to add the diode in line. I'm not really keen on doing so and want to keep the chopping and soldering to the Arduino end of everything to make it easy to install in the car.
Just like an aftermarket car alarm system, where you just tap into the door trigger wire and you're done.
 

geekoftheweek

Joined Oct 6, 2013
1,219
On a switched ground system there will be a voltage on the wire when the switch is in the open state. Instead of adding the diode in #2 just monitor the voltage. Assuming 5V from the ECU when the door is closed there will be 5V present, and when the door opens it will drop to 0V. There is no need to add any additional voltages / power unless your addition somehow draws too much power and triggers the ECU.

Then it's going to take a totally different approach.

Find the wires / switch and measure the voltages for both the open and closed states and you will see it.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
On a switched ground system there will be a voltage on the wire when the switch is in the open state.
Wow, that is exactly the case! Just tested with a multimeter and it does supply voltage through the wire when the door is closed.
The wire gives a reading of 5v when the door has recently been closed, resting at around 2v after a few seconds of the door being closed.
You just made my day. Thank you!!!
 

BobTPH

Joined Jun 5, 2013
8,996
Even if that were not the case, a weak pull up could not source enough current to damage anything. It is probably in the range of a uA.
 

geekoftheweek

Joined Oct 6, 2013
1,219
Wow, that is exactly the case! Just tested with a multimeter and it does supply voltage through the wire when the door is closed.
The wire gives a reading of 5v when the door has recently been closed, resting at around 2v after a few seconds of the door being closed.
You just made my day. Thank you!!!
The ECU is already doing what you described in the original post by adding a pull up. It's commonly known as an open drain circuit. Actually in most cars produced since the first addition of interior lights had the dome light operated from a switched ground. The only difference is now it's a signal from the ECU that is used to sense if the door is open rather than actually grounding the lights to turn them on.

Is the behavior you described with the key on or off? Many CAN based systems go to sleep after a few moments of inactivity instead of a hard power on / off as in the old days. The 2V may be a sleep voltage, or a power saving pulse that may cause false triggers if you aren't watching for it. A meter will average out say a 40% on 60% off 5V signal to around 2V.

I don't know the specs of a nano off hand, but 2V may be too low for a "high" input and you may need another method to hold the nano at a high input level. There are a few ways of going about it so test your idea before doing anything permanent.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
The 2V may be a sleep voltage, or a power saving pulse that may cause false triggers if you aren't watching for it.
Exactly. with the key in the off position, the triggers initially start at 5v but after about 5 seconds of the trigger getting active, it drops down to 2v, entering its power saving mode as you said. Did test it with the Arduino and 2v is definitely too low for it to register properly. I plan on using an optocoupler instead. with a 100-200ohms resistor on the led side, it should run fine at both 2-5v. Haven't tested it tho but will do before finalizing the design.

Btw should I be sharing the optocoupler schematic that i came up with here to ask questions related to it or make a separate thread?
 

geekoftheweek

Joined Oct 6, 2013
1,219
Btw should I be sharing the optocoupler schematic that i came up with here to ask questions related to it or make a separate thread?
I would say to start another one.

Also I wouldn't count on that wire being able to run an optocoupler. Chances are it may draw enough current to either make the ECU think the door is open, or the wiring is bad and it throws a code. More than likely if it does have a negative affect it will be the ECU just thinks the door is open all the time.

A couple of other options are to use a comparator to trigger at say less than 1.5 V, or use the ADC (if the Arduino has one) to measure the voltage of the wire instead of an off / on signal. You can then program it to say anything less than 1.5V and the door is open, and anything above the door is closed.

There are several different ways to go about it so don't let me discourage what you have in mind so far. Post it and see where it goes... I may not be considering something you're planning.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
A couple of other options are to use a comparator to trigger at say less than 1.5 V, or use the ADC (if the Arduino has one) to measure the voltage of the wire instead of an off / on signal. You can then program it to say anything less than 1.5V and the door is open, and anything above the door is closed.
Yup, i did consider that as well, comparing the voltages to act as a trigger, however I'm pretty sure that'll cause a greater power draw as Arduino would have to constantly run the calculations to read voltage state.
As far as the optocoupler is concerned, it'll probably draw less than 20ma from the line. if not, i could just use the ground signal from the door instead with the trigger wire connected to the cathode side of the opto led like this:
1705856163803.png

Here is also the complete schematic with the door trigger connected to the anode. Looks like a complete rats nest but that's the best I could do :)
Optocoupler_schem.png
 
Last edited:

geekoftheweek

Joined Oct 6, 2013
1,219
Yup, i did have that in mind as well, comparing the voltages to act as a trigger, however I'm pretty sure that'll cause a greater power draw as Arduino would have to constantly run the calculations to read voltage state.
I had considered that also, but didn't mention it as I don't have the specs on hand and wasn't sure if it was going to be enough to worry about.

Now that I see what you have in mind it's actually quite simple. I'm not an expert by any means, but from what I know it should do the job.
 

geekoftheweek

Joined Oct 6, 2013
1,219

Thread Starter

Ping pong

Joined Feb 13, 2022
78
I don't know what you are planning on for a converter, but if it isn't designed for automotive use look into load dump protections. https://m.littelfuse.com/~/media/el...e_load_dump_standard_application_note.pdf.pdf

Normally a TVS diode or some sort of clamp on the input side is needed.

My apologies in advance if you have covered this... I just get overly cautious when dealing to automotive stuff.
i did previously use a mini360 buck converter in a somewhat similar project but will look into this document as well. This load dump is completely new to me.
 

geekoftheweek

Joined Oct 6, 2013
1,219
In all reality as long as you aren't jump starting other people you are mostly safe as that is the biggest cause. There is still the fact automotive electrical systems are extremely noisy and prone to spikes and other strange things that can cause a lot of headaches or damage if not accounted for.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
In all reality as long as you aren't jump starting other people you are mostly safe as that is the biggest cause. There is still the fact automotive electrical systems are extremely noisy and prone to spikes and other strange things that can cause a lot of headaches or damage if not accounted for.
Since you are pretty knowledgeable when it comes to car electronics, I'd love to share the project with you and get some of your input on it as well.
So basically, you know how modern cars come with a feature called going/coming home where it keeps the car lights on for a few seconds after you turn off the car to illuminate your path at night, well my car didn't come with it. I plan on implementing it by using the Arduino hooked up to two relays, for parking and low beams.
previously i used a time delay relay module sold on ebay that helped me achieve this task. but i had connected that in such manner that only the parking lights would turn on, both at day and night.
With the help of an LDR, i would be able to code the Arduino in such manner that it turns on parking and low beams at night or in dark when i lock, unlock and open the car door.
The relays will be connected to the car headlight switch, which basically works on the same principle as the door switch. there are two wires, a positive and ground. when the light switch is turned on, it connects both wires together and turns on the specific light.
Furthermore, I plan on adding auto headlights as well in a similar manner. when the ACC is high, that would activate the auto headlights function, but when ACC is low, the coming home feature would kick in.
 

geekoftheweek

Joined Oct 6, 2013
1,219
Unfortunately some of my knowledge is gained through reading and not from doing so I may be overly cautious at times. I have worked on my own vehicles my whole life and was a semi / trailer mechanic for 10 years so I have seen my fair share of electrical work there.

Your project sounds like something very useful really. When I worked second shift and came home after midnight it was a pain at times to find the house key and get in at times. I came up with some custom LED porch lights using a PI and some repurposed solar landscape lights to light my way. Never thought to try adding something like this
 

Thread Starter

Ping pong

Joined Feb 13, 2022
78
When I worked second shift and came home after midnight it was a pain at times to find the house key and get in at times.
Lmao exactly. It's definitely a pain in the butt to find the key hole at night. My previous implementation with the relay module did help see me at night pretty well. Just trying to update it now and make it kinda more OEM.
The parking lights turing on during day time everytime I locked/unlocked the car wasn't really a cool look.
Anyways you have been of great help. Thank you!
 
Top