Ford02zx2
Posts: 4
Joined: Sat Dec 05, 2015 8:06 pm
Location: Pittsburgh, PA

sensing high dc voltage

Sat Dec 05, 2015 8:38 pm

Hello everyone.
I am considering starting a project and would like some input.
This would basically be a simple security system on my car. The basic idea is you would activate a momentary switch before starting the car. the car would run indefinitely until the door is opened. after the door is opened the vehicle runs for a set time then shuts down. Most of this I have seen is easy except the PI seeing the door open.

What I need is a way to see the voltage from the door ajar switch as a "on or off". It doesn't need to know there is 12 volts, just that voltage is there and start the timer to interrupt power through a relay.

I love my cars and love the idea of a DIY security system on it which is why I've always wanted to do this. Before considering the pi the only way I could do this would involve a bunch of regular relays, latching relay, and a timed relay. I've only been considering a PI for a few days so i'm still not 100% sure it can be done. If I can figure this entire project out it will really jump start my whole carputer project as well.

Thanks for any input everyone.

Also if anyone thinks this type of security system is familiar please chime in with some info on it. My old jeep gave me the idea. I always assumed it was a little box under the dash that said "awgbu watchdog". I've only ever found one other person in America who ever heard of this type. That means theres only 2 people I know that could start my car if I do this.
If that isn't safe I don't know what is!

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: sensing high dc voltage

Sat Dec 05, 2015 9:58 pm

Pi is overkill, this could be done with a micro (arduino) or even a custom circuit.

But hey, solving problems the 'right' way isn't always the 'best' way... or something like that :-)

Car electric systems are _NASTY_ environments with lots of noise, droops, 60+V spikes...
Don't skimp on the powersupply, get on that has decent filtering (i.e. don't just use a USB phone charger plugged into you cigarette lighter).

As for sensing the door-light (assuming you have a simple car with a 'fridge-light switch' directly running the bulb rather than some modern CAN-bus monstrosity) is simple enough, just use a resistive divider to bring the voltage down to a safe level and hook it up to a GPIO pin.
Ideally use an optocoupler, but failing that at least add a capacitor and clamping zenner diode to protect your precious Pi.

Ford02zx2
Posts: 4
Joined: Sat Dec 05, 2015 8:06 pm
Location: Pittsburgh, PA

Re: sensing high dc voltage

Sat Dec 05, 2015 10:46 pm

thank you sprinkmeier. The reason I wanted to use a PI to do this is because it fits in with my plans for the car. (which is making a high tech but low budget car) unless anyone else knows of a easier way to do what I need (such as a sensor) I'll probably work with what I know.
I assume I could use a relay energized by my door switch to close a circuit, which the PI could see. I would assume as long as I'm dealing directly with the PI it is safer to use a closing relay instead of applying power to it. especially for an amateur.

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: sensing high dc voltage

Sat Dec 05, 2015 11:07 pm

The relay is a good idea for isolating your signal, but don't forget the power-supply.

An optocoupler should give you good isolation as well and it will draw less power off your car-battery.
(it's also much smaller and won't make a tell-tale clicking sound).

https://en.wikipedia.org/wiki/Opto-isolator

Ford02zx2
Posts: 4
Joined: Sat Dec 05, 2015 8:06 pm
Location: Pittsburgh, PA

Re: sensing high dc voltage

Sun Dec 06, 2015 12:27 am

After researching a bit I've decided to research to optocoupler more. If nothing else its a lot cheaper. From what I read to use it you need to use resistors to bring the power to a level it can handle. I'm hoping you could help me with that. I just want to make sure I'm looking at the right specs and my math is good.
if I'm looking at this random optocoupler
http://www.digikey.com/product-detail/e ... ND/3306757
it operates at 50Ma. so assuming my car is putting out 12v I would need a 240 ohm resistor.
if someone could double check and make sure I understand this correctly I think ill be ready to start buying parts.

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: sensing high dc voltage

Sun Dec 06, 2015 1:10 am

Keep in mind that many door switches 'ground out' when activated which means you will have voltage present with the door closed which will drop to ~0V when the door is opened. If your car is more modern with computer controlled everything then I would not attempt to interface to the system at all. I would add an independent door switch or maybe a magnet & reed switch.

Also I would be careful and make sure you design a fail safe system. You do not want the ignition to be turned off at the wrong time should your RPi system fail in some way.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Ford02zx2
Posts: 4
Joined: Sat Dec 05, 2015 8:06 pm
Location: Pittsburgh, PA

Re: sensing high dc voltage

Sun Dec 06, 2015 1:21 am

very good points. I could also get power from other sources if needed such as the door ajar light or dome light. I'll have to pull up the wiring diagrams to see my best choice. I remember a couple of fun drives with my old jeep shutting off. toll roads when I reached out to get them money mostly. and on particularly nasty time when I had a short circuit in my lighting circuit. good times. :lol: I do plan on having a hidden switch that would revert it back to factory though incase of any failures

Return to “Beginners”