Go Down

Topic: 500 CPR HEDL encoder with line driver - How to wire and read it? (Read 1 time) previous topic - next topic

I'm using a 500 CPR HEDL encoder with line driver but as far as the encoder setup page goes its pretty unclear how I might wire it up an read from it, mine is the a 5640 and has 10 pins.  These are some of the most common rotary encoders for motors so I'm sure someone has at least got something working?  I'm trying to be able to get the encoder position and then translate this into degrees and eventually get this into PureData or VVVV. Id be willing to do some sort of trade with other work for example some 3D modelling in max or solidworks(My 9 to 5 job), perhaps even some cnc milling.
Upload folder is full but here is link to the HEDL pdf which is actually a line driver and an encoder.
http://uploading.com/files/736b4a7m/HEDS_5xxx.rar/

Any help would be so appreciated and let me know if you need more info

dc42

According to the data sheet, those are standard quadrature encoders with differential line driver outputs.

If the cable isn't too long, you should be able to connect the A and B output lines directly to Arduino digital inputs (preferably the two that you can attach an interrupt to), connect the +5v and ground lines up, and ignore the other pins of the connector.

The playground page http://www.arduino.cc/playground/Main/RotaryEncoders has information about reading quadrature rotary encoders.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dc42 that you say its a standard quad encoder helps me a little but then off to the next gap in my understanding.  I did read through the quad encoder pages here and where I got a little confused was most of the encoders just have pin A and B where this one seems to have A HIGH & A LOW, plus B HIGH & B LOW.  I'm not really sure what to do with these other pins it has bothe in terms of hardware and sfotware. 

What I thought was inside this package was a HEDS like this one(im assuming it still is but jsut with the line  driver to seperate the singal ie deboucing)
http://pdf1.alldatasheet.com/datasheet-pdf/view/88912/HP/HEDS-5640-G06.html

I'm assuming the HEDL is added in here to improve the signal right.    Right now I'm looking at the Block Diagram on page 3 of the HEDL doc and if you compare this to the the HEDS pdf I just posted there is a little more going on.  I also don't fully understand the Pinouts ie its says No 1. is NC which I'm assuming means no connection.

do you understand what im getting at here?

dc42

What I meant was that if the cable is short you can use just A HIGH and B HIGH and leave A LOW and B LOW not connected. If the cable is long or the environment is noisy then you need to use differential line receivers (the datasheet recommends 26LS32 or 26LS33) to receive the high/low signals and convert them into single-ended signals for the Arduino.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Ok nice one:) Ill get a little chance a doing some wiring up soon and let you know the results.  Also I havent really seen something yet that uses the 3rd pin(I) which mine uses for reference point every rotation but Im guessing I can jsut use it like the other 2 pins and use it to check that there has been the right number of ticks per rev?  I was thinking of using a "Home point" for each rotation so that it can never get too far off track.

OK just had enough time to wire this up how I think it should be according to other examples.  Ive posted an image of the setup here to show my progress and get feedback before I turn my ardunio on.  Can anyone comment if I've got something wrong here(I don't feel like frying another board).


You might need to zoom in to see the pins on the plug.
Ive also left Pin 9 free for the moment as I'm sure how to use this reference pin code wise.

dc42

That looks good to me (you've posted a very clear image with all the necessary information). Just connect pin 9 to another Arduino input if you want to read the reference sensor as well.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Yep works like a treat:)
                                 Notes so far - I tried a few of the code examples from the Arduino page but of course its not eally fast enough to count the encoder I have.  I then tried the *new encoder code linked here http://www.pjrc.com/teensy/td_libs_Encoder.html and well seems like I get many more counts and it seems so far to not skip a beat, now Im getting 2000 counts per rev and thats just lovely for me:)

Ive used the basic example thus far now need to figure out a way to use the 3rd pin..sorry if im reapeating myself
Im a little rusty with the code stuff its been years since I really touched it.  but ill give it a go now

ok so using the basic example with the library I linked to im my previous post (and with the help of my good friend (PiffPaff) came out with the following code to send out the CPR's as degrees.

void loop() {
long newPosition = myEnc.read();
newPosition = newPosition % 2000;
long degree = (newPosition * 360) / 2000;

Serial.println(degree);

Go Up