1

I'm currently working on a bicycle project where I have mounted a 25cc 2-stroke (weedeater) engine at the rear of a bicycle. I have also created a speedometer (based on Arduino) which is mounted on the handlebar. The problem is that whenever I start the engine, after a few moments the Arduino stops working (presumably due to interference from the engine). The project runs off a 12V lead-acid battery which was attached to the engine's magneto (for charging), but I have since isolated it trying to find what's causing the issue.

I have tried:

  • Electrically isolating the engine from the Arduino project
  • Using a snubber diode on the battery terminals

NOTE: The "Arduino" is a standalone ATmega328P mounted on a PCB.

Here is how it looks like when the Arduino crashes: Here is how it looks like when the Arduino crashes

I have attached a Fritzing diagram you can also have a look at but ignore the engine part since it's no longer connected for obvious reasons.

Fritzing diagram

Project picture: (sorry for the quality) enter image description here

PCB Layout (it's terrible): enter image description here

  • I assume this motor has an ignition coil. How is this implemented? – Jens Jun 23 '22 at 13:25
  • Show your layout. – winny Jun 23 '22 at 13:26
  • @winny I'm not home right now but I have edited the post to add a picture. Sorry for the quality, it's a cropped screenshot. – Lefteris Garyfalakis Jun 23 '22 at 13:35
  • 1
    We need to see the PCB layout. – winny Jun 23 '22 at 13:37
  • @Jens I have no idea. It's a standard weed whacker engine and two wires come out of it so you can add a kill switch. – Lefteris Garyfalakis Jun 23 '22 at 13:38
  • @winny Sorry, I didn't understand at first. I have posted it. It's not really good but it works reliably when the engine is not turned on. – Lefteris Garyfalakis Jun 23 '22 at 13:43
  • 1
    2 cycle engines generally have a magneto, not an ignition coil. This is a magnet attached to the top of the motor shaft (where the starter coil goes) that passes by a coil when the shaft rotates to induce the high voltage for the spark plug. But the problem of radiated emissions that may cause the Arduino to shut down would be similar in both cases. – SteveSh Jun 23 '22 at 13:54
  • Indeed. EMI issue would be my first guess. You need a ground plane and strong decoupling to survive that. – winny Jun 23 '22 at 13:56
  • So you think that the decoupling I have implemented isn't enough. Right? Does that also mean that I have to redesign the PCB in order to add a ground plane? – Lefteris Garyfalakis Jun 23 '22 at 13:59
  • @SteveSh I agree with you. In my case the spark plug wire has been replaced which might worsen the issue. Should the engine somehow be shielded? – Lefteris Garyfalakis Jun 23 '22 at 14:01
  • Do you have common mode noise or differential mode noise? Or do you have both? Can you add some oscilloscope traces for us? – MicroservicesOnDDD Jun 24 '22 at 17:04

1 Answers1

3

Are you sure it is the microcontroller that is crashing and not just the I2C comms to the LCD getting corrupted with noise?

I can't see any pull-up resistors on your I2C bus in your schematic, so this could account for your issue.

See for example - Is there a correct resistance value for I2C pull-up resistors?

HandyHowie
  • 4,030
  • 1
  • 15
  • 22
  • I must say, you raise an important point here. I'm going to use the on-board beeper and make it play some tones while the engine is turned on to see. That might explain why it doesn't "crash" when I navigate the menu... Thanks! I'm going to try that out today! – Lefteris Garyfalakis Jun 23 '22 at 13:50
  • The ATMEGA328P does have internal pull-ups on those pins, and it is tempting to rely on just that (and will often just work) but they are very weak and will make your communication very susceptible to noise. In these situations I have had success with 4.7 kΩ pull-ups. – evildemonic Jun 23 '22 at 14:58
  • See my answer here: https://electronics.stackexchange.com/questions/547025/why-do-some-pcb-designers-put-pull-up-resistors-on-pins-where-there-is-already-a/547026#547026 – SteveSh Jun 23 '22 at 17:58
  • I am sorry for being so late on this but I had a very busy week. After extensive testing I conclude that your answer is indeed correct. Thank you so much for your help!!! – Lefteris Garyfalakis Jun 30 '22 at 12:09