7 I believe the 400,000 number the answer refers to is the number of rotations per minute, as opposed to per second. This lead to confusion for me the firs time I read the question through.
source | link

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 4000006800 events per second (ie, 48*8500 = 408000 events per minute that implies. However, youor 1/60 as many per second) if the Arduino will be doing anything else besides quadrature decoding. You could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most The 147 microseconds available per event (ie, 1000000 us / 6800 events) might or might not be enough; most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per minute that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with 6800 events per second (ie, 48*8500 = 408000 events per minute, or 1/60 as many per second) if the Arduino will be doing anything else besides quadrature decoding. You could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. The 147 microseconds available per event (ie, 1000000 us / 6800 events) might or might not be enough; most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

6 I believe the 400,000 number the answer refers to is the number of rotations per minute, as opposed to per second. This lead to confusion for me the firs time I read the question through.
source | link

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per secondminute that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per second that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per minute that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

5 replaced http://arduino.stackexchange.com/ with https://arduino.stackexchange.com/
source | link

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per second that implies. However, you could combine some of the code shown at an arduino.stackexchange answeran arduino.stackexchange answer with that at another arduino.stackexchange answeranother arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per second that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns.

As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of the output shaft:

Encoder: Cycles Per Revolution (Motor Shaft)                12
Encoder: Cycles Per Revolution (Output Shaft)            4,428
Encoder: Countable Events Per Revolution (Motor Shaft)      48
Encoder: Countable Events Per Revolution (Output Shaft) 17,712

An "event" refers to an edge, up or down, on either of the encoder channels. A "cycle" refers to the two channels going through the four phases of one quadrature-encoder cycle.

Given the gear ratio 369:1, the motor probably spins about 8500 RPM to make 23 RPM on the output shaft. A software-based quadrature decoder might have trouble keeping up with the ca. 400000 events per second that implies. However, you could combine some of the code shown at an arduino.stackexchange answer with that at another arduino.stackexchange answer to see how many events per second you could count using software on an Arduino. Most likely you will need to use a hardware-based quadrature decoder and counter to track shaft location.

[Edit 3:] If the motor parameter you wish to control or measure is speed rather than position, a typical ATmega328-based Arduino board can count enough encoder events to give that information for a single motor. For example, if using an Uno you could connect one encoder line to PD5, the T1 input pin on a '328. With the motor running at full speed, Counter 1 would overflow about twice a second. In its interrupt handler you would read the current value of micros, store it in a volatile variable, and set a change flag. The interrupt handler could also add or subtract the counter value to a position total.

[Edit 2:] Regarding the wiring, it appears that you should do like the following:

Pin# Color   Function             Hook to...
3.   Green   (Ground),               common ground
4.   Brown   (Channel B),            quad. decoder input 2
5.   Yellow  (Channel A),            quad. decoder input 1
6.   Orange  (Sensor Voltage +)      V+ (eg to logic +5 or +12)

See wikipedia's Rotary Encoder article for more discussion of quadrature encoding/decoding, along with signal diagrams, etc.

See pololu's "Using the Driver in Single-Channel Mode" page for an explanation of pins like M1INA, M1INB, M1EN, etc.

4 edit 3, re counter1
source | link
3 add paragraphs about wiring & and a link
source | link
2 add paragraph about counting sw or hw
source | link
1
source | link