Duet Web Control

From RepRapWiki
Jump to: navigation, search
RRF connection1.png
RRF connection2.png

Contents

The web interface

While the Duet board could be handled with a command program on your PC communicating by USB with the board as traditional in 3D printing, a web server (Duet Web Control – DWC) exists on the Duet. It is the primary choice of communicating for most users and it's a major asset of the RepRap Firmware. A capable server integrated in the main printer board is rare [1] [2]. Connecting via Ethernet allows communication with the web server to drive the printer. Installing an Ethernet Wi-Fi bridge will allow connection with any Wi-Fi enabled device having a browser. All printing is done after uploading a G-code file on the board SD card, which benefits from the fast Ethernet communication of the Duet (up to 350~400 kb/sec with a good SD card).

Principle of operation

This web server, operated by program files located on the SD card in the www directory, is somewhat independent from the firmware stored on the board flash memory. First, the web server shall connect to the firmware, which is automatic while opening the web server, and could be forced with the button "Connect" if communication is lost (which occurs regularly). The server send commands to the board firmware and get information from answers to a small set of commands ( M408, M105, M20, M36) according to a specific protocol. The browser window layout adjustment is mainly automatic, based upon the printer configuration as reported by firmware. The web interface layout is adapted to the device form factor and is different on a smartphone than on a desktop PC.

It is now possible to display in the web interface a still image transmitted by an IP camera.

How does it looks

Main tab is : "Machine control" tab. Note that if the calibration button is not available, you will restore it with a "Zoom out" of the window.

Machine Control tab

While you could upload files to print in the "G-codes Files" tab, it is often wise for up-to-date files to use the first line button "upload and print". You can also drag and drop a file on this button.

Print Status tab opens automatically while the printing starts.

Print Status tab

There is three time estimates, based upon filament use, file progress and layer progress, with not very accurate values.

To send G-code or check calibration result, you will use the G-code console tab

G-code Console tab

View all user commands and the result of some server sent command (notably calibration)

To upload or execute G-code file, the G-code Files tab:

G-code Files tab

Files could be organised in directories

To configure the web server, the 'Settings' tab:

Settings tab, General sub-tab

Modify configuration or upload system files. There are sub tabs in this tab, which allow to check or update printer parameters and fine tune the web interface.

Compatibility

There are many evolutions in DWC, and it does work properly only with recent versions of own Chrishamm fork or DC42 fork. It is highly recommended to upgrade firmware and DWC jointly to the last versions, as they carry many improvement. If you want to test with an old firmware version, you shall use the DWC version associated with this old firmware (probably 1.06 or 1.07).

First start

If Netbios or mDNS names are recognized on your network (most network do), you can simply connect to the web server using the printer name as defined in the 'config.g' file. e.g. http://lily. Name is not case sensitive. Note that in the config.g file the first letter ‘P’ indicates a parameter and is not part of the name. See M550: Set name

Alternatively, you can connect to your printer with its IP address, e.g. http://192.168.1.14 . In that case, it is more practical to define a static IP address (and IP mask) in config.g file instead of relying on address attributed by DHCP server. See M552: Set IP address , M553: Set NetMask and M554: set Gateway.

On mobile devices, the printer name may not be recognised, in this case you shall define a static IP address and load the interface with this address.

RRF connection3.jpg

Note that you could open multiple sessions of the web server and could operate from multiple computers operating a single printer.

Loosing a connection to the printer does not have any effect on the print, but you cannot pause a print without having a connection (which could be with another device than the one which started the print).

Many printers can coexist in the same network, provided you define a specific MAC address for each printer (change the last digit for each printer). See M540: Set MAC Address. They can be operated from a unique browser session.

Languages

Default language is English, but other languages are available (in Settings tab): German, French, Spanish, Swedish and Chinese. New translation could be added while modifying the '/www/language.xml' file.

Configuration

In the "settings" tab, you could modify parameters. Configuration parameters are stored in the local storage of your browser and the cookies shall be activated. If you clean up regularly your browser cookies/cache for safety, this will cancel the configuration. To set permanent modifications independent from your browser, you shall modify the variable "settings" in file "/www/js/model.js". This file replace the former "interface.js" file which was splitted in "model.js" (configuration) and "viewmodel.js" (execution) from DWC version 1.08. Updating this file on SD card is done like updating the config.g file

Note that the web server use a password defined in the file "/www/js/model.js", which shall be the same as the one defined in the config.g (default password: RepRap). A modified password is needed if your network is connected to wifi. See M551: set password.

Using an IP camera

Print Status tab with IP camera view

It is possible in recent versions to insert an image from an IP camera in the "print status" tab. You can use any camera accessible from your network, either by wifi or Ethernet, capable to produce still images.

IP camera configuration
This is configured in the "settings" tab, sub-tab "General", panel "Webcam integration".

You shall enter the web address of a still image as produced by your camera. Alternatively, for some configurations, you may supply a web address and port, as shown in example. The Camera used in this example is the RaspBerry Pi equipped with its dedicated camera and configured with Raspberry Cam. It is preferable to use a static IP address.

Yet there is no recording function within the interface and you shall use other programs for that, for example ZoneMinder on Linux or iSpyConnect on Windows

The example use dark theme as can be configured in "settings" "General" panel "Appearance and behaviour"

Recording timelapse.

It does exist many timelapse software, but only a few could work with IP cameras. The most simple may be to use a Browser extension, as:

Installing Web Interface

Web interface is a web program entirely contained in the /www directory of the SD card. The source can be found in Chrishamm GitHub repository. Updating the web interface is done by writing the revised set of files in the /www directory of your SD card. This can be done by direct upload on SD card or more simply via FTP (login: anything, password: defined in www/js/model.js, default password being 'reprap'). Files www/js/viewmodel.js and www/js/model.js contains configuration. You may edit those files according next paragraph if you want some personalisation, while commenting your modification to be able to track them for future releases. It is wise to save the configuration file on your machines.

Special configuration

  • The graph scale max temperature is defined in the "www/js/viewmodel.js" file, variable "tempChartOptions" "yaxis" "max" which may be increased if you use temperatures over 250°C
  • The minimum manual displacement of the head (for calibration) is defined in file "www/js/model.js" in variable "increaseVal". For finer calibration, you may reduced it to e.g. 0.025, however all other Z displacement will be scaled by multiples of 10 of your minimal value.
  • You can change the color of Z sensor trigger field for better noticeability in file "www/js/viewmodel.js" in the variable "probeTriggerColor", which may be set to another more visible color, e.g. "#FF4500"
DWC header color example.png
  • If you have multiple printers, it is quite easy to confuse control panels of each printer, so you can distinguish your printers while giving panel headers a different background color in the file "www/css/default.css", you may add following paragraph at the beginning, choosing whatever color you want:
.panel-heading, .navbar-default {
  background-color:#e6f8e0 !important; /*define header color*/
  background-image:none  !important;       
}

Other example colors:

  • _ #e6ffff _
  • _ #e6ffe6 _
  • _ #ffffe6 _
  • _ #ffe6ff _
  • _ #e6e6ff _

Web Interface design

The http web server is part of the firmware and send web pages to the browser.

There is no server-side language and all the interface is written in Javascript and fully executed in the browser, so the board resources use is minimal.

The web interface is written using the Javascript library JQuery.

To allow web interface getting data from the firmware, specific G-Code were created and a data exchange protocol was defined using JSON format.

The main G-codes for reporting data to web interface are M408: Report JSON-style response, M36: Return file information, M20: List SD card and M105: Get Extruder Temperature.

Web page (reprap.htm) is uploaded with M560: Upload web page file.

Author

Christian Hammacher (Chrishamm) write and maintain the present web server on GitHub. It also maintain own fork of the RepRap firmware, as the web server improvement may need new firmware functions or modifications. Chrishamm fork is itself a fork of DC42 firmware fork and they have frequent exchanges and are very similar. Chrishamm also added useful functions on the RepRap firmware, notably recently the capability to do firmware update from the web interface (see M997:Perform in-application firmware update).

References

  1. Replicape for BBB board using Redeem as firmware have a web server based on Octoprint
  2. There is a web server on the Smoothieboard, however it has limited capabilities. The low speed of the Smoothie Ethernet link also limits usability.

In addition to site licence GFDL1.2, this page is also released under license CC BY-SA 4.0