I am executing a project with FaulHaber motor (pls, see attached files)
But I can not find Pin diagram of the encoder (Vcc, Motor+, Motor-, GND, Channel A/B).
So I don't know how to connect it with Interrupts of Mega 2560.
Anyone can help me with this problem???
This is a simple code to count value from encoder.
int pinA = 52; // 2 pins of motor
int pinB = 53;
long count = 0;
void setup()
{
delay(500);
pinMode(pinA,OUTPUT);
pinMode(pinB,OUTPUT);
Serial.begin(9600);
attachInterrupt(0,Encoder0, CHANGE); // call Encoder0 func every INT0 changes its state
// encoderVal.every(50,updateEncoder,(void*)0);
}
int i=0;
void loop()
{
if (i==0)
{
// run motor
digitalWrite(pinA,LOW);
digitalWrite(pinB,HIGH);
delay(2000);
// stop motor
digitalWrite(pinA,LOW);
digitalWrite(pinB,LOW);
i++;
I am executing a project with FaulHaber motor 2342L-012CR and a magnetic encoder (pls, see attached files).
However, I don't know pins diagram of the encoder (Vcc, GND, Motor+, Motor-, Channel A/B)
So, I don't know how to connect the encoder to Arduino board correctly.
Anyone can help me???
Below is my simple code to run motor and count value from encoder
int pinA = 52; // 2 pins of motor
int pinB = 53;
long count = 0;
void setup()
{
delay(500);
pinMode(pinA,OUTPUT);
pinMode(pinB,OUTPUT);
Serial.begin(9600);
attachInterrupt(0,Encoder0, CHANGE); // call Encoder0 func every INT0 changes its state
// encoderVal.every(50,updateEncoder,(void*)0);
}
int i=0;
void loop()
{
if (i==0)
{
// run motor
digitalWrite(pinA,LOW);
digitalWrite(pinB,HIGH);
delay(2000);
// stop motor
digitalWrite(pinA,LOW);
digitalWrite(pinB,LOW);
i++;
}
}
void Encoder0()
{
count++;
Serial.println(count);
}
This is my code with another motor with detail information of encoder.
But with FaulHaber 2342L motor, I can not find the datasheet.
So, anyone done it before, please let me know the diagram of the encoder pin.
The encoder will provide a signal which goes on and off as the motor turns. You set the interrupt routine on the arduino to trigger on each rising or falling edge on the encoder signal. There will be some number of pulses per cycle of the motor, which depends on the number of holes or slots in the spinning wheel attached to the motor shaft.
Can you find anything written on those encoders, identifying them ?
You can find out some more by having a real good look at the traces of that small PCB, but you'll be guessing a bit that way.
I can't see enough detail in those pics to help with that.
(need to see the traces)