13. June 2020

RPi and Duet 3, why and how?

By BeTrue3D

So, it’s been a while since Duet 3 was released, but only recently has the accompanying RepRapFirmware (RRF3) gone from RC (Release Candidate / Beta) to final, which means it’s time for me to take a look at the new products in the Duet 3 series.

The Duet 3 is more powerfull and can do a lot of tricks compared to the Duet 2 series, but what’s up with the option to use a Raspberry Pi?

Duet3 connected to a RPi4 using the 26-40pin ribbon cable

And yes, to make one thing clear: It’s completely optional to use a Raspberry Pi along with your Duet 3, so lets look at why you might want to use a RPi alongside your Duet3, or just run it without.

  1. Duet 3 modes
    1. Standalone mode
    2. Tethered mode
  2. Setup RPi for use with Duet 3
  3. Download software
  4. Choose your DuetPi image
    1. Key differences
    2. Download image and requirments
  5. Simplified instruction steps
  6. Extra steps via raspi-config
  7. Power Options
    • Power RPi by Duet3 – Standard setting
    • Powers Duet3 from RPi
    • Power Duet3 and RPi seperately
  8. Picking a Touchscreen
    1. Install drivers for Touch screen (optional)
  9. Source and additional help

Duet 3 modes

  1. Standalone mode: Duet 3 can run without the RPi just fine. This mode is called Standalone mode without SBC.. SBC is an abbreviation/acronym for Single Board Computer.
    • In this mode you need an internal SD card, which is included with Duet3. The SD card contains everything you need to get started, so you just need to set it up like you would the Duet2 series boards.
    • You connect Duet3 to your network using the RJ45
    • You can use PanelDue as a screen. How to.
    • You can find an RJ45 to WiFi bridge, if you want to use WiFi
    • If there’s a sys/config.g (it’s in place by default) in place on an internal SD card, the Duet 3 will start up in Standalone mode. Otherwise it will wait for a SBC to connect to it.
  2. Tethered mode: The other mode, where you use a RPi, or other compatible SBC like Jetson Nano instead of a RPi, is what they at Duet3D considers the normal mode.
    Support for other SBCs will be added in the future.
    There’s no seperate name for it, but I’ll call it Tethered mode to differentiate and avoid confusion about what I’m talking about.
    • The SD card supplied with the Duet3 contains everything needed to get started, so just insert it into the Pi instead of the Duet3.
    • When using a RPi you are using the new Duet Software Framework (DSF) they have worked on at Duet3D.
      • DSF runs on Raspbian and ArchLinux (other distros might be added in the future).
      • Duet3D supplies two Raspian images which includes the DSF. These precompiled images are named: DuetPi
      • Makes it easier for people to write plugins in the future. Ie. look at Octoprint.
      • Makes it possible to use 3rd party Touchscreens like Raspberry Touch or Generic HDMI screens, and other devices connected directly to the RPi like keyboards, webcams, mice etc.
      • RPi offloads the Duet Web Control (DWC / Webpage) from the Duet3, which now only focuses on actually printing.
      • Makes it much easier to update firmware as you can download updated firmware as you would normally do a RPi/Linux computer, using a simple command.
        • You still need to run the M997 command from DWC to do the actual install.
        • Easier compared to first finding the relevant firmware on Github, downloading it and then dragging it to your DWC.
        • It will not download non-final releases, so you don’t risk it downloading any RC versions. You can change this behavior.
        • They plan to make everything (like updating) availabe through the DWC, instead of command writing, but I don’t know the timeline for this.
    • You connect the RPi to your Duet3, using the included 26 to 40-pin ribbon cable.
    • RPi is setup using one of the 2 premade DuetPi images. These images are based on Raspbian Pi OS with DSF preconfigured..
    • When using a RPi, you can use the WiFi module on it to make it work like a Duet 2 WiFi or you can use the RPi RJ45 ethernet. Pi4 has true Gigabit net and you can even hook up a SSD or network drive to it.
    • You can use Bluetooth on RPi to connect various stuff like keyboard and mice.
      • Please note that many Bluetooth keyboards might have issues working with the Pi. This has nothing to do with the DuetPi image, but is an issue with how RPi works.
    • You can use USB ports on RPi to connect stuff as well.

Setup RPi for use with Duet 3

If you want to use the RPi for Duet3 you just need to place the supplied SD card from the Duet3 into the RPi and boot up. Or you can choose to either install one of the DuetPi images the same way, as any other RPi image you might have installed previously, or install DSF on top of your current install and setup everything manually.

Download software

  • BalenaEtcher – SD Writing program.
  • Xshell – SSH client – my favorite as you can copy/paste from your computer, and you can save different devices. It’s free.
  • Putty – Simple SSH Client if you only use it very rarely.
  • Notepad++ (optional): This is a great free text editor for working with text files. Use Notepad otherwise. Don’t use wordpad.
  • VNC-Viewer (optional): if you plan on using VNC, which is a remote desktop solution. Can make it easier to connect Bluetooth things and similar.
  • Advanced IP Scanner (optional) if you need help finding IP of RPi once connected this program is a nice free option.

Choose your DuetPi image

There are 2 official DuetPi images: A normal version, which is most suitable for the normal users and a very light version for specialists setups.

Key differences:
How to read the table:
No means it has been removed from the image and must be installed manually if you want this option.
Available means it is available as standard, either via raspi-config, or via desktop environment.
Yes means it is preinstalled and functional

Duet Web Control (DWC)YesYes
SPI enabledYesYes
Desktop EnvironmentNoYes
Graphical interface aside from DWCNoYes
Screen supportNoYes
* Use wpa_supplicant.conf to configure networking after writing image to SD

Download image and requirments

You will need at least an 8Gb class 10/ U1 / V10 SD card.
Duet3 comes equipped with a 16GB U1 card

If you need detailed instructions, you can find them at the official Raspbian Installing system image page.

Simplified instruction steps:

  1. Use BalenaEcher to write the image to your SD card.
  2. Setup WiFi by editing the existing wpa_supplicant.conf file on the SD card and insert your country code, name of your network and password. This is called headless setup.
  3. Use Advanced IP Scanner to find the IP of your RPi
  4. Use Xshell or other SSH client to connect to your RPi
    1. Username: pi
    2. Password: raspberry
    3. Say yes and accept everything
  5. Update and Upgrade DuetPi using this command:
    sudo apt-get update && sudo apt-get upgrade -y
    • Update is Windows equivalent of searching for updates.
    • Upgrade means install the updates it found
    • -y means you accept any questions it might answer
  6. You should (must) change your password away from raspberry using raspi-config and follow onscreen instructions

Extra steps

Change User Password #1
You really must change the password as stated in step 6 above. This password is also used if you want to connect to the RPi using VNC

Network Options #2
N1 Can change your Hostname.
Default is duet3 when using one of the DuetPi images. Hostname determines the address to the DWC, like http://duet3.local
N2 Wireless LAN – Can setup WiFi if you are currently connected using cable

Localization options (#4)
Change I2 and I3 as needed.
I’ll not recommend changing I1, as it might lead to issues down the line.
We set I4 in our wpa_supplicant file during setup, but you can do it here as well.

Interfaceing Options #5
P1 for RPi camera if you have one connected.
P2 SSH is automatically enabled on both DuetPi images
P3 VNC – you might want to enable this to use the remote desktop feature.
P4 SPI – Necesary SPI setup is preconfigured on the DuetPi images

Power options

Power RPi by Duet3 Standard setting
This configuration is using the internal Duet3 5v power to power RPi
En means the internal 5v conversion is Enabled on the Duet3
You must not power RPi seperately while using this setting!

Power Duet3 from RPi.
SBC-> 5v: Connects the two 5v rails on the Duet3. (EXT and INT), which will bypass protection on the Duet3.
Allows 5V_EXT to power 5V_INT.
You really shouldn’t use this setting unless you really know what you are doing!

Power Duet3 and RPi seperately.
This option makes it possible to power the Duet3 and the RPI using their own seperate Power Supplies.
Do not connect USB between RPi and Duet3 for Bossa or similar while using this option!

Picking a Touchscreen

I’m writing this section as there are a few things about picking a Touchscreen for your RPi.

There are 2 main different options to look at:

  1. Generic HDMI and USB This screen type uses HDMI and USB to connect to the RPi.
    They can be higher resolution like native 1024×600 for 7″ versus 800×600 for version with DSI cable connection.
    It’s generally easier to draw cables from front of machine to back of machine if that is your placement of the RPi.
    This type usually requires drivers being installed.
  2. Raspberry Pi Touch Display This screen type uses the thin ribbon cable RPi uses with it’s DSI connector.
    The largest screen at the time of writing is 7″ at 800×600 naitive resolution.
    This type is activated using the raspi-config and in some cases also need to edit a config file.
    Might need to install drivers.

Generally you must ensure the model you buy are compatible with your RPi. Many ‘older’ screens might not work on RPi 4 due to needed drivers, so look for compatible units / ask seller to be sure.
I’ve seen many of the “Generic” types listed as Raspberry Pi units. They are not made by Raspberry, nor even for PI specifically. Mentioning this just to avoid confusion when you go looking for a screen.

I encountered issue where Touch didn’t work on mine, and it turned out the USB-cable I used from RPi to the screen was bad, so check cable if you are having issues. My 7″ Generic HDMI 1024×600 Screen only draws 0.5a
USB cable both powers the screen and facilitates touch functionality.

Install drivers for Touch screen (optional)

This section might not at all fit with your needs, but it’s an example of the few lines of codes you needs to execute in order to get the 7″ Touchscreen 1024×600 IPS display up and running I just bought.

sudo rm -rf LCD-show
git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD7C-show

Sources and additional help