Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Doubt about encoders' power supply


#1

Hi everyone.

I’m working on a project with two encoders, and my program on arduino seems read them, but the thing is that I’m getting wrong odometry information about the movement of two wheels. I’m using these https://www.pololu.com/product/2827 gearmotors w/encoders and this motor driver https://www.pololu.com/product/2507. I think that isn’t necessary to connect green and blue wires for power both encoders, because them turns thanks to motors power.

Also the motors don’t use correctly the power they get. If I set different velocities always one motor is spinning faster than other. And is strange, It occours for both motors (sometimes one is faster and for different velocities, the other), even if I change terminals’ order and power, for different velocities and for forward/backward. By the moment I haven’t another source to supply encoders, nor batteries to try, but one of these days I’ll can.

I hope you clarify me if that’s the problem or what could be. By the way, VDD and 3V3 pins for pololu motor shield isn’t work as supplies because VDD is used for M1EN/DIAG and M2EN/DIAG, and 3V3 isn’t enough for encoders supply (which is 5-20V), unlike GND that should work.

Thanks for your time!


#2

Hello.

The red and black wires only supply power to the motor, so you will need to separately connect the blue (Vcc) and green (GND) wires and supply 3.5 -20V in order to power the encoders.

In general, the speed of each motor can vary unit to unit by as much as +/-10%. It sounds like this could be what you are noticing. If you tell me more about your setup, I can tell you if the variance in speed you are getting is normal. In particular, what speeds are you measuring? How are you supplying power? How much load is on the output of each motor? What duty cycle are you using? (If you are using our VNH5019 library, which values are you using as input parameters for the setSpeeds(), or setM1Speed() and setM2Speed() functions?)

Also, if you tell me more about your setup, like which Arduino you are using and what voltage you are supplying for motor power, I might be able to recommend an appropriate supply for the encoder Vcc.

-Jon


#3

Hi Jon. I’m using arduino mega 2560 as microcontroller, vnh5019 shield and I’m powering arduino trough an usb por from my laptop. I’m supplying the motors with a lipo battery wich brings between 14-16[V] generally (4s1p), and even if the encoders aren’t supplied, they spin together with the motors. They both have gearmotors and in total a load capacity of 36 [kg/cm] which is enough for my robot that weight 20 kg aprox. I’m setting the motor speed through a PID controller on this code
https://github.com/gersonos/Yirsoon_environment_mapping/blob/master/All%20files%20used%20for%20navigation/motors/motor_controller6/motor_controller6.ino
Once is loaded to my arduino I use the keyboard like a joystick by using ROS (Robotic Operating System), which uses this main file for communicating with the motors and do some math for reading encoders.
https://github.com/gersonos/Yirsoon_environment_mapping/blob/master/All%20files%20used%20for%20navigation/motors/base_controller.cpp
By the way, when I use simple codes for set both motors at same velocities like 100, 200, 300, 400, they differ like you said, +/-10-20%. I hope you understand what could be the issue in here.


#4

Thanks for your reply, I hope you let me know what considerations should I take.


#5

The Arduino Mega’s 5V pin is an appropriate supply for Vcc on those encoders. So, you should connect that and then try reading your encoder’s outputs again. Let me know if you are still having issues once you try it with the encoders powered.

By the way, in case you were not already aware: the encoder disk is mechanically coupled to the motor shaft, so it makes sense that it also rotates when the motor is supplied with power. The encoder does not need to be powered in order for the encoder disk to rotate with the motor shaft.

-Jon


#6

Thanks. Now I’m reading both encoders and getting odometry information I needed. So… problem solved :slight_smile: