A wireless battery powered pendant for FluidNC based on esp32
This controller uses bluetooth for communication. Be aware that bluetooth and wifi can not be used at the same time and, in fact, need different fluid-nc firmwares. Sardar Azari seems to have adapted the controller to communicate via tcp. Take a look at https://github.com/AC8L/FluidNC-Pendant
Display shows: Machine coördinates, Work coördinates, Spindle speed and state, Set speed and step size when using joystick and rotation encoder, Overrides (Speed, Feed, Rapid), Machine state, Battery state, Current buttons functions
Main functions buttons, joystick and dial: Wake up, Jog gantry and spindle via joystick and/or dial, Set Jog step size and speed via dial, Set spindle speed and switch on/off, Set overrides (Speed, Feed, Rapid), Cancel/abort job.
Main functions menu: Home machine, Zero workcoördinates, Go to zero, Probe.
- LilyGO TTGO T-Display V1.1 which is a developmentboard with an ESP32, with a built-in tft (IPS) display and battery-charger. I purchased it for about €13 from internet.
- Rotary encoder / dial (about €1)
- Three colored buttons NO (total of €2)
- PSP joystick (about €3)
- Lion 18650 battery (€7)
- Single-sided pcb
- some pieces of wire (preferably different colors) of which five have female dupont-connectors
- PLA (25 meter)
- 8 screws M3 x 8
The pcb only holds the TTGO developmentboard and the rotary-encoder. The other components are mounted on the lid and wired to the pcb. The schematic of the pcb (in Kicad) is therefore very simple. The isolation-routing of the PCB was done with the very same CNC-router I made this controller for. To fit in the joystick, a corner of the PCB had to be sawed of (I since then updated the edge-cuts in Kicad so now the design should be OK).
The three buttons are at one side connected to the ground (all to J1.1) and are connected tot J1.2, J1.3 and J1.4 respectively. The joystick is connected tot J2 with J2.2 unconnected (since I later decided to wire the VCC of the joystick tot an output-pin).
Programming is done in Arduino IDE. All code exists in one single file. Most constants are enumerated or set with defines at the beginning. I hope it will explain itself to some extent.
Compile with partition scheme minimal SPIFFS or it will not fit.
Schematic drawing of the lid with positioning of the components (excl. battery).
Female headers and the rotary encoder are soldered on the pcb. The other components are connected to the PCB with wires. Plus and minus wires are directly soldered to the battery and connected to the TTGO with a JST-connector.
To further reduce the powerconsumption I decided to feed the joystick via an outputpin of the esp32, which is why you see the red wire soldered on later.
The battery is wired to the JST-connector on the TTGO
The functions of the pendant were tailored to my needs. Below an oversight of the functions of the various buttons and button-combinations and the menu-options. It might be somewhat cryptic but I hope it may help.
JS=Joystick, BD=dial, BR=red button, BG=green button, BY=yellow button
Switch the pendant on: press JS
Reset the pendant: press JS
The pendant powers off after some time when idle or via the appropriate menu-option.
The pendant can either be in home-state (PH) or menu-state (PM).
Function of the dial-knob can be changed by rotating the dial while pressing BG.
Functions can be (default is DJ; function is indicated on the display with a blue circle):
- DX: Jog 1 step X-axis
- DY: Jog 1 step Y-axis
- DZ: Jog 1 step Z-axis
- DS: Set spindle-speed
- DJ: set jogspeed and step-size
- DOF: set override Feed
- DOS: set override Speed
- DOR: set override Rapid
The function of the buttons depend on the machine-state (MS, shown in the middle of the display of the pendant; function of BR, BG, BY shown on the bottom line of the display). They are as follows.
PH:
- JS + MS=Idle or MS=Jog:
- Up/down: jog Y-axis
- Left/Right: jog X-axis
- JS + MS=Idle or MS=Jog + BR (keep pressed)
- Up/down: jog Z-axis
- Left/Right: no function
- BG: enter PM
- BY: abort machine-operation
- BG (keep pressed) + BD: Change function dial-knob
- BR + MS=Alarm: Unlock Machine
- BR + DS: Spindle on/off
PM:
- BD: navigate menu (poweroff, spindlespeed, spindle on/off, small/large steps for changing jogspeed/stepsize, exit menu, home the machine, Set current Work XY-position to zero, Set current Work Z-position to zero, Probe Z-axis, Jog machine to XY-position zero, unlock Machine (grbl), reset Machine (grbl), Set and save brightness).
- BG: confirm menu-choice
- BR: Cancel
- BR (long press): poweroff
Powering on the pendant while keeping the the red button pressed will start Wifi and activate OTA (Over The Air programming from within the Arduino IDE).