Open CalebJ2 opened 4 years ago
The motors have this pinout:
I think 2 tb6612fng chips would work well for driving this: https://learn.sparkfun.com/tutorials/tb6612fng-hookup-guide/all
Encoder test script:
// https://www.pjrc.com/teensy/td_libs_Encoder.html
#include <Encoder.h>
Encoder encoder(11,12);
double previousPos = 0;
double previousTime = 0;
double currentPos = 0;
void setup() {
Serial.begin(9600);
Serial.println("Encoder Test:");
}
void loop() {
// put your main code here, to run repeatedly:
previousPos = currentPos;
currentPos = encoder.read();
double currentTime = millis();
float speed = (float)(currentPos-previousPos)/(float)(currentTime-previousTime);
previousTime = currentTime;
Serial.println(speed);
if (Serial.available()) {
Serial.read();
Serial.println("Reset to zero");
encoder.write(0);
}
delay(100);
}
This kit https://www.amazon.com/gp/product/B07PRW11VR/ has a brushed motors with quadrature encoders. A driver like this could power them https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino although that is a little under powered. I don't see many motor controllers that are made for using quadrature encoder and a reasonable price. Could read the encoders with an arduino: https://www.pjrc.com/teensy/td_libs_Encoder.html