I am working on an RC submarine with an Arduino controlled ballast pump. The goal: to control the ballast pump with an RC transmitter through the Arduino. The problem: there are interruptions that cause the motor to hitch when running in one direction and not the other. My hypothesis: arcing brushes in the motor cause some sort of interference with the Arduino.
What I tried: I tried adding a 0.1 uF ceramic disc capacitor across the motor terminals to mitigate electrical noise. There seemed to be no effect and the issue persists. I also tried twisting the wires leading to the DC motor.
Observations:
The RC receiver can run servos and a brushless motor with no issue even while these interruptions are happening. I think it's safe to say the receiver is not the problem.
Interruptions cease when disconnecting the motor.
I am looking for ideas on how to fix these interruptions. I'm willing to try different solutions and answer any questions you have. I am an amateur Arduino creator and I look forward to learning about best practices.
Yes. I made this abridged version of the code to eliminate variables. I will try and even simpler version of the code like you suggested and let you know how it goes.
To clarify, the motor "hitches" when it suddenly changes direction during one of these interruptions. In other words, the PWM jumps to 0 momentarily and the motor suddenly changes direction as a result
It must go directly to your system common ground, not through a bunch of circuit boards and connecting wires! You do have a common point where all grounds are connected, don't you?
Your code posted here doesn't use pwm.
If pwm goes to zero, it doesn't change direction of motor.
You didn't answer how it behaves connected directly to HIGH/LOW.
How are you getting the radio signal? Some sort of floating waterproof carrier for the receiver with antenna exposed through a waterproof opening? What wiring from there to the sub? I was thinking CAT6.
I am using a 70mHz RC radio transmitter and receiver. I want my sub to be untethered and lower frequencies like 70mHz perform better through water than 2.4 GHz.