Klipper | Flashing Duet 2 Wifi

A DIY tool changing 3D printer

I still havent bought the controlboards yet as I still do not know for sure what I will choose. I might aswell wait until I really need them since BTT are launching new boards every month. Maybe they will provide a new board that suits me even better before I actually get to use it.

So in order to test something I have to use whats on hand. I have a old Duet 2 WiFi lying around from a previous failed project. So lets try to flash it with Klipper!

How klipper works

Klipper is very different from Marlin and Reprapfirmware in the sense that instead of running on a 16bit or 36bit micricontroller which is a integrated part of the printer control board Klipper runs on a SBC, usually a Raspberry Pi and on the classic 16/32 bit boards. Sure you can connect a Pi to your Marlin/RR board and use something like Octoprint to control it, but the processing still happens on your 16/32bit microcontroller. Klipper on the other hand does all the processing on the Pi, which has much more porcessing power. Then the 16/32bit boards only handle all the low level stuff. This means that klipper can run faster and potentially include many more features!

If that just confused you, try to read All 3DP’s explenation of Klipper.

MCU's

Klipper still needs the classic 16/32 bit boards. They call these boards the MCU’s. These MCU’s are used to handle all the low level stuff like commanding the steppers. The Pi tells the MCU when and how much to move each stepper and the MCU just does that. The Pi does all the heavy kinematics and so on.
The coolest thing about this setup is that you can use multible MCU’s in one macine or use one Pi to run multible printers! This is what will allow me to run two Octopus pro boards and thus get all the steppers I need.

Klipper setup: Pi and MCU connected via USB. Source: https://smoothieaq-cevo.blogspot.com/2018/08/electronics-3-setting-up-first-ramps.html

Frontend - Mainsail/FLuidd

Klipper actually does not have a web interface in itself. Actually klipper alone wont get you very far. Klipper is just the firmware that does all the 3D prnter related stuff such as controlling heaters and telling steppers to move. You also need to choose a frontend for your machine. This is typically either Mainsail or Fluidd. This frontend handles all that you see. That is the web interface. This is where you control your machine like with Octoprint. It is also where you can change configuration settings for the klipper firmware and so on.

I have choosen Mainsail as I liked their user interface the most. I am not super into the differences between the two but in the end I think they are very similar regarding what you can do with it. This is a reddit discussion on the subject Mainsail VS. Fluidd.
Both provide very excellent user interfaces on both mobile and desktop.

Klipper web interface. Source: https://docs.mainsail.xyz/.
Fluidd web interface. Source:https://docs.fluidd.xyz/.

Preperations

In order to flash the Duet 2 WiFi board, we first need a Raspberry Pi with Klipper installed. Getting a Raspberry Pi these days are not easy.. So I ended up with a overkill of a Pi4B with 8gb of ram.. A Pi zero is actually sufficient for a basic prusa style machine!

Well I will be running two webcams and timelapse so.. At least, I do not have to worry about processing power and ram..

Writing a Image to the PI

Once you found a pice of silicone gold (a Pi). it is time to install klipper and your frontend.

You will need:

  • Your Pi
  • A MicroSD card
  • A MicroSD card reader/adapter
  • Suitable power supply for your Pi
  • A internet connection for your Pi – I used ethernet. I do not know how/if it works over WiFi.
  • The official Pi Imager: https://www.raspberrypi.com/software/

 

Once you got these things ready you simply follow this very nice guide on installing Mainsail with a imager.

Raspberry Pi Imager ready to write Mainsail to SD. Source:https://docs.mainsail.xyz/setup/mainsailos/pi-imager.

Connecting to your Klipperized Pi

Once you flashed the Pi with the correct image and it is fully booted and ready to go, it is time to connect to your Pi at either:

http://mainsailos.local

or if you changed it in the setup of the image:

http://<IP adress of your Pi>

If you are having trouble finding it then logon to your router and see what IP the Pi has. I also strongly recommend setting the Pi to a fixed IP adress so it doesnt suddnly get a new one.

Initial Mainsail setup and update

Now that you see the Mainsail interface for the first time things may look empty and there may be errors. Thats because we need to start adding stuff to the “printer.cfg” file.

This file is where your entire printer configuration is going to be. Even though it may seem overwhelming at first you will eventually get very fammiliar with it. I promise!

To open it, in the menu on the left, choose “machine”. Now click on the “printer.cfg” to open the editor.

Mainsail "machine" (setup) tap.

Once the editor opens make sure your file looks like this:

Printer.cfg file to activate mainsail control.

Now press “save and restart”. This will bring you back to the “machine” tab. Go to the update manager and search for updates. Update everything. This may take a while the first time.

Update manager in Mainsail

NOTE: Once you flashed your MCU(s) be aware that updating your Klipper firmware here only updates klipper on hte Pi. Eventually you will get an error promting you to reflash your MCU(s).

Go ahead and delete the two folders. we wont need those.

Now we are ready to flash the Duet 2 WiFi board!

Flashing the Duet 2 WiFI

To flash the MCU we need SSH acces to the Pi. I used Putty. If you are new to Putty or SSH then Teaching Tech has a good video explaining SSH and how to use Putty.

Generally we will follow this guide to flashing a MCU with Klipper. Teaching Tech also goes through the process in this video.
However, the Duet board is a bit of a hassle the first time you flash Klipper, if you like me have used RepRap Firmware on the Duet before.

Compiling Firmware

First step is to compile the firmware for the duet board. This is done by running these commands in Putty when SSH’ing into your Pi according to the klipper guide:

cd ~/klipper/
make menuconfig

The last command wil bring up a “GUI” where you have to select the following options using your keyboard (the mouse wont work):

Firmware compiler setup.

Hit “Q” on your keyboard to quit and then “Y” to save.

Now it is time to compile the firmware. This is done by running this SSH command according to the klipper guide:

make

Your Pi will now compile the firmware.

Flashing method 1 - Via Klipper

Now remove the SD-card from your Duet.

Make sure the Duet board is connected to your Pi via USB and that the cable is in fact a data cable and not just charging.

Verify that the 3.3V and 5V LED’s are on

Press the erase button(or jump the jumber depending on board version).

Release the button when the “diag” LED lights up

Then press the reset button

Duet 2 WiF ready to be flashed. No SD, no 12/24V connected, diag, 3.3V, and 5V LED's all lid

Then go to Putty and write:

ls /dev/serial/by-id/*

This will give you the id of the duet. Something like this:

XXXXX

The write:

sudo service klipper stop
make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

Where you replace the “/dev/serial/….” with what you got from the ls /dev/serial/by-id/* command.
Then write:

sudo service klipper start

If you see something like this then you are ready to move to the final step. else try the next flashing method.

Flashing Method 2 - VIA BoSSAC

If the first method didn’t work then try this method instead.

XXXXhttps://meki.medium.com/adventures-with-klipper-and-a-duet-2-wifi-on-an-flsun-qq-s-pro-f9eec5981cfc

Flashing Method 3 - Via SD card/Bossa

If the other methods didn’t work then try this.

Grab a microSD card and a cardreader/adapter and plug it into your PC.

Follow this guide to put the firmware file togther with your config files. (Starts at 3:52) and run this SSH command

cp out/klipper.bin ../klipper_config/firmware.bin

Download the firmware file via your “machine” tab on the webinterface.

Put the firmware file on the SD card in a folder called “firmware” Rename the “firmware.bin” file to “Duet2CombinedFirmware.bin”.

Turn off the Duet board by disconnecting it from the Pi. Install the SD card and reconnect the usb to the Pi.


https://www.youtube.com/watch?v=UPu7_RPE1d0

Read more About

A DIY tool changing 3D Printer

Subscribe
Notify of

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments