Overview
Introduction¤
The motion controller project FluidNC allows for the expansion of functionality using its channels protocol. In addition to receiving GRBL g-codes and extension commands over a UART channel, FluidNC will provide a stream of data that follows the GRBL Line Protocol and FluidNC's serial protocol. This data can be used to update a display, control other devices, etc. Over a UART channel, FluidNC will also send initialization information that describes how the channel listener (aka expander) should configure itself so that it can receive specific control commands.
FluidPy is a python library that provides an interface for interacting with FluidNC's serial protocol.
Platforms¤
FluidPy is currently supported on Python 3.10+, MicroPython and CircuitPython which enables interfacing with the FluidNC controller on multiple platforms including microcontrollers, single board computers (with a GPIO header such as a RaspberryPi) or even full desktop computers (with a serial to USB adapter).
Wiring diagrams are below for a few example platforms. When defining the uart section in your FluidNC config, note the Tx pin of the controller connects to the Rx pin of the expander microcontroller; and the controller's Rx pin to the expander's Tx pin.
Getting started...¤
Additional details can be found at read the docs.
...with microcontrollers¤
CircuitPython can be run on a wide range of microcontrollers.
- Install CircuitPython per the instructions on the CircuitPython website.
- Clone this repository and copy the contents of
src/fluidpyto thelib/fluidpydirectory of your CircuitPython device. - Copy
examples/cpy_example/main.pytomain.pyon your device (deletecode.pyif it exists).
...with computers¤
- Create a new python virtual environment:
python -m venv .venv; source .venv/bin/activate - Install the fluidpy library:
pip install fluidpy - Copy
examples/py_example.pyto your project directory asmain.py.
Connections¤
Note: Microcontrollers can be powered by the +5V from the UART header or the RJ12 connector, but should not be connected while communicating with the microcontroller via USB.