Notifications
Clear all

GHS38 incremental encoder  


hswaters
(@hswaters)
Active Member
Joined: 2 months ago
Posts: 6
Topic starter  

I have purchased my first rotary encoder the GHS38.  I got this one because it looked like it could take a timing pulley with no problems.  I have been searching for information on the many wires this thing has.  The most information I have found so far is the listing on I think AliBaba although I purchased it from Amazon.  The encoder came with a one sheet information package but for a beginner that is no where near enough information. 

I saw the encoders on Dronebot workshop on youtube and expected maybe a four wire hookup but this thing has 8.  The VCC and ground are easy to understand but the other 6 are a puzzle for me.  They are labeled A B Z and A- B- Z-.  There are two lines of information and the second line says "without inverted signal' A B Z.  So this still leaves me a lot in the dark.  I am hoping to get this working without letting out the magic smoke from any of the devices. 

What I am using it for:

I have a milling machine and a rotary table.  In the past this sort of setup has been done by attaching a mobile transmission and lots of gears to keep the rotary table and the lead screw in time. This is the typical setup for cutting helical gears. You can see the transmission type of setup on Keith Ruckers youtube channel.

I have attached the rotary encoder to the X axis lead screw of the mill to count turns to send to the rotary table through a Arduino and a servo which I have connected to the rotary table.    I do not want a one for one transmission of the signal.  In the Arduino I will convert the number of turns to send out the signal to the servo at a 1:1.125 ratio for now but any ratio later.  Connecting the servo motor was easy enough but my problem is how to connect the rotary encoder.  I have more wires than I was expecting. 

Hopefully you guys can help me get this working.  If it works you can later see it on my youtube channel, ARW.

Thanks for your anticipated assistance.

Harold Waters


Quote
MadMisha
(@madmisha)
Estimable Member
Joined: 1 year ago
Posts: 130
 

A and B would be your pulses and Z is the zero. Every time it goes past the zero position(index) it will pulse the Z line. I believe the negative ones is just 180 degrees out of phase from it's corresponding wire. If you hook up A, B and Z to the arduino and ignore the other 3, it should be fine.

 

Also, what library are you using?

 

Edit: Here is an explanation of incremental encoders: Encoders Explained 

Scroll down to electrical outputs for the interesting part. I believe yours is the line driver configuration. But there should be other numbers after the part number that will tell you.

GHS38

ReplyQuote
hswaters
(@hswaters)
Active Member
Joined: 2 months ago
Posts: 6
Topic starter  

The model number on the encoder is GHS38-06G1000BML5. I intend to start with the example code from Dronbot workshop which uses servo.h library. 

Thanks a million for your help.  I will let you know how it works out for me.

 


ReplyQuote
MadMisha
(@madmisha)
Estimable Member
Joined: 1 year ago
Posts: 130
 

So, it is line driver configuration for the encoder. So a positive pulse would be produced between the +  and - lines. I would try and use the without inverted signal option. You might have better luck using Encoder.h library instead. There is a basic sketch in the examples that will print the position and you can mess around with it to see how it works.

 

If you do need to use both lines to get the pulse, that will be a whole other process.


ReplyQuote
hswaters
(@hswaters)
Active Member
Joined: 2 months ago
Posts: 6
Topic starter  

Yes I will be using the encoder library.  Since your last reply I have been searching for libraries and example code of which I have found a fair amount.  Too bad their are so few wiring examples.  Since I first started to mess around with stepper motors I have let the magic smoke out of a couple of stepper drivers so I now live in fear of a repeat.  Thanks very much for your continuing help. 


ReplyQuote
hswaters
(@hswaters)
Active Member
Joined: 2 months ago
Posts: 6
Topic starter  

OK today I connected the rotary encoder to the Arduino and I am using the B and Z wires.  With these set up I get a count going one direction.  I am surprised that the count is not going to 1000 with each rotation as I thought that was the counts that I could expect from the encoder. 

Then as I was experimenting with this device I started to wonder just what are the A,B,Z wires anyway.  By what are they I mean just what signal is on each wire?   And why do the get repeated by another 3 wires with negatives after the letters. 

My last question which no one can answer is why didn't I buy the same four wire encoder that all the youtube channels show. 


ReplyQuote
MadMisha
(@madmisha)
Estimable Member
Joined: 1 year ago
Posts: 130
 

@hswaters

You should be using A and B. Here is what the pulses are doing:

z pulse timing diagram

 

Between the A and B lines you will get the steps. The Z just pulses when it passed the 0 position(once per revolution). The Z can be used for error correction, like if the amount of steps between pulses of Z are off then you can correct the amount of steps taken. Or used to reset the count.


ReplyQuote
MadMisha
(@madmisha)
Estimable Member
Joined: 1 year ago
Posts: 130
 
Posted by: @hswaters

I am surprised that the count is not going to 1000 with each rotation as I thought that was the counts that I could expect from the encoder. 

By using the Z wire you are not getting the correct number of counts.

 

Posted by: @hswaters

And why do the get repeated by another 3 wires with negatives after the letters. 

The encoder is meant to work with differential signaling. Unfortunately Arduino does not support that.(maybe the Due does?) The positive ones are +2.5v and the negative ones are -2.5v. If you are measuring between the 2 you would bet the proper 5 volt signal(difference between the negative and positive being 5).


ReplyQuote
hswaters
(@hswaters)
Active Member
Joined: 2 months ago
Posts: 6
Topic starter  

@madmisha thanks for all the information.  Now maybe I can make progress.


ReplyQuote