Motor PWM causes errors on quadrature encoder

I've run into another problem caused by my robot's head. Right around the time I added this, one of my wheel encoders started acting up, reporting less movement than the wheel actually did, so that wheel run full speed. After much hair pulling, I determined simply unplugging the head motor makes the quadrature work fine.

I spent last night tracing the encoder paths with my oscilloscope, and didn't see anything unusual. I can't see a difference in the signal when the head motor is connected or not, nor between the encoder that works or doesn't.

The encoder is being read in a half-quadrature fashion. Each encoder uses one interrupt on an ATmega16, with the other read on a normal input pin.

While I'm sure I can just add capacitors until it works fairly quickly, I would like to actually find what is messing things up, as a learning experience if nothing else. Can anyone suggest what a next testing step might be (IE, using a freq/dev that is x% of the PWM frequency), or a site with such a methodology --- or "Give up and install caps" :-)

-Chris

Reply to
Christopher X. Candreva
Loading thread data ...

what type of motor is in head? do you have voltage drop in this motor when it is plugged in (but not "activated")?

Rich

Reply to
aiiadict

snipped-for-privacy@gmail.com wrote: : what type of motor is in head?

DC Gear motor

: do you have voltage drop in this motor : when it is plugged in (but not "activated")?

Ooops -- edited this fact out. The motor is being controlled with locked antiphase PWM, so there is a pulse generated even when the motor isn't active.

Reply to
Christopher X. Candreva

The problem was twofold. First, I wasn't useing the scope correctly. As soon as I remembered that AC means "The AC part of DC" and not house current, I saw the +-.5v spikes being introduced on the +5 of the board.

Second -- for some reason I had used .01uf bypass caps instead of .1uf, and they were useless. .1 work, .47 work even better.

I've spent too much time lately looking at the big changes, I forgot how to think small. (Mostly I use my scope as for working on vector-based arcade games, either in XY mode as a vector monitor, or to trace those waveforms, which are about +-20v. I was still thinking big changes, not small ones.)

Thanks to Larry Barello for getting me pointed in the right direction.

-Chris

Reply to
Christopher X. Candreva

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.