12V直流减速电机 122rpm 带编码器

概述

这是一款齿轮电动机 w/编码器,其型号为No. GB37Y3530-12V-90EN。这款12V的强力驱动器带有一个齿轮齿数比为90:1的金属变速箱和一个集成的正交编码器。编码器电机轴的分辨率为每转64。同时,变速箱的输出轴分辨率为每转5760。 这些组成单元都有一个长为1.54cm(0.61英寸),直径为6mm的D形输出轴。虽然这款驱动器能在低至1V的电压下运转,但其额定电压为12V,因此,最好将它接到12V的电压下。 面板外缘均匀分布着6个安装孔,可以拧入M3 螺丝。6个安装孔形成了一个正六边形,每个孔距六边形中心15.5mm。 对于您的移动机器人项目来说,它无疑是一个完美的选择。

注意:不要把安装孔的螺丝拧得太紧,因为这些螺丝可能会碰坏齿轮。生产商建议拧的深度不要超过3mm(0.125英寸)。

Encoder Diagram

====Diagram for UNO==== FIT0403_encoder.png

====Interrupt Port with Different Board====

Notcie:attachInterrupt() interrupt.png

举个例子,当你想在UNO上面使用中断管脚0(中断0),你可以连接2号数字管脚(D2)。注意:以下的样例代码是给UNO和Mega2560用的,如果要用Leonardo或者Romeo, 您需要换成3号数字管脚(Leonardo的D3才是中断0)

详细情况请查看 http://arduino.cc/en/Reference/AttachInterrupt

样例代码


//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--;
}

<File:nextredirectltr.png>Go Shopping 12V 直流减速电机 122rpm 带编码器(SKU: FIT0403)

category: Product Manual category: FIT Series category: Motor <!--Hidden Categories--!>

category: Diagram category: DFRobot