simulate this circuit – Schematic created using CircuitLab

I'm using this circuit to detect if a car engine is running. I tested it and it is working however there is some kind of a problem where in my code (running raspberry pi) I see a lot of interrupts regardless of whether the output is high or low. I don't have a scope to tell an exact number but by eyeballing it I can say it's well above the hundreds if not thousands of hertz. My pi blew up like 10 to 15 minutes in after I hooked this part of the circuit and I'm guessing this has something to do with it. Then again there's always the possibility I accidentally shorted something but I'd be thankful if someone with a better understanding can have a look at this before I blow up another Pi.

  • \$\begingroup\$ Your circuit senses what? Where is the input? \$\endgroup\$
    – Andy aka
    Apr 5 '20 at 9:17
  • \$\begingroup\$ @Andyaka input is the voltage from the battery/alternator, which varies between 12.6 and ~14V, I compare that to the constant 3.3 of the raspberry via the divider on the + terminal. \$\endgroup\$
    – php_nub_qq
    Apr 5 '20 at 9:18
  • \$\begingroup\$ And did the LM393 fail to operate after the pi blew up? \$\endgroup\$
    – Andy aka
    Apr 5 '20 at 9:22
  • \$\begingroup\$ @Andyaka I didn't check but without a reference voltage at the - terminal it would always have output at high, or open rather. Still if the frequency of the output was too high for the GPIO pin the LM393 could still function? I don't know if frequency is the right term though as the output is in the same state, but wiggles enough to cause an interrupt. \$\endgroup\$
    – php_nub_qq
    Apr 5 '20 at 9:29
  • \$\begingroup\$ Is the LM393 destroyed? \$\endgroup\$
    – Andy aka
    Apr 5 '20 at 9:57

Are you connecting this directly to the car battery (12.6-13.8) V? You are going to see huge transients on that. The transients will cause unstable operation and/or blow this up.

Try turning on your AC. Probably will see interrupts happen. You need to design some kind of circuit to protect the sensitive electronics from all the large automotive electronics (AC, alternator, crank motor etc.)

Read this article here that explains how brutal the automotive environment is to electronics. TI also has a great article here. enter image description here Image from Lite-fuse Article mentioned above.

  • \$\begingroup\$ That makes sense, I'll try adding a voltage regulator on the Vcc pin of the LM393, I honestly had my doubts about powering it directly from the battery but I thought it's gonna be okay. \$\endgroup\$
    – php_nub_qq
    Apr 5 '20 at 9:20
  • \$\begingroup\$ @php_nub_qq added an article you should read. Even just a regulator is not enough. You may see transients up to 120V etc on the battery. You are going to need surge suppressor, current limiting etc. \$\endgroup\$
    – EasyOhm
    Apr 5 '20 at 19:28
  • \$\begingroup\$ Resistor/Zener diode combination? \$\endgroup\$
    – James
    Apr 5 '20 at 19:33
  • \$\begingroup\$ @EasyOhm thank you very much for the useful resources. The events described there that might cause those high voltages seem highly unlikely to happen though, will take extra care nevertheless. For current limiting I've added a 2A fuse but I couldn't find much information on how I can make my own surge suppressor. \$\endgroup\$
    – php_nub_qq
    Apr 6 '20 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.