Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
No, motors (including servos) are analog devices (only the control signal is digital, and that gets converted to an average voltage by the motor inductance), otherwise you won't be able to control it's speed. Plus, while motors are resistant to noise, the PWM signal you feed it is not, especially for the servo signals where the duty cycle is less than 10%.In anycase, I checked the signals using a scope and both PWM looks perfect when disconnected from the motor. So it is definitely the motor noise messing with the PWM signal to the servo, and not a software problem I also know for a fact that the chip isn't resetting.Maybe I should use some optoisolators? Though i'm not sure I can spare enough space for another battery pack...
@Tsukubadaisei: Since the control signal HIGH is only 3.3V, it was pretty easy for the motor to mess up the PWM signal (a negative spike during a PWM high for example). I checked with a scope, my code was correct (correct timing/length everything).
It turned out the problem was the motor noise. In the end I just decided to have another 4AA battery pack powering the servo and the microcontroller. The motor is driven with 12V from the main supply. Works well so far.