Author Topic: Start up and shutdown power controller for in car Pi via OBD ONLY  (Read 5592 times)

0 Members and 1 Guest are viewing this topic.

Offline danbrTopic starter

  • Contributor
  • Posts: 21
Hi all.

I have an idea for powering, starting up and shutting down an in car computer (pi) via constant power and CANlines via the obd2 port only.

I only have access to the OBD2 port and no switched power sources in the car.

My idea builds off this:
http://electronics.stackexchange.com/questions/61877/shutdown-controller-for-raspberry-pi-in-a-car

Instead of using a 12v switched power, "ACC" in the diagram, I would like to use the a CAN line. Hear me out.

When the car is off the CAN data line are inactive, 0 volts, until someone unlocks the car or starts it. When the car is on then the CAN H line become active, idle at 2.5 volts and moving up to 3.75/5v to create a differential with the CAN L line(1.25-2.5v).

Would it be possible to use the CAN H line with input protection(diode) and filtering caps to get a "clean"/"smooth" 3.75 or 5 volts out of the data line to drive the mosfet and switch the relay? This "clean" voltage will then be level shifted to 3.3v to signal a GPIO pin on the board to shutdown the pi when power(can H line becomes inactive/car is off) is removed. Ideally the mosfet would draw little to no current, but i honest have almost no clue what I'm talking about lol.

Does this make sense? Or am I insane?
I am not an EE so assistance is very much so appreciated.
« Last Edit: July 08, 2015, 02:33:58 pm by danbr »
 

Offline Niklas

  • Frequent Contributor
  • **
  • Posts: 405
  • Country: se
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #1 on: July 08, 2015, 03:55:04 pm »
Why not use KL15, 12V switched by key ignition, in the OBD2 connector?

The proposed solution with CAN will most likely cause a limp home or failure to start the car due to CAN errors. A node connected to the CAN bus is usually allowed to have a maximum of 100 pF between CANL and GND or CANH and GND. The absolute voltage levels referenced to GND can also vary from case to case and time to time.
 

Offline danbrTopic starter

  • Contributor
  • Posts: 21
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #2 on: July 08, 2015, 04:05:16 pm »
The OBD2 port does not have a switched 12v, only a constant 12v source.

Would it be possible to use an opto-isolator off the CAN line to somehow drive the mosfet. Should that isolate the driving current from the canbus?
 

Offline Niklas

  • Frequent Contributor
  • **
  • Posts: 405
  • Country: se
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #3 on: July 08, 2015, 05:21:38 pm »
The KL15 terminal might not be fitted in the OBD2 connector in all production cars.

Forget about connecting anything else than a CAN interface to the CAN bus, especially if it is supposed to be connected when someone drives the car. An optocoupler will not isolate the CAN bus, instead it will act as a non-symmetric load to the CAN bus.
 
A 9-pin DSUB connector is often used on CAN interfaces and it is possible to mate with an RS232 equipped device. It will not work electrically, of course. However, you can get spectacular results in a car with the engine running if you connect an RS232 cable to the CAN bus and start transferring a text file...
 

Offline danbrTopic starter

  • Contributor
  • Posts: 21
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #4 on: July 08, 2015, 05:31:46 pm »
Yes, I am already collecting CAN data on the pi.

I do not understand why I cannot use a diode to stop anything from being sent back over the CANbus. The logic could flip a transistor that powers the mosfet to close the relay.

It sounds convoluted, but its the only option I have to start/shutdown the pi without access to a switched source.
 

Offline danbrTopic starter

  • Contributor
  • Posts: 21
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #5 on: July 08, 2015, 09:04:51 pm »
I am crazy an moving onto another idea.

Voltage comparison tripping a relay via a microelectronic.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2865
  • Country: au
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #6 on: July 08, 2015, 09:06:21 pm »
I do not understand why I cannot use a diode to stop anything from being sent back over the CANbus.

The issue is that the CAN bus would need to supply current to "pump up" that capacitor.

For this to have any chance of working you'd have to buffer the CAN signal first (so it has almost zero loading) and use the buffer output to drive your filter / circuit.
 

Offline djococaud

  • Regular Contributor
  • *
  • Posts: 79
  • Country: fr
  • General rule : Simpler is Better
    • Djo Labs
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #7 on: July 10, 2015, 07:57:16 am »
Hi danbr,
If you already are collecting data on CAN bus, so you already have a CAN receiver on the bus ?
So you could pickup the output of the receiver (between the reveiver and the pi) and filter it (to look for activity) to drive a mosfet (the CAN receiver must be powerred by the contant 12V).
Im I wrong ?  ;)
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Start up and shutdown power controller for in car Pi via OBD ONLY
« Reply #8 on: July 10, 2015, 11:27:08 am »
Here is a brave idea: use a CAN-capable microcontroller as a functionality-enhanced CAN to SPI bridge. This microcontroller emulates a MCP2515 (so you don't need a kernel driver in the Raspberry Pi or patching existing software to use a new protocol if you are using the existing CAN-handling code) on its SPI bus interface and have a few extra control lines going to the Pi's serial lines and the power regulator.

When the car is started this microcontroller intercepts the "ignition on" CAN message, pass it to the SPI interface as well as turning the 5V power regulator on feeding juice into the Pi, which starts on its own. And when Pi is shut down on its own (the Pi's serial lines goes into extended period of break condition) it shuts the power regulator down. The Pi have code to properly shut itself down when the "ignition off" message is received on CAN.

This will make your stack work, and it will allow Pi to shut down properly.

BTW, Pi are such a low powered device running it 24/7 on a car battery won't deplete the battery in a few months. With a Pi on your car 24/7 you can add a GPS and a 3G modem and allow you to track your car should it happened to be stolen.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf