Pages: [1]   Go Down
Author Topic: Incremental Rotary Encoder Wiring  (Read 2109 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12434
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright, so I'm using the QuadratureEncoder class from http://www.hessmer.org/blog/2010/04/08/building-a-self-balancing-robot-%E2%80%93-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...
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright, so I'm using the QuadratureEncoder class from http://www.hessmer.org/blog/2010/04/08/building-a-self-balancing-robot-%E2%80%93-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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Great, aren't Arduinos cool?

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-razz

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 = pi*d = c
a*c= x (distance)

Basically: Win.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Basically: Win.

 smiley-grin smiley-grin

Good luck on the upcoming competition.

And, if at first you don't succeed, don't take up skydiving.  smiley-wink
Logged

Pages: [1]   Go Up
Jump to: