I am trying to replace the “normal” motors on a robot built with the ultimate kit so that it uses the motors with encoders (I bought the “Encoder Motor Pack”. So far it took me a lot of time to figure out what to do to make them work as they should.
My experience is this:
-
When I first plugged them in (the normal dc motors were working fine, I unplugged them and plugged the encoder driver to port 1, batteries were fresh, demo sketch for encoder is loaded) nothing happened. Only the red LED on the driver lit up. I removed all other cables from the other ports and on the arduino I had the demo sketch “EncoderMotorTestRunTurns”. Motors do not turn.
-
My next guess was that maybe the firmware on the driverboard was missing or corrupted. Or at least the settings are wrong. I found my FTDI adapter and some jumper wires to connect it to the driverboard (4 wires, for RX, TX, GND and DTR). Now I was able to run the PID tuning software, which was able to connect but was showing very strange values ( I have some experience with PID stuff from building quadcopters, and i think values like 2-2-4 will never work). As there is no documentation or recommended values in the documentation I set the values to 0.8-0.5-0 for a start. This made the motors turn on the test function.
Unfortunately the settings for encoder resolution and reduction ratio were wrong as well. Reduction ratio was printed on the motor itself, easy to find. The encoder resolution I had to guess by making the motor turn once and see what value is close to 360 degrees. I got close, but it still overshoots a few degrees. -
I thought this was the solution, but: There is no fuction to stop the motors completely (they can stop turning, but they always are powered and make loud humming noises). For my project this is very bad because its annoying and bad for the batteries.
-
I found some newer looking firmware for the driverboard, which seemed to have functionality to stop the motors completely. I flashed it to the board and changed to the demo skteches called “MeEncoderNew”. Now stopping the motors works by using the reset command. (Yay!)
BUT! Now the “runTurns” command des not work anymore. After checking the code for it I can now see, that the implementation for this function is completely missing. Only the “set motor to certain angle” function is implemented and the runTurns-function is just calling that as well. So now my robot can only drive one turn of the motors back and forth. -
I am now trying to fix the driverboard firmware, but this is quite complicated stuff and I did not really expect things to be so difficult.
Is there an easier way to make the encoders work well? Am I just too stupid? I am not really motivated to rewrite the whole firmware myself