ODrive spindles
ODrive motor controllers turn brushless motors into high-performance spindles. The FluidBoard talks to ODrives over CAN bus — and unlike most boards, the CAN bus on the FluidBoard is galvanically isolated. That means no ground loops, no noise issues, and no fried electronics.
What you get
- Closed-loop velocity control — the ODrive manages the motor, the FluidBoard commands the speed
- Forward and reverse (M3/M4) — direction is handled through the gear factor
- CSS compatible — the FluidBoard can update spindle speed in real time during constant surface speed cuts
- Spindle ramping — configurable ramp time, with automatic suppression of false encoder alarms during speed changes
- Automatic tool changer integration — the ODrive spindle config can reference an ATC for automated tool changes
How it works
The ODrive does all of the motor control: it reads the motor's encoder, drives the phases and keeps the motor at the requested velocity. The FluidBoard only tells it which velocity that is. Spindle commands (M3, M4, M5 and the S-word) are converted into a velocity setpoint and sent over CAN to the ODrive with the configured node ID.
CAN is a differential bus: the signal is the voltage difference between CAN-H and CAN-L, which makes it very resistant to noise as long as the two wires are twisted together and the bus is terminated properly. On the FluidBoard, the CAN transceiver is isolated from the rest of the board. The isolated side is powered through the +5V and GND wires from the ODrive, which is why those are part of the wiring below.
Setting up the ODrive
Before wiring to the FluidBoard, set up the ODrive per the ODrive documentation. Make sure it is fully calibrated and running correctly in velocity control mode before attempting CAN communication.
On the ODrive side, check the following:
- The motor and encoder are calibrated, and the motor holds and changes velocity smoothly when controlled from the ODrive tooling.
- CAN is enabled, and the node ID of the axis matches
odrive_node_id in the FluidBoard configuration.
- The velocity and current limits suit your spindle. The ODrive limits are a second safety net behind
max_speed.
- A brake resistor is configured, or the power supply can absorb regenerated energy. When a heavy spindle or chuck decelerates, the motor works as a generator and pushes energy back into the ODrive's DC bus. Without somewhere to put it, the bus voltage rises and the ODrive stops with an overvoltage error, which leaves the spindle coasting.
Wiring
The CAN bus is galvanically isolated, so ground loops aren't a concern. Wire as follows:
| ODrive pin |
FluidBoard pin |
Description |
| GND |
GND |
Isolated ground |
| CAN-H |
H |
CAN high |
| CAN-L |
L |
CAN low |
| +5V |
Vcc |
Isolated 5V |
If +5V and GND aren't available near the CAN connector on your ODrive, you can use the +5V and GND from the encoder inputs.
When using a single FluidBoard and ODrive, enable the 120 Ω termination jumper on the FluidBoard.
A CAN bus needs a 120 Ω termination at both ends, so the ODrive end must be terminated as well. Many ODrive boards have a switch or jumper for this; check the documentation of your model. With both ends terminated and the power off, you should measure about 60 Ω between H and L. About 120 Ω means one end is missing its termination; a very low value means there are too many terminators or a short.
Some more wiring tips:
- Use a twisted pair for CAN-H and CAN-L. A spare pair of a CAT-6 cable works well, with GND and +5V on another pair.
- Route the cable away from the motor phase wires and mains cables.
- Keep the cable a single run from the FluidBoard to the ODrive, without branches.
Configuration
can:
tx_pin: gpio.9
rx_pin: gpio.47
baud_kbit: 500
odrive:
odrive_node_id: 1
gear_factor: -0.777778 # Negative = reverse direction; ratio for gearing
max_speed: 3000 # Maximum RPM
atc: pneumatic_tool_turret # Optional: which ATC to use for tool changes
The ODrive parameters (encoder counts, current limits, etc.) are downloaded automatically by the FluidBoard at startup.
The can: section sets up the CAN bus itself. The bus runs at 500 kbit/s; set the ODrive's CAN bit rate to the same value. Older configurations put can_tx and can_rx inside the odrive: section; that still works, but the firmware warns that it is deprecated.
odrive_node_id must be the same number as the node ID configured on the ODrive.
gear_factor converts spindle speed to motor speed: motor RPM = spindle RPM × gear_factor. With a belt drive where the spindle pulley has 36 teeth and the motor pulley 28, that is 28/36 ≈ 0.7778. If the spindle turns the wrong way, flip the sign; if the speed is consistently off by the same factor, correct the value. It matters most for spindle-synchronized work such as threading, so get it exact rather than close.
max_speed limits the spindle speed in RPM. Set it no higher than what the spindle, the chuck and the workpiece can safely handle.
Remove the atc line if you don't have an automatic tool changer.
Testing it
Do the first run with the chuck empty or the work securely clamped, guards in place and nothing loose on the spindle.
- Power up the ODrive and the FluidBoard, and check that the FluidBoard reports no errors about the ODrive at startup.
- Send
M3 S200. The spindle should start slowly in the forward direction.
- Check the actual speed with a tachometer or the ODrive tooling. If it doesn't match, correct
gear_factor.
- Send
M5 and check that the spindle ramps down and stops.
- Send
M4 S200 to check reverse, then M5.
- Increase the speed in steps up to your normal working range, and watch for overvoltage errors when stopping.
Troubleshooting
| Symptom |
Likely cause |
Fix |
| No communication with the ODrive |
No +5V/GND on the isolated side |
Connect +5V and GND from the ODrive (or its encoder connector) |
| No communication with the ODrive |
Node ID mismatch |
Make odrive_node_id match the node ID on the ODrive |
| No communication, or intermittent errors |
Missing or double termination, H and L swapped |
Measure about 60 Ω between H and L with the power off; check H to H and L to L |
| Spindle turns the wrong way |
Sign of gear_factor |
Flip the sign of gear_factor |
| Spindle speed is wrong by a constant factor |
Wrong ratio in gear_factor |
Measure the real speed and correct the ratio |
| ODrive stops with an error when the spindle slows down |
DC bus overvoltage from regeneration |
Configure a brake resistor or lower the deceleration |