Incremental Rotary Encoder Wiring

Alright, so I've spent the last two hours scouring the internet for a wiring diagram for my Yumo E6A2-CS3E incremental encoder bought from SparkFun... but no luck. This is for a gravity vehicle project for Science Olympiad... trouble is, I write software. I got stuck into the electronics side of the competition because I'm the only one who has a chance of making it happen and my knowledge is extremely limited. All I learned from my searches is that I need a pull-up resistor on each output and the blue wire should be grounded? So, the details:

Resolution: 200P/R
Brown: 5-12VDC
Blue: 0V Common
Shield (White?): GND
Black: Out A

I have an Arduino Uno R3 and a small breadboard, along with a good handful of wires, resistors (which I can't figure out how to read) and the parts for the braking system (which I can control, luckily).

Help?

The datasheet is not easy to interpret. I think its brown(or red) +5 to +12V, blue 0V, black phase A output, white phase B output.

I'm not certain if the outputs are open-collector or not, so they might need 10k pull ups, but I think that particular device doesn't need them.

Alright, so what do I need to do with the 0V wire? Ground it? Would the A and B outputs go in ports 2 and 3, on the Uno R3?

gerbilOFdoom:
Alright, so what do I need to do with the 0V wire? Ground it?

Yes, to any of the arduino ground pins.

Would the A and B outputs go in ports 2 and 3, on the Uno R3?

Pins 2 and 3, not ports which means something else. Also you can satify the need for pull-up resistors by enabling the internal pull-ups for those two pins.

Alright, so I'm using the QuadratureEncoder class from http://www.hessmer.org/blog/2010/04/08/building-a-self-balancing-robot-–-motor-driver-and-wheel-encoder/... does anyone know what the interrupts on pins 0 and 1 are for? I have nothing to plug into them so...

gerbilOFdoom:
Alright, so I'm using the QuadratureEncoder class from http://www.hessmer.org/blog/2010/04/08/building-a-self-balancing-robot-–-motor-driver-and-wheel-encoder/... does anyone know what the interrupts on pins 0 and 1 are for? I have nothing to plug into them so...

attachInterrupt(0, HandleInterruptA, CHANGE);
attachInterrupt(1, HandleInterruptB, CHANGE);

Software Interrupt 0 function is triggered by arduino digital input pin 2, wired to one of the two encoder channels. Software Interrupt 1 function is triggered by arduino digital input pin 3 which should be wired to the other encoder channel.

That make sense?

Lefty

Thank you very much! I just got it working and showing the proper 200 ticks per rotation XD

Next step is to convert pulses to degrees and I'll be all set to go!

gerbilOFdoom:
Thank you very much! I just got it working and showing the proper 200 ticks per rotation XD

Next step is to convert pulses to degrees and I'll be all set to go!

Great, aren't Arduinos cool?

Lefty

Oh yeah! I have two Arduino's, one for each of my electronic events. I'm using an arduino to control the servos on our robotic arm and accept joystick inputs, and I'm using the other one for a gravity vehicle that has to stop itself at a certain distance. Competition coming up Saturday and I'm just finishing both :stuck_out_tongue:

My solution to converting pulses to rotations:
Ticks/200

But I need to be able to figure out distance traveled, so
Ticks/200 = a
diameter = .12m = d
circumference = pid = c
a
c= x (distance)

Basically: Win.

Basically: Win.

:smiley: :smiley:

Good luck on the upcoming competition.

And, if at first you don't succeed, don't take up skydiving. :wink: