Pictures
These pictures are from Baidu Search.
Picture 1: Installment
Picture 2: Appearance
Picture 3: Encoder of Motor
Picture 4: Pins location and number
Physical Specification
- Brand: Mabuchi Motor (万宝至电机)
- Type: RS-365PW 16120
- Body length:37.5mm
- Body diameter:27.6mm(Magnetic Ring Diameter 29mm)
- Axis Length: 12mm or 9.4mm
- Axis diameter:2.3mm
- Weight: 65.3g or 64.7g
- Voltage range: DC 6-12V
- Idling current:80mA
- No load speed:3200-6700 rpm
Electrical Specification
Test result from Arduino with running motor.
- The encoder wheel one around gets 334 counts from phrase A.
- The motor running direction is Clockwise if A pulse is falling edge and B phrase is high level.
- The motor running direction is counterclockwise if A pulse is falling edge and B phrase is low level.
Arduino Test Code
#include <MsTimer2.h>
const int pinA = 2;//This is a digital pin.
const int pinB = 3;//This is a digital pin.
const int maxTick = 334;
bool isClockwise = true;
int tickCounter = 0;
void setup() {
pinMode(pinA, INPUT); //the A pin of motor
pinMode(pinB, INPUT); //the B pin of motor
// Set baud rate is 9600bit/s:
Serial.begin(9600);
//checking A pulse if falling edge, if it is, go to CountPinA.
attachInterrupt(digitalPinToInterrupt(pinA), CountPinA, FALLING);//The attachInterrupt function Only support 2,3 pin on the Arduino Nano board.
//invoking flash once a second.
MsTimer2::set(1000, flash); //it's been interrupted by every second.
MsTimer2::start(); //start timer
}
void CountPinA()
{
if(digitalRead(pinB)==HIGH)
{
isClockwise = true;
}
else
{
isClockwise = false;
}
tickCounter++;
if(tickCounter > maxTick)
{
tickCounter = 0;
}
}
void flash()
{
//Here, 'Serial.read' is unusable.
if(isClockwise == true)
{
Serial.print("clockwise,");
}
else
{
Serial.print("counter clockwise,");
}
Serial.print("tickCounter = ");
Serial.println(tickCounter);
}//end funCounterA
void loop() {
//'Serial.read' is unusable, May be here needing a delay.
}
Complement
Write by Kagula @2021 and copy it to CSDN @2023.