I am trying to use this DC motor with an 3 wire encoder, but I cannot find any datasheet and cannot get the encoder to read. Any ideas?
Imagem do WhatsApp de 2023-10-05 à(s) 11.03.01_3a02f72c|375x500
I am trying to use this DC motor with an 3 wire encoder, but I cannot find any datasheet and cannot get the encoder to read. Any ideas?
Imagem do WhatsApp de 2023-10-05 à(s) 11.03.01_3a02f72c|375x500
Post a picture and not link to something.
I moved your topic to an appropriate forum category @aosmga.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
I am trying to get RPM readings.
It seems to be a light barrier.
Use a DMM and make some measurments.
This page may have helpful information >> Wiring Light Blocking / Photo Interrupter Sensor | 14core.com
Try the setup suggested in the link posted above. Usually, red(+) and black(-) wires are power and ground, white is signal out.
I suggest this wiring using the colors suggested by @jremington . The internal pullup is connected to Vcc internal to the processor.
The current limiting resistor (470) for the LED could probably be anywhere from 220 to 1K Ohms.

The internal pullup is pretty weak. An external pullup on the collector may be necessary if the wires are long or there is lots of noise. Start with a 10K from the OUT to Vcc.
Sorry for the crude image. Best my laptop can do right now.
The internal pullup is pretty weak. An external pullup, on the collector, may be necessary if the wires are long and/or there is lots of noise. Start with a 10K from the OUT to Vcc.
Put caps across the motor leads to reduce motor noise.

This program (for Nano) should show pulses per minute, for RPM divide PPM by the number of pulses per motor revolution
Connect encoder wires to Arduino GND and pin 2. Untested.
unsigned long start;
const byte encoderPinA = 2;//A pin -> the interrupt pin 0
volatile long pulse;//the number of the pulses
int fin = 250, ppm;
void setup() {
// initialize serial:
Serial.begin(9600);
attachInterrupt(0, readEncoder, FALLING);
pinMode(encoderPinA,INPUT);
}
void loop() {
if(millis() - start > fin)
{
noInterrupts();
ppm *= 240;
interrupts();
Serial.print(ppm);
pulse = 0;
start = millis();
}
}
void readEncoder()
{
++pulse;
}
Thank you all! Got it working.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.