1
\$\begingroup\$

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

\$\endgroup\$
11
  • \$\begingroup\$ I assume this motor has an ignition coil. How is this implemented? \$\endgroup\$
    – Jens
    Jun 23, 2022 at 13:25
  • \$\begingroup\$ Show your layout. \$\endgroup\$
    – winny
    Jun 23, 2022 at 13:26
  • \$\begingroup\$ @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. \$\endgroup\$ Jun 23, 2022 at 13:35
  • 1
    \$\begingroup\$ We need to see the PCB layout. \$\endgroup\$
    – winny
    Jun 23, 2022 at 13:37
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – SteveSh
    Jun 23, 2022 at 13:54

1 Answer 1

3
\$\begingroup\$

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?

\$\endgroup\$
4
  • \$\begingroup\$ 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! \$\endgroup\$ Jun 23, 2022 at 13:50
  • \$\begingroup\$ 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. \$\endgroup\$ Jun 23, 2022 at 14:58
  • \$\begingroup\$ See my answer here: electronics.stackexchange.com/questions/547025/… \$\endgroup\$
    – SteveSh
    Jun 23, 2022 at 17:58
  • \$\begingroup\$ 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!!! \$\endgroup\$ Jun 30, 2022 at 12:09

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.