Bambu Conveyor for ESP32
Overview
The Bambu Conveyor is an application designed to manage the waste output of a Bambu Labs 3D printer. It utilizes the MQTT protocol (or Motion detection) to monitor the printer’s status and control a motor that moves waste material away from the printing area.
Features
Two Modes of Operation: MQTT or Motion Detection
The Bambu Poop Conveyor supports two methods for triggering the conveyor, depending on your printer model and preference.
1. MQTT Mode (Recommended for X1C) (Default setting)
- Best suited for X1C printers due to their more powerful CPU, which handles MQTT updates more efficiently.
- Listens for printer status changes (Change Filament status and Clean nozzle status) and automatically activates the conveyor when needed.
- Requires a stable network connection and correct MQTT setup.
2. IR Motion Detection Mode (Better for P1 & A1 Series)
- Ideal for P1 and A1 series printers, where MQTT performance can be inconsistent.
- Uses the HiLetgo AM312 PIR sensor to detect movement and trigger the conveyor.
- Works independently of network conditions, making it a more reliable option for some setups.
You can configure which mode to use in the settings. If Motion Sensor Mode is active, MQTT Mode is disabled, and vice versa.
Conveyor Makerworld files (Print these)
-
Conveyor: https://makerworld.com/en/models/148083#profileId-161573
-
Housing:
https://makerworld.com/en/models/1071359#profileId-1061316
Optional prints
-
The back chute that I use: https://makerworld.com/en/models/59961#profileId-81417
-
Conveyor Extension: Optional: If you need your conveyor to be longer use this. (I use one extension in my build): https://makerworld.com/en/models/249714#profileId-359905
Required parts used for this build:
- Breakout board for ESP32: https://amzn.to/4dyjsx0
- ESP32 board: https://amzn.to/4fBjh5L
- 12 Volt power supply: https://amzn.to/3AfIm6a
- Motor Controller: https://amzn.to/3yBPqcM
- 12V 10RPM Motor: https://amzn.to/3M24VOd
- Resistors (I use 470Ω - you need 3 from this kit): https://amzn.to/4cqCi8e
- Wires: https://amzn.to/46EAtn3
- LED’s sourced from this kit: https://amzn.to/4dH5Dw7
Optional parts:
- Motion sensor (For Motion Sensor mode): https://amzn.to/4gtN4gd
- Power connector: https://amzn.to/3T4xRsS
- I use these bearings on my conveyor for smoother action: https://amzn.to/4hjW0WD
Setup
GPIO Pins
The application uses the following GPIO pins for motor and LED control:
const int greenLight = 19;
const int yellowLight = 18;
const int redLight = 4;
int motor1Pin1 = 23;
int motor1Pin2 = 21;
int enable1Pin = 15;
const int motionSensorPin = 22;
Wiring diagram
Note:
- The wire color in the diagram will not exactly match my project wires that you will see in the next few images.
- Be sure to use resistors on your LED positive terminals or they will burn out eventually.
- FAQ: How does the ESP32 get power? On the L298N motor controller there is a 12v IN and an optional 5V OUT. The 5V out runs to the ESP32 > VIN (Voltage In) line, which can handle 3-5v. This solution allows us to use one power source (12V) to power our entire project.
- Do not remove any of the jumper pins on the L298N Motor Controller. 5V out is required for the ESP32 as mentioned. See this photo for reference.
- Having issues figuring out GPIO port 15? Here is a reference photo of my setup, I’ve been able to remove the jumper on the motor 1 enable pin and use the first pin to connect.
After hooking everything up it should look something like this
Fully assembled
LED Insert before/after assembly
Insert LED
LED Insert - fully assembled
Flashing the ESP32
To install the firmware, use one of the following methods:
Method 1: Web installer (Easiest Method)
Go here to install via the web (must be on chrome or edge): Bambu ESP32 Installer
Method 2: Manual installation (Expert)
-
Download and Install ESPTool
- Install
esptool
using pip:pip install esptool
- Alternatively, download the precompiled ESPTool from the official Espressif GitHub.
- Install
-
Download the Firmware File Bambu-Poop-Conveyor.v1.3.4-final.bin
-
Connect Your ESP32
- Plug your ESP32 into your computer using a USB cable.
- Ensure drivers for the USB-to-serial adapter are installed (CH340, CP210x, etc.).
-
Find the Serial Port
- On macOS/Linux, run:
Look for something like
ls /dev/tty.*
/dev/tty.usbserial-1
. - On Windows, open Device Manager and check under Ports (COM & LPT).
- On macOS/Linux, run:
-
Flash the Firmware
- Replace
<PORT>
with your ESP32’s serial port (e.g.,/dev/tty.usbserial-1
):esptool.py --chip esp32 --port /dev/tty.usbserial-1 --baud 460800 write_flash \ 0x0 Bambu-Poop-Conveyor.v1.3.4-final.bin
- Replace
-
Verify Flashing and Restart
- Once flashing completes, restart your ESP32 by unplugging/replugging it or pressing the EN or RST button.
Your ESP32 should now be running the updated firmware.
Once firmware is installed
The latest version introduces AP Mode, making configuration easier. Now, after flashing the ESP32, it will start in Access Point (AP) Mode.
- Power on your ESP32.
- Connect your computer/phone to the BambuConveyor WiFi network. Password: 12345678
- Open a browser and go to 192.168.4.1/config.
- Enter all your settings including Bambu printer settings.
- Click Save, and the ESP32 will reboot into the configured WiFi network.
Usage
Web Server
The application hosts a web server to provide manual control and configuration. Access the following URLs for different functionalities:
- Root URL: Opens config page (
/
) - Control URL: Manual motor control page (
/control
) - Config URL: Configuration page to update settings (
/config
) - Logs URL: Log history page (
/logs
) - Manual Run URL: Opening this URL runs the motor manually (
/run
)
Configuration Screen
Note: If in Motion Detection mode, be sure to lower the “Delay After Run”. Recommended time is 3000 (3 seconds).
Log screen
Motor Control Timings
Optioal - Configure the motor run time and wait time:
int motorRunTime = 10000; // 10 seconds by default / I prefer 5000 as the poop doesnt come out fast enough for you to need anymore than that, but 10 seconds is just more exciting
int motorWaitTime = 5000; // The time to wait to run the motor. / We dont want the conveyor to run right when the status is detected, 5 seconds is just right in my case
int delayAfterRun = 120000; // Delay after motor run / We dont want it to run again anytime soon
Note: If in Motion Detection mode, be sure to lower the “Delay After Run”. Recommended time is 3000 (3 seconds).
PWM Configuration
Optional - set the PWM properties for motor control:
const int freq = 5000;
const int pwmChannel = 0;
const int resolution = 8;
int dutyCycle = 220; // Motors power level (255 for full power) / I run just under that for no reason other than my own preference
FAQ / Troubleshooting
Before troubleshooting make sure you are not in AP mode, when in AP mode, the motor will not run, it must be connected to wifi to work
What do the flashing lights mean when its first turned on?
- Flashing yellow only = Connecting to WiFi
- Solid Green = We are connected to Wifi and MQTT printer
- Red Light on bootup = No Wifi / No MQTT (Solid red also when conveyor is running)
- Green light / Yellow flashing = Wifi connected / Attempting to connect to printer
- Green light / Yellow solid = Wifi connected / Issue connecting to printer via MQTT / Will reattempt connection after 5 seconds
The ESP32 doesnt connect to the printer
- Double check that your printer is setup with Access Code and LAN only mode is OFF See Bambu Wiki
- Double check your SN matches the settings you put in
- Make sure your printer has good Wifi signal
- Make sure the ESP32 has good Wifi signal
- Reach out to me if you still have issues
Motion dection mode not working
- Verify the wires are properly configured, the 3v should be connected to the bottom left of the motion sensor.
License
This project is licensed under the MIT License. See the LICENSE file for details.