Arduino acting strange on 50cc bicycle, input getting hit by ac noise

Hi friends, I am a complete electronics noob.

I have an arduino nano on a 50cc bicycle. This arduino measures pulses from; one reed switch on the front wheel and one reed switch on the pedal. It works great in a shop environment when the motor isn't going, but when the gasoline motor is on, the arduino will freeze or act erratic after about 10 minutes of the motor going and me riding around. I then have to turn the arduino nano off and on again and it works fine for a few minutes before doing the same again.

The arduino nano is separated from the bike frame with 4 inches of wood. So I think the issue is definitely the arduino is collecting stray (maybe high) ac voltage (from 50cc motor) on the wires going to the reed switches and causing it to freak out.

tldr; This is my circuit right now. It works, but the arduino hardware becomes erratic after a few minutes of the motor going.

I don't know if my circuit is right to protect the inputs from the motors stray ac voltage? Did I put the resistors in the right place? Do I need a resistor in series with those capacitors to protect my battery ground? Do I need a 1k resistor going to the input? pls help, Im quite the numpty

thanks bros!

Are any wires crossing, or coming near ignition cables?

You could try wrapping the wires in fabric then aluminum foil and then taking that to the bike ground as a shield.

What is the 5v source? A switching PSU that steps down from the bikes supply? Do you have any decoupling capacitors to buffer the input voltage?

Not realy, I went around the motor with the wires to keep distance and also kept most of the wire and arduino seperated from the bike frame by at least 2 inches.

Google said something like that but I'm too numpty to understand the grounding. If I buy a shielded cable, do I just ground the shielding to the bike on the frame in one spot. Would the motor reverse conduct to that shielding through the ground point though? Do I keep the arduino floating or ground it to the frame also?

Power is just from 4x AA batteries with a 5v regulator. I only have tiny capacitors where I drew them in the schematic. Should I add more capacitors or resistors somewhere? I just kind of guessed at how the schematic should be when I first made it, mind you, I am very beginner

Just think of it like having a wire attached to the frame (ground) and you coil that wire around your signal wires. Your wire in this case is the foil and it doesn't have an insulator around it. It acts like an antenna, taking any stray signals back to the bike ground and not into your signal wires.

Oh, and only take it back to the frame at a single point. Making contact at two or more points creates loops and you don't want those.

I don't think you should tie the grounds together.

Solid advice, thanks bro!

Do you think I should add a small 10 ohm in series with the tiny capacitors to prevent stray high ac voltage from going straight to arduino ground?

I saw somewhere they said to add 1k resistors to inputs pins to protect them, is that right? cause my inputs go straight to the wire right now

I'd look at varistors and/or Zener diodes to help with overvoltage protection. Adding resistors wouldn't hurt, but you'll be creating a voltage divider and you want to make sure the voltage to the pin doesn't go too low.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.