Digital readout from magnetic or glass scales

More
26 Nov 2014 19:49 - 26 Nov 2014 19:52 #53437 by Jake
I had originally thought I needed to buy interface cards,

But after you and some others mentioning that TTL signals can go right a to a parallel port with no additional hardware I thought that would be the simpler and less expensive route to go.

But I can go buy interface cards if need be for simplicity. I wanted to wait on buying the cards since I have not aquired a mill that I want to retrofit yet, I want to be able to buy the hardware that could possibly work with existing encoders, and servos. (I am hoping to work out a deal on a Servo SAM7 we have at work when they replace it next year with a HMC)

I started to go down that road to figure out what it would take to connect the 4 scales to the PC through the parallel port. Which is where I came up with my last post.
Sorry for making your head hurt on this! As you can see computer control logic is not my strong suit. I am an electrician and used to large industrial systems, as the instrument and control guys typically have to deal with this level. I can get a 7000 hp electric motor to run, but a controlling a little servo motor is handing me my .....

Thanks again Andy!

Where is the LinuxCNC for dummies book at???????
Last edit: 26 Nov 2014 19:52 by Jake. Reason: deedadee

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 19:55 #53438 by andypugh

But after you and some others mentioning that TTL signals can go right a to a parallel port with no additional hardware I thought that would be the simpler and less expensive route to go.
I started to go down that road to figure out what it would take to connect the 4 scales to the PC through the parallel port. Which is where I came up with my last post.


Ah, in that case you don't need a clock signal. Just the two AB lines into the p-port and from there to a HAL encoder counter.

However you _might_ still need an interface card, depending on the speed at which you can wind the handles and how many pulses per mm the scales put out.

Software encoder counting on the parport tops out at about 20kHz. If you are seeing quadrature pulses faster than that then you would need an interface card of some sort.
The following user(s) said Thank You: Jake

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 20:31 #53439 by Jake
Ok cool,

With 5 micron scales it looks like 12 inches per minute puts me at 20kHz which I think my feeds can only run 9"

So Pport connections should be

A, B (X) to Data 0, 1
A, B (Y) to Data 2, 3
A, B (Z) to Data 4, 5
A, B (W) to Data 6, 7

Then the HAL encoder counter is the software portion correct? I need some more caffeine this morning!

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 20:45 #53441 by DaBit
Although not quite a robust industrial solution one can interface TTL-level scales such as Sino and Ditron are selling directly to the parallel port. I setup my first experiments like this and it worked flawless at the maximumspeed of 3 meters/minute that the axis could do.

You are correct regarding the wiring (A,B to data 0/1, etc.). The 5V power supply for the scales can be obtained from an unused USB port.
Once you have hooked it up, do not forget to put the parallel port in input mode while loading the 'parport' component. But we'll discuss that when you are ready for that. Small steps at a time.
The following user(s) said Thank You: Jake

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 20:52 #53442 by Jake
Awesome,

More to continue when my parallel to PCI card gets here and my scales. I did buy Ditron scales, the price was right and I have not found really any bad info about them yeah there not Heidenhain or Mitutoyo's but I got 6 of them for what I would have paid for one of those ones.

Thanks again for putting up with me!

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 21:12 #53444 by DaBit
I am using Ditron 1um scales on my machine. Except that one scale does not produce index pulses they work fine and seem quite accurate.

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 21:23 - 26 Nov 2014 21:24 #53445 by andypugh

So Pport connections should be

A, B (X) to Data 0, 1
A, B (Y) to Data 2, 3
A, B (Z) to Data 4, 5
A, B (W) to Data 6, 7


Yes, assuming that those parport pins have the right direction.

Then the HAL encoder counter is the software portion correct?


Indeed.

A very simple config for a DRO would be to save this HAL code as a dro.hal then open a terminal on a LinuxCNC computer and run the command
halrun -I -f  dro.hal

dro.hal
loadrt encoder num_chan=3
loadrt hal_parport cfg="0"
loadrt threads name1=base-thread period1=50000 name2=servo-thread period2=1000000
addf parport.0.read base-thread
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread

net xa parport.0.pin-00-in => encoder.0.phase-A
net xb parport.0.pin-01-in => encoder.0.phase-B
net ya parport.0.pin-02-in => encoder.1.phase-A
net yb parport.0.pin-03-in => encoder.1.phase-B
net za parport.0.pin-04-in => encoder.2.phase-A
net zb parport.0.pin-05-in => encoder.2.phase-B
net wa parport.0.pin-06-in => encoder.3.phase-A
net wb parport.0.pin-07-in => encoder.3.phase-B

setp encoder.0.scale 5080
setp encoder.1.scale 5080
setp encoder.2.scale 5080
setp encoder.3.scale 5080

loadusr halmeter -s -pin encoder.0.position
loadusr halmeter -s -pin encoder.1.position
loadusr halmeter -s -pin encoder.2.position
loadusr halmeter -s -pin encoder.3.position

start

This is typed from memory, so don't expect it to work first time.
It sets up a very basic HAL session, loads the parport driver and some encoders. makes the connections then opens a set of 4 halmeter indicators.

This is very basic, there is no way to tell which axis is which, and no way to zero an axis or set a value.
For those functions a simple GladeVCP panel could be used, potentially with a touchscreen and pop-up keyboard.
(I quite like the idea of writing that, if you don't).

it's a slight pity that you already ordered a PCI parallel port card, for $80 you could have ordered a mesa 5i25 which looks exactly like a parallel port card but can count encoders at 10Mhz rather than 20kHz.
Last edit: 26 Nov 2014 21:24 by andypugh.

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 22:27 #53449 by Jake
I didn't get a chance to order that card this morning so I will just get one of the Mesa cards instead!

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 22:31 #53450 by andypugh

I didn't get a chance to order that card this morning so I will just get one of the Mesa cards instead!


OK, that will significantly change the HAL code I wrote above, though the principle stays the same.

For lots of encoders get the 7i77 firmware option. (though it is reasonably easy to swap firmwares)

Please Log in or Create an account to join the conversation.

More
26 Nov 2014 22:50 #53452 by Jake
I didn't get a chance to order that card this morning so I will just get one of the Mesa cards instead!

Please Log in or Create an account to join the conversation.

Time to create page: 0.418 seconds
Powered by Kunena Forum