This guide will walk you through the CANbus wiring and setup that is specific to the Mellow SB2040. Please read through our CANbus guide for additional information on CANbus.
Note: Their are two versions of the Mellow SB2040. Some of these pictures will show the v1 version, but where they differ we will note and provide pictures. The software configuration should be the same. For most people the only significant change is the HV Probe (Omron/24v TAP) JST connector is a 90deg connector, which helps with clearance.
The Mellow SB2040 uses a 4pin AMASS XT30 (2+2) connector. Two wires provide the +24v and Ground, the other two are CAN High and CAN Low. This connector needs to be soldered and is difficult to find. The toolhead board comes with a silicon cable, but if you prefer to upgrade to FEP, you can use our Linneo CANBus XT30 Wiring Harness.
You can either run your wiring through your cable chains, like a normal Voron build, or use an umbillical cable.
To set up your SB2040, you will first need to plug it into your Raspberry Pi via USB to install CanBoot. To set your SB2040 to flashing mode, you will need to press and hold the Boot button on the side, then plug it into USB and wait 5 seconds before releasing the button.
Now SSH into your Pi, and if you type lsusb, you should see the device.
Now that the board is detected by your Pi, you need to prepare the CanBoot firmware to install. First we need to download the CanBoot code from Github. This command copies (aka clones) the code from the public repository on GitHub.
pi@hara:~ $ cd ~
pi@hara:~ $ git clone https://github.com/Arksine/CanBoot
Once it is downloaded, you need to change into that directory and run the following…
pi@hara:~ $ cd CanBoot
pi@hara:~ $ make clean
pi@hara:~ $ make menuconfig
Chose the following options. Ensure the CAN bus speed value matches the configuration on your USB Can Adapter (either BTT U2C or Mellow UtoC). Exit and save the config.
Now you need to compile the bootloader. Run the following commands.
pi@hara:~/CanBoot $ make
Now that you have created the CanBoot firmware, you need to flash it onto the board. First you need to know the address of the board, with the lsusb
command.
For this board, the ID is 2e8a:0003
. Now you can flash the board using the following command. Note: you will be prompted for your password.
make flash FLASH_DEVICE=2e8a:0003
At this point, your board is flashed with CanBoot, and you will be able to upload the firmware via CAN in the future. You can unplug your board from the USB cable and connect it to your CAN wiring (to be safe, we recommend powering down your printer to avoid shorting out any electronics).
In almost all cases, you will need to install the jumper to enable the terminating resistor on your SB2040.
Once you have your SB2040 connected via your CANbus wiring, you should be able to query CANbus and detect the board.
python3 ~/CanBoot/scripts/flash_can.py -i can0 -q
If you do not have any “Detected UUID” lines, then your CAN Adaptor board isn't able to see the SB2040, and you will need to do some troubleshooting.
Once you are able to detect the SB2040 toolhead board, you need to build Klipper to install on it (CanBoot is just the boot loader, which makes installing Klipper easier).
cd ~/klipper
make menuconfig
Assuming you have followed these instructions, chose the following options for your SB2040.
Then run make
to actually build Klipper, this will take a few minutes.
Once that is done you need to flash the firmware to the SB2040. You will need to grab the UUID…
python3 ~/CanBoot/scripts/flash_can.py -i can0 -q
And once you have the UUID, you can install Klipper on your SB2040 with the following command. Note: Replace MYUUID with your UUID.
python3 ~/CanBoot/scripts/flash_can.py -i can0 -u MYUUID -f ~/klipper/out/klipper.bin
You should see CAN Flash Success
at the end. Now you can run the klipper canbus_query command and see the UUID showing that the Application is Klipper.
NOTE: If you are using a BTT U2C and you get this error [###ERROR:root:Can Read Error
You may need to reflash your CAN Adapter (some U2C v2.1 boards had bad firmware installed from the factory). Please read this section of Esoterical's documentation on Github to re-flash your U2C.
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Now your SB2040 is all configured and ready to go.
The SB2040 is designed with the same mounting pattern as Hartk's SB PCB, so if you are running a Stealthburner and CW2, you can use the existing mounting location (if you haven't installed the heatsets, you will need those (page 13 of the SB manual).
Before mounting your SB2040, make sure you install the Stepper driver heatsink.
Here is the wiring diagram provided by Mellow on their page (Note, you will need to use Google Translate, as the page is in Chinese).
All of the connectors on the main toolhead board are JST-PH with the exception of the hotend, which uses a Molex 2pin connector. The front SB board has solder on connections for the fans and neopixel.
Here is a breakdown of the ports on the mainboard for the SB2040v1.
And here is the pin breakdown for the SB2040v2.
For the Extruder, pins on the back of the toolhead board, you will need to remove the protective cover, if your board came with it.
If you are using the LDO 36STH20-1004AHG, then you can follow the color coding in the picture.
For your probe, depending on if you need 24V or 5V, you have two options.
If you are running an Omron probe, or any probe that needs 24V, you can use the HV probe port. On the SB2040v1 board (pictured) this connector is very tight, you will want to loosen the PCB mounting screws and move the board back slightly to insert the connector, as it is still a really tight fit.
Note: The SB2040v2 board has rotated this connector 90deg, making it easier to access, but the pins are also different, so please check the pinout image above.
If you are running Klicky or TAP, you can use the regular Endstop connector.
The heater (Molex Microfit 3.0 2pin) and thermistor (JST-PH) connect to the lower ports, as pictured below.
That should be it for the wiring on the main toolhead board. Now to move to the Front PCB.
The Mellow SB2040 doesn't use Dupont connectors like the Hartk board, so you have to solder the fan and neopixel wires. The other option is to purchase the Hartk front PCB and use dupont connectors.
First tin the board before you install it…
Then install the board into the toolhead board.
Now you can solder the wires to the PCB, following the label's on the PCB.
Once you have wired everything, and confirmed you are connecting to the SB2040 via CANbus, you will then need to update your printer config. You will get an MCU error, until you have updated a few things.
First you need to add the SB2040 as another MCU, you will need the UUID from before,
python3 ~/CanBoot/scripts/flash_can.py -i can0 -q
In your printer.cfg file, you can add this line, after the [mcu] section. Replace MYUUID with the UUID detected above.
[mcu SB2040]
canbus_uuid: MYUUID
The next thing to update is your hotend thermistor, but while we are in the [extruder]
section, we might as well update everything. You will need to update the following lines..
step_pin: SB2040:gpio9
dir_pin: !SB2040:gpio10
enable_pin: !SB2040:gpio7
heater_pin: SB2040:gpio6
sensor_pin: SB2040:gpio27
In the [tmc2209 extruder] section just below, you need to change
uart_pin: SB2040:gpio8
At this point, you should be able to save and restart, and Klipper should start normally. To confirm the SB2040 is communicating properly, you should see it listed on the Machine panel, under system loads.
Now you can go back into your printer.cfg and update the remaining items in each section listed below. Note: Make sure you use the probe section needed for your setup.
[probe]
# Klicky / 5V TAP
pin: SB2040:gpio28
# Omron / 24V TAP
pin: SB2040:gpio25
## Part Cooling Fan - FAN0
[fan]
pin: SB2040:gpio13
## Hotend Fan - FAN1
[heater_fan hotend_fan]
pin: SB2040:gpio14
[neopixel sb_leds]
pin: SB2040:gpio12
You can add this section to monitor the temp on the SB2040.
[temperature_sensor SB2040]
sensor_type: NTC 100K MGB18-104F39050L32
sensor_pin: SB2040:gpio26
min_temp: 0
max_temp: 100
And to utilize the ADXL chip on the SB2040, you can add this. NOTE: Change the probe_points values to the appropriate value for your printer, for a 350mm v2.4, they would be 175,175,20. Here is a link to the Klipper docs on Input shaper.
[adxl345]
cs_pin: SB2040:gpio1
spi_software_sclk_pin: SB2040:gpio0
spi_software_mosi_pin: SB2040:gpio3
spi_software_miso_pin: SB2040:gpio2
axes_map: x,y,z
[resonance_tester]
accel_chip: adxl345
probe_points: X,Y,Z
That should be everything that needs to be updated in your printer.cfg. You will need to save and restart, but that should complete your CANbus setup.