Bambu Conveyor for ESP32
Github: https://github.com/t0nyz0/Bambu-Poop-Conveyor-ESP32 (opens in a new tab)
Overview
The Bambu Conveyor is an application designed to manage the waste output of a Bambu Labs X1 3D printer (opens in a new tab). It utilizes the MQTT protocol to monitor the printer's status and control a motor that moves waste material away from the printing area.
Features
- WiFi and MQTT Connectivity: Connects to a local WiFi network and communicates with the printer via MQTT
- Motor Control: Activates a motor to manage the printer's waste output based on the printer's status
- Web Server: Hosts a web server to provide manual control and configuration of the system
- Stage Monitoring: Monitors various stages of the printer to determine when to activate the motor
Conveyor Makerworld files (Print these)
-
Conveyor: Most of files are in this project: https://makerworld.com/en/models/148083#profileId-161573 (opens in a new tab)
-
Conveyor Extension: 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 (opens in a new tab)
-
Custom Housing: This is the really bad housing I built (but it works): https://makerworld.com/en/models/576315#profileId-496900 (opens in a new tab)
-
Alternative Housing: If you dont want LEDs this is an even better solution for a housing and motor mount: https://makerworld.com/en/models/164413#profileId-180494 (opens in a new tab)
-
The back chute that I use: https://makerworld.com/en/models/59961#profileId-81417 (opens in a new tab)
List of some supplies that you see in this project
- Breakout board for ESP32: https://amzn.to/4dyjsx0 (opens in a new tab)
- ESP32 board: https://amzn.to/4fBjh5L (opens in a new tab)
- 12 Volt power supply: https://amzn.to/3AfIm6a (opens in a new tab)
- Motor Controller: https://amzn.to/3yBPqcM (opens in a new tab)
- 12V 10RPM Motor: https://amzn.to/3M24VOd (opens in a new tab)
- Resistors (I use 1k Ohm): https://amzn.to/4cqCi8e (opens in a new tab)
- Wires: https://amzn.to/46EAtn3 (opens in a new tab)
- LEDs sourced from this kit: https://amzn.to/4dH5Dw7 (opens in a new tab)
- Power connector: https://amzn.to/3T4xRsS (opens in a new tab)
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;
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.
After hooking everything up it should look something like this
I hot glue the LED's in place, worked well for me
Its not ideal but I stuff all this into the box and we are done, the motor rest against the wall in my situation. In the next build I will add better motor mounting and eletronic mounting support
WiFi and MQTT Configuration
Enter your WiFi and MQTT credentials in the following variables:
// WiFi credentials
char ssid[40] = "your-ssid";
char password[40] = "your-password";
// MQTT credentials
char mqtt_server[40] = "your-bambu-printer-ip";
char mqtt_password[30] = "your-bambu-printer-accesscode";
char serial_number[20] = "your-bambu-printer-serial-number";
Note:
- ssid is your WIFI name
- password is the WIFI password
- mqtt_server is your Bambu Printers IP address
- mqtt_password is your Bambu printer access code as found on your printer
- serial_number is your Bambu printer serial number as found on your printer Bambu Wiki - How to find serial number (opens in a new tab)
Installation
- Connect the ESP32 to your computer.
- Open the code (Bambu-Poop-Conveyor.ino) in the Arduino IDE.
Tools > Board > Board Manager
-
Enter your WiFi and MQTT credentials in the respective variables. (Starting around Line: 17)
-
Upload the code to the ESP32.
-
Access the web server via the IP address assigned to the ESP32 to configure and control the application.
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
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
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
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 (opens in a new tab)
- 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
License
This project is licensed under the MIT License. See the LICENSE file for details.