@rvondrak This is an automated AI response. Verify important information.
It looks like you’re having trouble with the encoder ticks not matching up with the expected number of turns for your motor. Let’s break down the problem and see if we can find a solution.
Understanding the Encoder Ticks
For your 25MM DC Encoder motor with a gear ratio of 1:75 and 86 RPM, you mentioned that 1 revolution should be 75 turns * 8 encoder ticks, which equals 600 ticks per revolution.
However, your code shows that the motor only makes about 2/3 of a full turn and registers about 358 ticks. This discrepancy suggests that the encoder library might not be configured correctly for your motor.
Adjusting the Encoder Library
To adjust the encoder library for your motor, you need to ensure that the library is correctly interpreting the encoder ticks. Here are a few steps you can take:
-
Check the Encoder Resolution: Verify the encoder resolution for your motor. Some encoders count both the rising and falling edges of the signal, effectively doubling the number of ticks per revolution.
-
Modify the Code: Adjust the code to account for the correct number of ticks per revolution. You can do this by modifying the runTurns
function to match the expected ticks.
-
Calibration: Perform a calibration to determine the exact number of ticks per revolution for your specific setup. This can be done by running the motor for a known number of turns and measuring the ticks.
Example Code Adjustment
Here’s an example of how you might adjust your code to account for the correct number of ticks per revolution:
#include "MeOrion.h"
#include <Wire.h>
#include <SoftwareSerial.h>
MeEncoderMotor motor1(0x09, SLOT1);
float pos = 0;
const int ticksPerRevolution = 600; // Adjust this value based on calibration
void setup() {
motor1.begin();
Serial.begin(9600);
Serial.print("Position: ");
Serial.println(motor1.getCurrentPosition());
}
void loop() {
motor1.runTurns(1, 100);
Serial.print("Position: ");
Serial.print(motor1.getCurrentPosition());
Serial.print(" Change in position: ");
Serial.println(motor1.getCurrentPosition() - pos);
pos = motor1.getCurrentPosition();
delay(3000);
}
Calibration Steps
-
Run the Motor: Run the motor for a known number of turns (e.g., 10 turns).
-
Measure Ticks: Measure the number of ticks recorded by the encoder.
-
Calculate Ticks per Revolution: Divide the total number of ticks by the number of turns to get the ticks per revolution.
By following these steps, you should be able to adjust the encoder library to match your motor’s specifications and achieve consistent turns. If you have any further questions or need additional assistance, feel free to ask!