Author Topic: Encoder Wiring  (Read 3722 times)

0 Members and 1 Guest are viewing this topic.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Encoder Wiring
« on: February 28, 2008, 08:46:30 PM »
On an old Pioneer ATV there are 4-DC Brushless motors. Two of the motors have encoders directly mounted.

The encoder has 4 wires, red, black, blue, and yellow. The red wire is obviously +12V and Black wire is the return GND.

I'm assuming the blue and yellow wires are for the left-side front motor encoder and the yellow wire is the left-side back motor encoder value?

How you you interpret the output from the encoders typically? Voltage levels equate to distance revolutions/second?

 

Offline ed1380

  • Supreme Robot
  • *****
  • Posts: 1,478
  • Helpful? 3
Re: Encoder Wiring
« Reply #1 on: February 28, 2008, 09:20:37 PM »
ATV=all terrain vehicle, right?

heres a guide on how to use an encoder from a mouse. should be the same comcept. http://www.boondog.com/tutorials/mouse/mouseHackBeforeWeb.htm
Problems making the $50 robot circuit board?
click here. http://www.societyofrobots.com/robotforum/index.php?topic=3292.msg25198#msg25198

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #2 on: February 28, 2008, 09:26:35 PM »
ATV=all terrain vehicle, right?



yes

I can't believe how much of my EE stuff I forgot! :-/ This all looks foreign to me when it shouldn't be.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Encoder Wiring
« Reply #3 on: February 28, 2008, 09:36:31 PM »
Hi,

I don't know these encoders, but a common type has two outputs with pulses which are 180 degrees out of phase, enabling direction indication as well.
If they are like that, the two outputs should look like this:

Code: [Select]
 ____        ____         ____
_|     |____|      |____|      |___
     ____        ____        ____
___|     |____|      |____|      |___


That said, I just woke up in the middle of the night sitting with my laptop in my lap, so I might be too sleepy to miss something in your post.

With 4 wires, if you assume two is power, where did the extra yellow wire come from? ("I'm assuming the blue and yellow wires are for the left-side front motor encoder and the yellow wire is the left-side back motor").
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #4 on: February 28, 2008, 09:39:31 PM »
There is not second yellow wire. It is my bad english writing style. So there is just 1 blue and 1 yellow wire from the encoder. It makes sense what you are saying. Now how do I measure the phase difference with my microcontroller. Do I hook up the encoders to the Analog ports?

So if the yellow and blue wire are 180 degree out of phase what does that say about direction, and how does that help me figure out how fast I'm going (rev/minute)?

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Encoder Wiring
« Reply #5 on: February 28, 2008, 10:01:05 PM »
Hi,

It's digital signals (but might need pull-ups), test with a multimeter.
Direction can be seen from which one is going high first.

Call them A and B, going in one direction, the signals would look like A-B-/A-/B-A-B etc. while the opposite direction should be B-A-/B-/A-B-A etc.

It's quite easy to decode in a µcontroller, but with a few gates you could bang up a circuit to output both pulses and a direction signal.

The speed is in the pulsing of either of the outputs giving a certain number of pulses per revolution.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #6 on: February 29, 2008, 03:15:58 PM »
Hi,

It's digital signals (but might need pull-ups), test with a multimeter.
Direction can be seen from which one is going high first.

Call them A and B, going in one direction, the signals would look like A-B-/A-/B-A-B etc. while the opposite direction should be B-A-/B-/A-B-A etc.

It's quite easy to decode in a µcontroller, but with a few gates you could bang up a circuit to output both pulses and a direction signal.

The speed is in the pulsing of either of the outputs giving a certain number of pulses per revolution.


Soeren:

Did you mean test with an oscilloscope? Can multimeters display analog V signals?

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
Re: Encoder Wiring
« Reply #7 on: February 29, 2008, 03:18:01 PM »
of course multimeters can show analog voltages !!! Multimeters measure a bunch of stuff , one of them being voltage

logic probes on the other hand only do digital
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #8 on: February 29, 2008, 03:36:38 PM »
of course multimeters can show analog voltages !!! Multimeters measure a bunch of stuff , one of them being voltage

logic probes on the other hand only do digital

I think you misunderstand my question. I want to display the signals on an LCD screen. Oscilloscopes show the signals, but multimeters do not.

Offline Darkbluestar

  • Jr. Member
  • **
  • Posts: 36
  • Helpful? 0
Re: Encoder Wiring
« Reply #9 on: February 29, 2008, 04:23:41 PM »
It sounds like a Quadrature encoder. They have two channels and are out of phase by 90 degrees not 180. Like in this picture http://en.wikipedia.org/wiki/Image:Quadrature_Diagram.svg
There is more stuff on google about quadrature encoders with plenty of information.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #10 on: February 29, 2008, 07:07:55 PM »
I don't have a clue how to interface the encoders with my micro-controller and begin writing code to detect the pulses. Anyone, anyone?

Offline Darkbluestar

  • Jr. Member
  • **
  • Posts: 36
  • Helpful? 0
Re: Encoder Wiring
« Reply #11 on: March 01, 2008, 12:13:59 AM »
If you want to make it simple ignore the quadrature part and assume that the wheels are turning in the direction you told them. So you can just hook up the wires to a pin that can set off an interrupt whenever the state of the pin changes. In software you just add or subtract , depending on the direction you are assuming, whenever an interrupt happens.

If you really want to use the quadrature part, just keep track or the last state of the two signals and compare it to the new one to know the direction of motion.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Encoder Wiring
« Reply #12 on: March 01, 2008, 04:08:05 PM »
Hi,

They [...] are out of phase by 90 degrees not 180.
Of course *doh* my mistake - that's what happen when you don't sleep enough ;)
My drawing was correct though :D
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Encoder Wiring
« Reply #13 on: March 01, 2008, 04:22:28 PM »
Hi,

I don't have a clue how to interface the encoders with my micro-controller and begin writing code to detect the pulses. Anyone, anyone?
Check with your multimeter whether the outputs need pull-up resistors (10k to 100k will do if needed).
A MM won't be fast enough to count the pulses when going even semi-slow, but if you turn a wheel sloooowwwwly by hand, you should be able to measure what's needed.

Interface with or without pull-ups as needed. If the motor voltage is higher than the micros an extra resistor and zener diode (or two regular diodes) on each of the two lines will take care of that.

To read the signal, use one of the inputs as the pulse count, either by interrupt as suggested by DBS, or by polling, whatever suits your style and then read the other input when the first one goes high (or low if that is more appropriate in your case) - this result will tell the direction.

The distance information is: The number of pulses total times the circumference of the wheel divided with the number of pulses per revolution.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,699
  • Helpful? 173
    • Society of Robots
Re: Encoder Wiring
« Reply #14 on: March 15, 2008, 05:07:22 PM »

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
Re: Encoder Wiring
« Reply #15 on: March 15, 2008, 05:13:18 PM »
Thanks so much John. Your so awesome!!!!

 


Get Your Ad Here

data_list