I’m using the SparkFun [motor driver to run a [12VDC worm drive 40 RPM motor to lift a doll elevator in a Barbie house I’m building for my granddaughter. To track the position of the elevator I have a [600 pulse/rev rotary encoder. Both the motor and the encoder work perfectly – when used separately. The plan is to connect the shafts (with a spool that holds the lift line between them), so I can use the encoder pulses to measure the movement.
When I run the motor, though, without the shafts connected, so the encoder isn’t moving at all, it causes noise on the encoder phase lines, enough to cause some false pulses to register. When the shafts are connected, the resulting pulse sequence is very noisy (as seen on an oscilloscope), and the pulse rate is far higher than it should be, 50% to 100% higher (and highly variable).
I’m powering both the motor and the encoder with 12VDC from the same power supply (currently a bench supply). I’m controlling everything with a particle.io Photon. I’m not using the Photon’s internal pullups because they’re 40k and the (scant) docs on the encoder say 2k is needed. I tried the internal pullups and it seemed to work about the same.
It’s wired as follows (I can create an upload a schematic a little later if that’s needed):
+12V to motor driver VM and encoder Vin
-12V to motor driver GND and encoder GND
Motor driver A01 and A02 to motor.
Encoder phase A to A0, configured as INPUT, with ~2k pullup to 3V3.
Encoder phase B to A1, configured as INPUT, with ~2k pullup to 3V3.
Driver PWM, AIN1 and AIN2 connected to D2, D3, D4. (D0/D1 are used as I2C SDA/SCL for running some other stuff).
I think what I need to do is somehow prevent noise from the motor from leaking back through the motor driver and into the input power on the encoder, but my actual electronics knowledge is sadly lacking (I’m a software engineer, just beginning my remedial electronics education).
Suggestions? Do I need to do something else to more fully diagnose the problem? I have an oscilloscope, as mentioned.
Thanks.](Amazon.com)](Amazon.com)](SparkFun Motor Driver - Dual TB6612FNG (with Headers) - ROB-14450 - SparkFun Electronics)