I've got a solder-less bread-boarded prototype microcontroller with a few I2C devices that take some measurements on a motorcycle. For now, The MCU is powered by a LM7805 with decoupling caps near the device from a 12v source. The devices are working fine when the power is on, but when the engine is started the I2C devices become unresponsive, but SPI still works just fine.

There are only two wires which are connected between the MCU and the motorcycle. 12v power and ground. The rest of my devices are isolated.

How do I diagnose the issue? I've got a very basic scope, logic analyzer, and a nice multimeter. Where should I begin? What other information can I provide?

Is there any kind of filtering that I can try? Maybe Some type of Low-Pass Filter on the 12V feed?

Update: Per the comments and answers, it seems that the engine running engine is introducing some type of noise which is causing the issue.(I suspect the charging system/alternator, but I can't say). Also, with my lack of a pro-grade oscilloscope, I am unable to actually see the noise. Some possible solutions are:

  • ditch the breadboard for a PCB
  • better power supply/filtering
  • I2C Bus isolation
  • All of the above?

Update: I was thinking about some comments and EMI and remembered that the device worked when I had it on the bench but still connected to the motorcycle with the engine running. I had the breadboard fixed to the top of the gas tank and the I2C bus was not working. So, I just lifted the breadboard off of the gas tank about 3 inches above and the I2C bus became responsive after a power cycle of the system. When I moved the breadboard slowly back down toward the tank, the I2C would get corrupted! Note: The ignition coils are just beneath the tank as well.

So, is this an EMF/EMI issue? How Do I mitigate this?

Are there any low cost, easy to implement, low noise regulators that I could try instead of the the LM7805? What simple things could I try to fix this?

I've designed a PCB, but hesitant to order/make one unless I know this it's going to work in my case. Is there any type of PCB peer review where I could get an "OK" on my design?

  • 1
    \$\begingroup\$ You have spikes on the lines when the engine is started. It is either hanging the MCU totally, or hanging the I2C device or corrupting the I2C communication. Try connecting the setup when the engine is already started. Then work on a solution to clean up the power supply. \$\endgroup\$ – Eugene Sh. Aug 25 '15 at 21:21
  • \$\begingroup\$ @EugeneSh. That would not fit the SPI that keeps working. \$\endgroup\$ – Asmyldof Aug 25 '15 at 21:26
  • 1
    \$\begingroup\$ @Asmyldof It may kill the I2C state machine, for instance. Either on the master or on the slave side. It's just a possibility. Anyway, connecting to an already running generator will indicate whether this is a momentary spike, or continuous. \$\endgroup\$ – Eugene Sh. Aug 25 '15 at 21:29
  • \$\begingroup\$ @EugeneSh. I tried connecting after the egine was started and I2C fails, SPI still working. \$\endgroup\$ – GisMofx Aug 25 '15 at 21:34
  • \$\begingroup\$ So the problem is a continuous noise, not a spike at the moment. \$\endgroup\$ – Eugene Sh. Aug 25 '15 at 21:35

Start by hooking up the scope to your MCU's 5V power. First look in DC coupling, then look in AC coupling for the real fun view. For the mostestest (tm) fun, also look at the incoming "12V" at least once.

Motorvehicles are extremely noisy things, the power rail can contain noise many times more than a simple linear regulator and a few caps will solve. In fact the spikes in a motorcycle or car can go so high (or low) that they may break a simple 7805 if it's not protected by a MOV, a filter and reverse protection diode. (The diode will also act as a sort of filter with a 100uF or higher cap).

I2C is very sensitive because of its pull up resistors and a reasonably high capacity in the breadboard as well that couples in noise too.

Also: Vibrating contacts on a running motorcycle. Solderless + vibrations = not good.

  • \$\begingroup\$ I hooked up the scope to 5V line and it seems pretty really flat. I may not have enough resolution on my scope.Is there something I am looking for on the scope? \$\endgroup\$ – GisMofx Aug 25 '15 at 21:57
  • \$\begingroup\$ @GisMofx What kind of scope at what settings? \$\endgroup\$ – Asmyldof Aug 25 '15 at 22:36
  • \$\begingroup\$ A scope that runs off an Arduino... \$\endgroup\$ – GisMofx Aug 25 '15 at 22:39
  • \$\begingroup\$ @GisMofx that is very unlikely to give you any kind of response in the domain of spikes. Your I2C will be running at 100kHz or 400kHz, probably and the spikes will run at 10kHz to 10MHz or more. The 80V spikes that can sometimes happen on motorcycle rails can last for only fractions of a microsecond, your 'duino will not notice that at all. \$\endgroup\$ – Asmyldof Aug 25 '15 at 22:44
  • \$\begingroup\$ I would agree. It's good for about 7Khz. :/ Are there other regulator setups that I could try? \$\endgroup\$ – GisMofx Aug 27 '15 at 0:51

Use the scope on the I2C bus. Ground your scope to whichever side of the isolation you're looking at. Once you verify that your signals are real, you can switch to the logic analyzer.

How are you isolating?? I2C is a bidirectional bus. They do make isolators to handle this. I'm just making sure you're using one.

  • \$\begingroup\$ I don't think I have a specific device that isolates the I2C. I suppose the 5V pull ups "couple" the i2c bus to the PS. \$\endgroup\$ – GisMofx Aug 25 '15 at 21:50

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.