onsdag den 15. august 2018

PNC-3000 Part 9 Electronics

I promised in one of the first posts, that I would get back to the electronics.

The time has come..

Besides an design goof I made, that caused both set of 4503N to be active at the same time, the only thing I have changed from the initial design is to add a jumper that makes it possible to short IO-SELECT and Powerdown, forcing the stepper drivers out of power save, when LinuxCNC is controlling the mill.
I did this because I couldn't find a way to have LinuxCNC control when the drivers should be powered down, this is a bit of a dirty hack, but it gets the job done. There are two drawbacks to this hack, 1. you are wasting power and wearing on the electronics for no reason, and 2. you have an annoying fizzeling noise from the mill. With some input from the LinuxCNC forum I have managed to fix this.

The circuit is as simple as it is ugly..

The pinout in the connector is this:
Pin Function
1 Z-Dir
2 Power Down
3 Y-Dir
4 X-Dir
5 X-Clock
6 AUX1
7 AUX2 (NC)
8 Y-Clock
9 Motor
10 Z-Clock
11 GND
12 IO-Select

Most pins are self explanatory, but a few of them needs special mentioning.
Pin 12 controls whether the mill should run native or being controlled externally, alternatively shorting the IOSELECT jumper, switches control to external. This pin should be connected to "Servo Enable" in your HAL configuration, this way LinuxCNC is controlling the mill, when it's "powered on" (F2) in the Axis GUI.
Pin 2 controls if the stepper drivers should be in power down or not, if the AUTO-PD jumper is closed, activating IOSELECT will also bring the stepper drivers out of power save.

For a more intelligent use of the powerdown function, add the following to your custom.hal file:
setp parport.0.pin-08-out-invert TRUE

loadrt near
addf near.0 servo-thread
setp near.0.in2 0
setp near.0.difference 0.0000001
net velocity motion.current-vel => near.0.in1

loadrt not
addf not.0 servo-thread
net moving not.0.in <= near.0.out

loadrt oneshot
addf oneshot.0 servo-thread
setp oneshot.0.width 1
setp oneshot.0.rising TRUE
setp oneshot.0.falling TRUE
setp oneshot.0.retriggerable TRUE
net moving oneshot.0.in <= near.0.out

loadrt or2
addf or2.0 servo-thread
net moving-inv or2.0.in0 <= not.0.out
net powerdown-2 or2.0.in1 <= oneshot.0.out

net powerdown parport.0.pin-08-out <= or2.0.out

This disables powerdown, when the mill is moving, and the oneshot function keeps the pin active for 1 second, after movement has stopped. for the time being, it's only bench tested, but it seem to work just fine. I found that if I only monitored motion.current-vel the pin would flicker, when the mill was at constant speed.. ?!? If there are stability issues, oneshot.0.width can just be bumped to a higher value.

Pin 6 and 9 are connected to the two jumpers with the same names, and can be used to intercept signals. So if you wanted to control the motor you could cut the connection between IC41 pin 16 and IC39 pin 2 and lead the connection through the jumper.
Pin 7 is a extra possibility for intercepting signals, but it wasn't practical to populate a jumper on the board.

To add touch probe feedback to LinuxCNC, just connect the collector of TR10 to a pin on your parallel port.

The eagle files for the project can be found here: https://github.com/DerSchultze/PNC-3000_Connector