This project is a hardware and software solution designed to enable multi-material resin 3D printing on an Anycubic Photon Mono X 6k printer. It was developed as a collaborative project between Scion and the Massey AgriFood Digital Lab.
The system uses a single-board computer (like a Raspberry Pi) to act as an intermediary between the printer and a custom-built multi-material unit (MMU) consisting of stepper motor-driven pumps. It allows a user to define a print plan where different materials (resins) are automatically swapped at specific layer heights.
- Control Unit: A Raspberry Pi runs the control software, connects to the printer via Wi-Fi, and interfaces with the MMU hardware via GPIO pins.
- Graphical User Interface (GUI): A user-friendly desktop application built with C++/Qt. It serves as the central control panel for all printing and hardware operations.
- Multi-Material Unit (MMU): The physical hardware, composed of stepper motors and pumps, responsible for swapping the resins in the printer's vat.
- Control Scripts: A collection of Python scripts that handle the low-level logic, including:
- Communicating with the printer to get status, send commands (pause, resume, etc.).
- Controlling the MMU's stepper motors.
- Executing the automated multi-material print cycle.
- Network Management: Switch between Access Point mode (creates own WiFi) and client mode (connects to existing WiFi)
- File Management: List and select printable files stored on the printer's internal memory
- Standard Print Operations: Start, pause, resume, and stop prints directly from the interface
- Multi-Material Recipe System: Define sequences of material changes based on specific layer numbers
- Automated Print Execution: The system automatically executes multi-material recipes by:
- Continuously polling the printer for its current layer number
- Pausing the print job when a target layer is reached
- Activating the correct pumps to perform the material swap
- Resuming the print job automatically
- Manual Pump Control: Run any pump forwards or backwards for specified durations (maintenance and setup)
- Live Operation Logging: Real-time feedback on commands sent, printer status, and script actions
- Configuration Management: External configuration files for network settings and pump profiles
- Raspberry Pi 4 or similar Linux computer
- Multi-material unit hardware with controllable pumps
- Compatible resin 3D printer (tested with Anycubic Photon series)
- Network connectivity (WiFi or Ethernet)
-
Clone the repository:
git clone https://github.com/ScionResearch/multi-material-printer.git cd multi-material-printer
-
Enable Hardware Interfaces (First-Time Raspberry Pi Setup):
sudo raspi-config
- Go to:
3 Interface Options
βI5 I2C
- Select
<Yes>
to enable the I2C interface - Reboot when prompted:
sudo reboot
β οΈ Critical: The Adafruit motor controllers will fail if the I2C interface is not enabled. - Go to:
-
Run the installation script:
chmod +x tools/install_dependencies.sh sudo ./tools/install_dependencies.sh
-
Configure your setup:
- Edit
config/network_settings.ini
for your network - Edit
config/pump_profiles.json
for your hardware setup
- Edit
-
Build and run:
cd src/gui qmake ScionMMUController.pro make ../../build/ScionMMUController
Current Setup (ESP32 Gateway + Access Point Mode) Note: This configuration is specific to the current hardware setup
Network topology:
- 192.168.4.1 - ESP32 WiFi gateway/router
- 192.168.4.2 - Raspberry Pi (control unit)
- 192.168.4.3 - 3D Printer (communication endpoint)
- The ESP32 creates the WiFi network and acts as gateway
- Configure printer IP in your setup:
Update the
cp config/network_settings.ini.template config/network_settings.ini nano config/network_settings.ini
[printer]
section:[printer] ip_address = "192.168.4.3" port = 6000
Alternative: Standard WiFi Client Mode
- Switch to client mode:
sudo ./tools/stopAP.sh
- Both Pi and printer connect to existing WiFi (requires IP discovery)
-
Launch the Application:
./build/ScionMMUController
-
Check Connection:
- Click "Check Status" button
- Status should show "Connected..." if printer is reachable
-
Setup Multi-Material Print:
- Define material recipe in format:
MATERIAL,LAYER:MATERIAL,LAYER
- Example:
A,50:B,120:C,200
(switch to A at layer 50, B at 120, C at 200) - Click "Set" to save recipe
- Define material recipe in format:
-
Start Multi-Material Print:
- Start print job on printer (or use "Get Files" to select from GUI)
- Click "Begin MM" to start automated material swapping
- System monitors layers and performs swaps automatically
- Motor Control: Test pumps with format
PUMP,DIRECTION,TIME
(e.g.,A,F,30
)PUMP
: A, B, C, or DDIRECTION
: F (Forward) or R (Reverse)TIME
: Duration in seconds
- Printer Controls: Direct pause/resume/stop commands to printer
- Stop MM: Halt automated material swapping (printer continues)
multi-material-printer/
βββ README.md # This file
βββ TODO.md # Development roadmap and tasks
βββ .gitignore # Git ignore rules
βββ requirements.txt # Python dependencies
β
βββ archive/ # Archived legacy files
βββ build/ # Compiled applications and build artifacts
β βββ ScionMMUController # Main GUI executable (after build)
β
βββ config/ # Configuration files
β βββ network_settings.ini.template # Network configuration template
β βββ network_settings.ini # User network settings (create from template)
β βββ pump_profiles.json # Pump calibration and profiles
β βββ wpa_supplicant.conf # WiFi configuration (legacy)
β
βββ src/ # Source code
β βββ gui/ # Qt C++ GUI application
β β βββ main.cpp # Application entry point
β β βββ dialog.cpp/.h # Main dialog window
β β βββ configmanager.cpp/.h # Configuration management
β β βββ dialog.ui # UI layout file
β β βββ ScionMMUController.pro # Qt project file
β β βββ assets.qrc # Qt resource file
β β βββ assets/ # Images and UI resources
β β
β βββ controller/ # Python control modules
β βββ __init__.py # Python package initialization
β βββ print_manager.py # Print orchestration wrapper
β βββ mmu_control.py # Pump control wrapper
β βββ printer_comms.py # Printer communication wrapper
β βββ pollphoton.py # Original polling script
β βββ newmonox.py # Original printer communication
β βββ photonmmu_pump.py # Original pump control
β
βββ tools/ # Utilities and setup scripts
βββ install_dependencies.sh # System setup script
βββ startAP.sh # Enable WiFi access point mode
βββ stopAP.sh # Switch to WiFi client mode
For Current ESP32 Setup:
Create and edit config/network_settings.ini
:
cp config/network_settings.ini.template config/network_settings.ini
Key settings for current hardware:
[printer]
ip_address = "192.168.4.3" # Printer endpoint
port = 6000 # Anycubic communication port
timeout = 10
For Standard WiFi Networks:
[wifi]
ssid = "YourWiFiNetwork"
password = "YourPassword"
enabled = true
[printer]
ip_address = "" # Auto-discovery
port = 6000
Edit config/pump_profiles.json
:
{
"pumps": {
"pump_a": {
"name": "Pump A",
"gpio_pin": 18,
"flow_rate_ml_per_second": 2.5,
"calibration": {
"steps_per_ml": 100
}
}
},
"material_change": {
"drain_volume_ml": 50,
"fill_volume_ml": 45,
"mixing_time_seconds": 10
}
}
Prerequisites:
- Qt5 development libraries
- Python 3.7+
- CMake or qmake
Build Steps:
cd src/gui
qmake ScionMMUController.pro
make
βββββββββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββ
β Qt GUI β β Python Controller β β Hardware β
β (ScionMMUController)βββββΊβ (print_manager) βββββΊβ (Printer + MMU) β
βββββββββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββ
The GUI application communicates with Python controller modules via subprocess calls and file-based messaging. The Python modules handle low-level hardware communication.
- GUI (Qt/C++): User interface, recipe editing, status display
- Print Manager (Python): Orchestrates printing process, monitors printer status
- MMU Control (Python): Pump control, material handling
- Printer Comms (Python): Network communication with 3D printer
- Raspberry Pi with GPIO access
- Test pumps or pump simulators
- Network-accessible 3D printer
- Test materials or water for pump testing
- Simulation Mode: Test without hardware
- Pump Test Mode: Test pumps without printer
- Communication Test: Test printer communication without pumps
- Integration Test: Full system test
"Printer Not Found"
- Check network connectivity
- Verify printer IP in config
- Ensure printer is powered on and connected
"Pump Not Responding"
- Check GPIO connections
- Verify pump profiles configuration
- Test individual pumps in calibration mode
"Build Errors"
- Install Qt5 development packages
- Check compiler version (C++11 support required)
- Verify all dependencies are installed
Run with debug output:
./build/ScionMMUController --debug
See TODO.md
for detailed development plans and known issues.
- Follow Qt coding standards for C++ code
- Use PEP 8 for Python code
- Update documentation for new features
- Add tests for critical functionality
- Massey AgriFood Digital Lab (MAFDL) - Initial work and design of the system and software
- Scion Research - Ongoing development
- Jean Henri Odendaal for the lead development of initial phases
- Karl Molving for the modifications and ongoing improvement