User inputs

It is often useful to have a few button inputs on a machine. The simplest way to get these are to use a few input pins on the FluidBoard. However, since these are commonly used for probing, alarms and endstops, it is advisable to use a separate input board for user inputs (through the UART connector). Pendants are a good example of this.

We here only discuss physical connections on the input pins.

How it works

Each input goes through an optocoupler: the input current lights a small LED inside the optocoupler, and that light switches a transistor on the controller side. There is no electrical connection between the input terminals and the processor. Noise, a short or a wrong voltage on the input wiring stays on the input side instead of reaching the ESP32.

That protection only holds as long as the input side stays separate, which is the reason for the warning below.

Choosing inputs

Every input you use for a button is no longer available for an endstop or the probe. Count what your machine needs first. A 3-axis machine with one endstop per axis, for example, leaves the a, b and c inputs free for buttons. The 'stop' input is best kept for the emergency stop.

Wiring

Wire inputs to the input terminals of the board. The input terminals are isolated and opto-coupled, and can handle 5v inputs. In most cases, one side of the push button is connected to a GND, and the other to an input.

Use the GND of the input terminals for this, not a GND from elsewhere on the board or the machine.

Do not wire any 5v terminal to the isolated 5v terminal of the inputs, and do not wire the GND of the inputs to any other GND. This will void the isolated output and can cause damage.

The isolated 5v comes from a small 1 W isolated DC/DC converter on the board, which works out to about 200 mA in total for everything connected to it. Buttons, mechanical endstops and touch probes use only a few mA each, so this is plenty for what the inputs are meant for. Check the current draw of powered sensors before connecting several of them, and don't use the isolated 5v to power anything else.

x y z a b c stop probe
input gpio.41 gpio.40 gpio.39 gpio.38 gpio.18 gpio.48 gpio.16 gpio.17

We recommend using the 'stop' input for the emergency stop.

Normally open or normally closed

Buttons and switches come as normally open (NO, the contact closes when pressed) or normally closed (NC, the contact opens when pressed).

  • For anything safety related, such as a safety door, a laser lid interlock or a feed hold button, use NC. A broken wire or a loose screw terminal then looks exactly like a pressed button, so the machine stops instead of silently ignoring the button.
  • For convenience functions like cycle start and macros, NO is fine. A broken wire there just means the button doesn't do anything.

NPN and PNP sensors

The same inputs can be used for sensors, such as a door sensor. An NPN sensor switches its output to GND when active, just like a button to GND. A PNP sensor switches its output to its supply voltage when active. Both can be used, but the active level is opposite, which is what the :low flag in the configuration is for. As with endstops, use sensors rated for 5V.

Noise

Long input wires act as antennas. If a button seems to trigger by itself, for example a feed hold when the spindle starts, the wiring is picking up noise. Run the signal and its GND as a twisted pair, keep the wires away from motor, spindle and mains cables, and use shielded cable for long runs, with the shield connected to earth on one side only.

Configuration

The configuration of inputs is per input. Depending on NPN or PNP, you might need to use :low as a flag on the gpio, to invert the input. For example:

control:
  safety_door_pin: gpio.17
  reset_pin: NO_PIN
  feed_hold_pin: gpio.48:low
  cycle_start_pin: NO_PIN
  macro0_pin: gpio.18:low
  macro1_pin: NO_PIN
  macro2_pin: NO_PIN
  macro3_pin: NO_PIN
  estop_pin: gpio.16

What the functions do:

  • Safety door pauses the job like a feed hold and switches off the spindle. After the door is closed again, the job continues with a cycle start.
  • Reset stops everything immediately, see emergency stop.
  • Feed hold decelerates the machine to a controlled stop and pauses the job. The position is kept.
  • Cycle start starts or resumes the job after a feed hold.
  • Macro 0-3 run the macros defined in your configuration, for example to move to a park position or run a file from the SD card.

Set every function you don't use to NO_PIN.

Testing it

Test each input before you rely on it, with the spindle off and nothing loaded in the machine:

  1. Connect with a serial or telnet console and send ?. When an input is active, the status report contains a Pn: field listing it.
  2. Check that the input is not listed with the button released, and that it appears while you hold the button. Feed hold shows as H, cycle start as S, the safety door as D, reset as R and the probe as P.
  3. If it is the other way around, add or remove :low on that pin and restart.
  4. For an NC button, also disconnect one of its wires and check that the input reads as pressed.
  5. Finally, test the actual function: start a slow move in the air and press the button.

Troubleshooting

Symptom Likely cause Fix
Input always active, or active when released Active level inverted Add or remove :low on the pin
Input never changes Button wired to the wrong GND, or loose terminal Use the GND of the input terminals and check the screw terminals
Machine pauses or resets at random Noise on the input wiring Twisted pair, route away from motor and spindle cables, shield long runs
Endstop or probe stopped working after adding a button The same input is used twice Give each input one function
Safety door won't resume Door still open, or switch not reaching its closed state Close the door, check the switch, then cycle start
Copyright (c) 2024 by NubiloSoft, all rights reserved.
Accepted payment methods