Metal DC Geared Motor w/Encoder CQGB37Y001
INTRODUCTION
This gearmotor is a powerful 12V brushed DC motor with a 6.25:1/10:1/18.8:1/30:1/43.8:1/56.3:1/70:1/90:1/131.3:1/168.8:1/210:1/270:1/393.8:1/450:1/506:1/630:1/810:1 metal gearbox and an integrated quadrature encoder that provides a resolution of 64 counts per revolution of the motor shaft, which corresponds to 5760 (90:1) counts per revolution of the gearboxot is output shaft. These units have a 16 mm-long, 6 mm-diameter D-shaped output shaft. When the working voltage of the DC gear motor is 12V, the motor rotation speed is 11,000 rpm before the motor is decelerated. When the working voltage of the DC gear motor is 6V, the motor rotation speed is 5500 rpm before the motor is decelerated.
Note
Stalling is likely to damage the gearmotor. Stall parameters come from a theoretical extrapolation of performance at loads far from stall. As the motor heats up, as happens as it approaches an actual stall, the stall torque and current decrease.
Do not screw too far into the mounting holes as the screws can hit the gears. CQRobot Manufacturer recommends screwing no further than 3mm (1/8 inch) into the screw hole.
SPECIFICATION
Motor Encoder
- Encoder Operating Voltage: 3.3V - 24V
- Encoder Type: Hall (Incremental Type)
- Encoder Resolution: 64CPR
Motor Size
Connect the Renderings
Encoder Diagram
Diagram for Arduino UNO
Interrupt Port with Different Board
Notcie: attachInterrupt()
For example,with arduino UNO board, you want to use interrupt port 0(int.0). You should connect digital pin 2 with the board. So, the following code is only used in UNO and Mega2560. If you want to use arduino Leonardo or Romeo, you should change digital pin 3 instead of digital pin 2.
See the link for detail http://arduino.cc/en/Reference/AttachInterrupt
Encoder Sample Code
//The sample code for driving one way motor encoder const byte encoder0pinA = 2;//A pin -> the interrupt pin 0 const byte encoder0pinB = 4;//B pin -> the digital pin 4 byte encoder0PinALast; int duration;//the number of the pulses boolean Direction;//the rotation direction
void setup()
{
Serial.begin(57600);//Initialize the serial port EncoderInit();//Initialize the module
}
void loop() {
Serial.print("Pulse:"); Serial.println(duration); duration = 0; delay(100);
}
void EncoderInit() {
Direction = true;//default -> Forward pinMode(encoder0pinB,INPUT); attachInterrupt(0, wheelSpeed, CHANGE);
}
void wheelSpeed() {
int Lstate = digitalRead(encoder0pinA); if((encoder0PinALast == LOW) && Lstate==HIGH) { int val = digitalRead(encoder0pinB); if(val == LOW && Direction) { Direction = false; //Reverse } else if(val == HIGH && !Direction) { Direction = true; //Forward } } encoder0PinALast = Lstate; if(!Direction) duration++; else duration--;
}