I have two servos and a small motor on a project a Nano and a dc power supply. The motor has its ground switched by a transistor and runs off unregulated 12V while the Arduino runs off a 5V switching supply which draws from the 12V supply. There's 2F of capacitance on the 12V side and another 1F on the 5V side so power is pretty stable when the motor switches on and off.
The switched ground wire for the motor runs about 3' directly alongside the control wires for the two servos whose control wires are twisted together.
Even with the servo control wires disconnected at the Arduino end, but with power available to the servos, the running of the motor causes the servos to go to zero positions. Has anyone experience with control signals being induced from such an arrangement of wires traveling alongside each other? I put a scope on the disconnected wires (still running alongside the switched ground wire for the motor and still attached to the servos) and could see noise on the order of maybe 2-10 mV on the servo control lines when the motor is running. The code at this point is not referencing the servos at all, they just have power and no signal.
To be further clear, even when the servos are fully wired, attached and given a signal, the powering of the motor causes interference in their positioning.
Sample code below. I really just want to know if anyone has experienced interference in control lines that might explain this. Thanks much - Mark M.
const int propPin = 9;
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("entering setup");
pinMode (propPin, OUTPUT);
}
void loop()
{
//prop run
Serial.println("Entering prop run");
digitalWrite (propPin, HIGH);
delay (2000);
digitalWrite (propPin, LOW);
Serial.println("exiting prop run");
delay(1500);
}