1
\$\begingroup\$

So I have a microcontroller that will read some of the car's sensor output (0-5v) and i plan to send the signals through an opto-isolator. The problem is that when i simulate this, it seems i cannot connect the car's ground with the MCU's ground. I later learn that this should not be done in an opto-isolated circuit. My question now is, how is this going to work if my MCU is powered off the car's power source?

car's 12-14v & GND -> switching regulator-> 5v -> powers MCU
car's sensor -> opto-isolator-> GND

How can I get it to work without the two GND's coming into contact with each other? Would the 5V regulator isolate the two GNDs'?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Opto isolators can have the same ground on both the input and output side, but then why do you need an opto-isolator? Is your sensor signal digital or analogue? - if analogue you will need some other form of isolation. There is no reason why your MCU can't share a ground with the car - most of the existing electronics in the car will do. \$\endgroup\$
    – Icy
    Jan 12, 2016 at 12:48

3 Answers 3

1
\$\begingroup\$

It seems like you're mixing up things that you don't understand. I think that in your case you can simply connect the grounds together.

"I later learn that this should not be done in an opto-isolated circuit." And do you understand why that is ? There are many cases where this is not required and where it is perfectly OK to just connect the grounds. In other cases it is completely forbidden (mains adapters and other mains isolated circuits). Confused yet ? My point is, such general "do this" and "don't do this" rules are useless if you do not understand the why.

"Would the 5V regulator isolate the two GNDs'?" Only if you're using an isolated regulator which is not needed and too expensive for your application. Note that almost all (non isolated) regulators actually have both grounds shorted ! You could use an LM2596 based switching regulator and it will have only one common ground connection. So no, the regulator will not separate the ground. And like I said, there is no need !

So just get an LM2596 board, connect 12V to input, feed 5 V output to your MCU. Use the optoisolator to interface but connect all grounds together and that should work fine.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Just going to blatantly butt in here to point out that a simple Chinesy LM2596 board will not be automotive-specced. For hobby purposes that's likely a none-issue, but for posterity's sake I think I should point out that its (LM2596 and cheap boards with it) input is not compliant with a car's spikes and load-dump behaviour. \$\endgroup\$
    – Asmyldof
    Jan 12, 2016 at 14:08
  • \$\begingroup\$ Why needed? Because in the automotive electrical environment, the signals get noisy sometimes with a good amount of voltage spikes. \$\endgroup\$
    – DonP
    Jan 12, 2016 at 22:56
1
\$\begingroup\$

Ignoring the question of whether you actually need an optoisolator for the moment, the specific problem you're having in the circuit simulator is that the simulator itself requires a DC path among all nodes of the circuit being simulated — otherwise, the math does not converge on a solution.

The traditional fix for this is to connect a high-value resistor (e.g., 10MΩ or more) between your two "isolated" grounds only for purposes of simulation. It will have negligible effect on the actual solution. You would do this wherever you have an "island" of circuitry that is totally isolated from the simulator's ground (node 0) by capacitors, transformers, relays, optical couplers, etc.

\$\endgroup\$
2
  • \$\begingroup\$ You can also a use a voltage source. I did this for an isolated flyback converter that has the outputs floated around -300V. As you note, there must be a DC return path for the simulator. \$\endgroup\$ Jan 12, 2016 at 14:42
  • \$\begingroup\$ When deployed for testing it in the automotive electrical environment, the signals get noisy sometimes with a good amount of voltage spikes that comes right into the MCU and reboots it. THe other symtom i'm tracking down is that when it reboots it sends a voltage out that goes to the car's ecu, tricking it to believe more air is present than really is. is there another solution for this? Op amps? I'm open to suggestions as this is not (yet) my forte. \$\endgroup\$
    – DonP
    Jan 12, 2016 at 23:02
0
\$\begingroup\$

Nothing in your description explains why you need isolation at all. Connect the negative output of the 5 V power supply to the car's ground. Car signals can now be connected directly to this circuit.

Of course the circuit has to take into account that the signals coming from the rest of the car can exceed the 0-5 V range of the micro, and can have occasional spikes on them. This can be addressed by clamping, a transistor as a buffer, and the like. A opto-isolator can be used as a buffer too, but since isolation isn't required, just a transistor is simpler and serves the same purpose.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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