Hi Onkelmat,
I picked the Sinumerik panel because I like the touch and feel and the bunch of user knobs avail.
And it is quite affordable (at least here in Europe).
Profibus needs a hard realtime capable master and protocol is patented by Siemens. So i picked the passive one, without any electronics. It is simple as it can be. It is not multiplexed. Every key has its own signal, the LEDs also. The multi position knobs for feed and spindle speed are binary coded.
Only the stop keys are kind of special. They have a pullup and a resistor to allow fail state detection with a window discriminator curcuit.
So you only need 80 digital TTL level inputs, three window discriminator curcuit and 48 outputs and you are ready to go.
I decided to make a PCB to interface the Machine Control Panel from its two 64pin ribbon cables with all the key, knob and LED signals to
- Modbus RTU over isolated RS485 and isolated USB
- Modbus over Ethernet (that is isolated by definition)
- CAN/CANOpen over isolated CAN.
(of course only one Interface is needed simultaneously )
It is powered by a 24V supply or by a floppy power connector.
Because there was some space left on the PCB I added 4 isolated 12-24V 300mA outputs for a stacked signal light and a TTL quadraturencoder input with index for a jog wheel.
The software side looks like this:
MB2Hal uses a RS485 (USB Dongle) to communicate with the board. I grouped the keys and LEDs into three modus groups each OpMode, Axis and User.
The Signals from MB2Hal are connected to halui.
The quadratur signal is not supported yet.
The Sinumerik keys match the LinuxCNC functions quite good, only the teach in key has no equivalent. (But of course can dedicate it to an other signal.)
In addition to the feed stop Sinumerik has a spindle start/stop that stops the feedrate followed by the spindel.
(at least our old Sinumerik 810 does it this way)
I think that can be emulated by a small sequencer.
What I do miss is the Sinumerik style single stepping, that LinuxCNC handles completly different.
On the other side LinuxCNC can override jog feedrate, what the Sinumerik panel does not support with a knob.
I think about using keys so set jog feedrate 10, 20, 50 , 80 and 100%
I used the component toggle2nist (which actually has a bug) to convert e.g. the coolant on and off switch to a toggle switch.But this is a matter of taste.
For the stacked light i wrote a simple component that combines halui.mode.is-auto, halui.program.is-running and halui.machine.is-on to some (blinking) light states.
I love the result. Build it in a Brother TC211 retrofit. Others will come.
Feels much better to control the machine using dedicated keys and indicators.
( The picture shows two boards mounted on two different MCPs. Some communication interfaces are not mounted. Due to the chip shortage I only populated them when needed.)
attached the modbus.hal and modbus.ini
cheers
Rainer
modbus.hal
Code:
# http://linuxcnc.org/docs/html/man/man1/halui.1.html
loadusr -W mb2hal config=./hallib/modbus.ini
loadrt toggle2nist names=BlockToggle,CoolantToggle,MistToggle,OptionalStopToggle
addf BlockToggle base-thread
addf CoolantToggle base-thread
addf MistToggle base-thread
addf OptionalStopToggle base-thread
loadrt jogbykeys count=1
addf jogbykeys.0 servo-thread
loadrt nothomedwarning names=nothomedwarn
addf nothomedwarn base-thread
net MaschinenstatusRot stackedsignal.0.red => mb2hal.StackedLight.00
net MaschinenstatusGelb stackedsignal.0.yellow => mb2hal.StackedLight.01
net MaschinenstatusGruen stackedsignal.0.green => mb2hal.StackedLight.02
net Abort halui.abort mb2hal.OpmodeKey.00
net AutoModeReq halui.mode.auto mb2hal.OpmodeKey.04
net JogModeReq halui.mode.joint mb2hal.OpmodeKey.01
net MDIModeReq halui.mode.mdi mb2hal.OpmodeKey.03
net PRGStopReq halui.program.stop mb2hal.OpmodeKey.06
net programIsIdle halui.program.is-idle mb2hal.OpmodeLed.06
net PRGStartReq halui.program.run => mb2hal.OpmodeKey.07
net programIsRunning mb2hal.OpmodeLed.07
net FEEDPauseReq halui.program.pause mb2hal.AxisKey.17
net FEEDPauseAct halui.program.is-paused mb2hal.AxisLed.17
net FEEDResumeReq halui.program.resume mb2hal.AxisKey.18
net HomeAllRequest mb2hal.OpmodeKey.09 halui.home-all
setp nothomedwarn.chanelcount 3
net join0homed halui.joint.0.is-homed nothomedwarn.is-homed0
net join1homed halui.joint.1.is-homed nothomedwarn.is-homed1
net join2homed halui.joint.2.is-homed nothomedwarn.is-homed2
net jointshomed nothomedwarn.all-homed mb2hal.OpmodeLed.09
net JogINCVAR mb2hal.OpmodeKey.10 jogbykeys.0.req-jog-var
net JogINC1 mb2hal.OpmodeKey.11 jogbykeys.0.req-jog-inc-1
net JogINC10 mb2hal.OpmodeKey.12 jogbykeys.0.req-jog-inc-10
net JogINC100 mb2hal.OpmodeKey.13 jogbykeys.0.req-jog-inc-100
net JogINC1000 mb2hal.OpmodeKey.14 jogbykeys.0.req-jog-inc-1000
net JogINC10000 mb2hal.OpmodeKey.15 jogbykeys.0.req-jog-inc-10000
net IsJogINCVAR jogbykeys.0.is-jog-var mb2hal.OpmodeLed.10
net IsJogINC1 jogbykeys.0.is-jog-inc-1 mb2hal.OpmodeLed.11
net IsJogINC10 jogbykeys.0.is-jog-inc-10 mb2hal.OpmodeLed.12
net IsJogINC100 jogbykeys.0.is-jog-inc-100 mb2hal.OpmodeLed.13
net IsJogINC1000 jogbykeys.0.is-jog-inc-1000 mb2hal.OpmodeLed.14
net IsJogINC10000 jogbykeys.0.is-jog-inc-10000 mb2hal.OpmodeLed.15
setp jogbykeys.0.jog-set-low-speed 100
setp jogbykeys.0.jog-set-hi-speed 600
net JogVarSpeedValue halui.joint.jog-speed jogbykeys.0.jog-set-var-speed
net JogVarIncValue halui.joint.selected.increment jogbykeys.0.jog-set-inc
net JogKeyInMinus jogbykeys.0.jog-minus mb2hal.AxisKey.12 mb2hal.AxisLed.12
net JogKeyInSPUP jogbykeys.0.jog-speedup mb2hal.AxisKey.13
net JogKeyInPlus jogbykeys.0.jog-plus mb2hal.AxisKey.14 mb2hal.AxisLed.14
net JogMinusInc halui.joint.selected.increment-minus jogbykeys.0.jog-inc-minus
net JogPlusInc halui.joint.selected.increment-plus jogbykeys.0.jog-inc-plus
net JogMinus halui.joint.selected.minus jogbykeys.0.jog-var-minus
net JogPlus halui.joint.selected.plus jogbykeys.0.jog-var-plus
net JointSelXreq halui.joint.0.select mb2hal.AxisKey.00
net JointSelYreq halui.joint.1.select mb2hal.AxisKey.01
net JointSelZreq halui.joint.2.select mb2hal.AxisKey.02
#net JointSelAreq halui.joint.3.select mb2hal.AxisKey.03
net JointSelXAct halui.joint.0.is-selected mb2hal.AxisLed.00
net JointSelYAct halui.joint.1.is-selected mb2hal.AxisLed.01
net JointSelZAct halui.joint.2.is-selected mb2hal.AxisLed.02
#net JointSelAAct halui.joint.3.is-selected mb2hal.AxisLed.03
net modeIsAuto mb2hal.OpmodeLed.04
net JointModeAct halui.mode.is-joint or2_manual_joint_mode.in0
net ManModeAct halui.mode.is-manual or2_manual_joint_mode.in1
net ManOrJogModeAct or2_manual_joint_mode.out mb2hal.OpmodeLed.01
net MDIModeAct halui.mode.is-mdi mb2hal.OpmodeLed.03
# BlockToggle,CoolantToggle
net FloodTogIn mb2hal.UserKey.00 CoolantToggle.in
net FloodOnReq CoolantToggle.on halui.flood.on
net FloodOffReq CoolantToggle.off halui.flood.off
net FloodIsOn halui.flood.is-on CoolantToggle.is-on mb2hal.UserLed.00
net MistTogIn mb2hal.UserKey.01 MistToggle.in
net MistOnReq MistToggle.on halui.mist.on
net MistOffReq MistToggle.off halui.mist.off
net MistIsOn halui.mist.is-on MistToggle.is-on mb2hal.UserLed.01
net OptStopTogIn mb2hal.UserKey.03 OptionalStopToggle.in
net OptStopOnReq OptionalStopToggle.on halui.program.optional-stop.on
net OptStopOffReq OptionalStopToggle.off halui.program.optional-stop.off
net OptStopIsOn halui.program.optional-stop.is-on OptionalStopToggle.is-on mb2hal.UserLed.03
net BLOCKMODETogIn mb2hal.UserKey.04 BlockToggle.in
net BLOCKMODEOnReq BlockToggle.on halui.program.block-delete.on
net BLOCKMODEOffReq BlockToggle.off halui.program.block-delete.off
net BLOCKMODEIsOn halui.program.block-delete.is-on => BlockToggle.is-on => mb2hal.UserLed.04
net SpindleStop halui.spindle.0.stop mb2hal.AxisKey.15
net SpindleStart halui.spindle.0.start mb2hal.AxisKey.16
setp halui.spindle.0.override.direct-value 1
setp halui.spindle.0.override.count-enable 1
setp halui.spindle.0.override.scale 0.01
setp halui.feed-override.direct-value 1
setp halui.feed-override.count-enable 1
setp halui.feed-override.scale 0.01
setp halui.rapid-override.direct-value 1
setp halui.rapid-override.count-enable 1
setp halui.rapid-override.scale 0.01
net SpindleSet mb2hal.Knob.00.int => halui.spindle.0.override.counts
net FeedSet mb2hal.Knob.01.int => halui.feed-override.counts => halui.rapid-override.counts
modbus.ini
Code:
[MB2HAL_INIT]
INIT_DEBUG=3
HAL_MODULE_NAME=mb2hal
SLOWDOWN=0.0
TOTAL_TRANSACTIONS=8
[TRANSACTION_00]
LINK_TYPE=serial
SERIAL_PORT=/dev/ttyUSB0
SERIAL_BAUD=115200
SERIAL_BITS=8
SERIAL_PARITY=even
SERIAL_STOP=1
SERIAL_DELAY_MS=1
MB_SLAVE_ID=10
MB_TX_CODE=fnct_02_read_discrete_inputs
FIRST_ELEMENT=0
NELEMENTS=16
HAL_TX_NAME=OpmodeKey
MAX_UPDATE_RATE=8.0
MB_RESPONSE_TIMEOUT_MS=50
MB_BYTE_TIMEOUT_MS=50
DEBUG=0
[TRANSACTION_01]
MB_TX_CODE=fnct_02_read_discrete_inputs
FIRST_ELEMENT=16
NELEMENTS=19
HAL_TX_NAME=AxisKey
DEBUG=0
[TRANSACTION_02]
MB_TX_CODE=fnct_02_read_discrete_inputs
FIRST_ELEMENT=40
NELEMENTS=15
HAL_TX_NAME=UserKey
DEBUG=0
[TRANSACTION_03]
MB_TX_CODE=fnct_15_write_multiple_coils
FIRST_ELEMENT=0
NELEMENTS=16
HAL_TX_NAME=OpmodeLed
DEBUG=0
[TRANSACTION_04]
MB_TX_CODE=fnct_15_write_multiple_coils
FIRST_ELEMENT=16
NELEMENTS=19
HAL_TX_NAME=AxisLed
DEBUG=0
[TRANSACTION_05]
MB_TX_CODE=fnct_15_write_multiple_coils
FIRST_ELEMENT=40
NELEMENTS=15
HAL_TX_NAME=UserLed
DEBUG=0
[TRANSACTION_06]
MB_TX_CODE=fnct_03_read_holding_registers
FIRST_ELEMENT=0
NELEMENTS=2
HAL_TX_NAME=Knob
DEBUG=0
[TRANSACTION_07]
MB_TX_CODE=fnct_15_write_multiple_coils
FIRST_ELEMENT=56
NELEMENTS=4
HAL_TX_NAME=StackedLight
DEBUG=0