Problem with DHB-10 Encoders and Motor.
How does the DBH 10 read the encoders and how are they stored? How I typically worked with encoders with my motor controller and arduino pair, is use the interrupt service routine in order to instantaneously update the encoder counts, and then I can see the updated values pretty quick in the serial monitor with Serial.print. How do I view the encoder counts like that with the DHB-10? Sorry if this is a very simple question, I'm just getting my first exposure working with this motor controller.
Thank you,
Best
Matthew
Here is my current code, but when I check out the encoder counts in the serial monitor, the right encoder is increasing much much faster than the left encoder. But when I run the Test Encoder Connections test, it seems like they are both okay.
UPDATE: Okay, after running the test encoder counts again, it does seem that my left encoder is off. I ran it on the floor to see if it went straight and the left motor is actually running a lot slower than the right one. How can I trouble shoot this? I have checked all the connections and they are fine, both batteries are at proper voltages too, and the motor connections themselves are very secure. I have read this page that suggest tuning the motors, https://learn.parallax.com/tutorials/robot/shield-bot/robotics-board-education-shield-arduino/chapter-4-boe-shield-bot-13, which does writeMilliseconds. What is the best forward movement function provided by parallax that I should use?
#include <ArloRobot.h> // Include Arlo library
#include <SoftwareSerial.h> // Include SoftwareSerial library
// Arlo and serial objects required
ArloRobot Arlo; // Arlo object
SoftwareSerial ArloSerial(12, 13); // Serial in I/O 12, out I/O 13
int countsLeft, countsRight; // Encoder counting variables
void setup() {
// put your setup code here, to run once:
tone(4, 3000, 2000); // Piezospeaker beep
Serial.begin(9600); // Start terminal serial port
ArloSerial.begin(19200); // Start DHB-10 serial com
Arlo.begin(ArloSerial); // Pass to Arlo object
Arlo.clearCounts(); // Clear encoder counts
}
void loop() {
// put your main code here, to run repeatedly:
Arlo.writeMotorPower(32, 32); // Go forward very slowly
countsLeft = Arlo.readCountsLeft(); // Get left & right encoder counts
countsRight = Arlo.readCountsRight();
Serial.print("Left Counts: "); Serial.print(countsLeft, DEC); Serial.print(" Right Counts: "); Serial.println(countsRight, DEC);
}
Thank you,
Best
Matthew
Here is my current code, but when I check out the encoder counts in the serial monitor, the right encoder is increasing much much faster than the left encoder. But when I run the Test Encoder Connections test, it seems like they are both okay.
UPDATE: Okay, after running the test encoder counts again, it does seem that my left encoder is off. I ran it on the floor to see if it went straight and the left motor is actually running a lot slower than the right one. How can I trouble shoot this? I have checked all the connections and they are fine, both batteries are at proper voltages too, and the motor connections themselves are very secure. I have read this page that suggest tuning the motors, https://learn.parallax.com/tutorials/robot/shield-bot/robotics-board-education-shield-arduino/chapter-4-boe-shield-bot-13, which does writeMilliseconds. What is the best forward movement function provided by parallax that I should use?
#include <ArloRobot.h> // Include Arlo library
#include <SoftwareSerial.h> // Include SoftwareSerial library
// Arlo and serial objects required
ArloRobot Arlo; // Arlo object
SoftwareSerial ArloSerial(12, 13); // Serial in I/O 12, out I/O 13
int countsLeft, countsRight; // Encoder counting variables
void setup() {
// put your setup code here, to run once:
tone(4, 3000, 2000); // Piezospeaker beep
Serial.begin(9600); // Start terminal serial port
ArloSerial.begin(19200); // Start DHB-10 serial com
Arlo.begin(ArloSerial); // Pass to Arlo object
Arlo.clearCounts(); // Clear encoder counts
}
void loop() {
// put your main code here, to run repeatedly:
Arlo.writeMotorPower(32, 32); // Go forward very slowly
countsLeft = Arlo.readCountsLeft(); // Get left & right encoder counts
countsRight = Arlo.readCountsRight();
Serial.print("Left Counts: "); Serial.print(countsLeft, DEC); Serial.print(" Right Counts: "); Serial.println(countsRight, DEC);
}
Comments
If you lift up Arlo on some blocks and drive both wheels, you might be able to visually see one wheel "limping" at certain points in the rotation.
Hi, thank you for your quick reply. I think I have made one step closer to debugging the issue. So, I changed the loop to just write the motors at a constant speed, with Arlo.writeSpeeds(32,32). At first it goes normally, but soon the left wheel begins jolting a bit, and then eventually it just completely goes to its max motor speed and spins out of control. Do you have any idea why this might be happening?
UPDATE: Hi, I have confirmed that there may be some sort of issue with my left motor. I'm not sure if it is a motor controller issue. I thought that it may be an issue with the communication between the Arduino and DHB-10, however I connected my original Properller WX board as well, and when I try drive_speed(32,32), after a while the left motor loses controls, and then the motor controller shuts off and the orange lights begin flashing rapidly. I'm assuming it shuts off because the current draw becomes much too high.
https://forums.parallax.com/discussion/167944/arlobot-dhb-10-motor-board-bug-with-encoders