Monday, 14 April 2014

Using the Duet with a WiFi router

Using a web-browser via the network is my favourite way to control the Duet electronics, so much so that I now only connect via USB to update the firmware or use debugging. The web interface has had a number of improvements to the front end made by iamburny and by DC42 to the firmware, it now looks like this:

The later iterations have added the ability to upload both gcode files for printing and the config.g file to setup your printer. Its well worth checking out if you have not done so already.

I had always planned on getting a Mendel90 with the Duet up and running on my wireless network. Originally my intention was to use an old Wireless LAN router I had spare but in the end I have gone for an wireless "nano" router:
(image from TP-Link website)
The TL-WR702N Wireless N Nano Router is good value and can be very quickly set up as a ethernet to wireless LAN bridge (I used client mode, show in the link above). That said there a a whole range of cheap wireless routers and this should work well with any one that will act as a wireless bridge. I powered the router from an old mobile phone power adapter.

Setting up consisted of connecting via ethernet to the router, setting the IP range to match my wireless network and connecting it to my WLAN in client mode. Turns outs its really quick and easy to add wireless capability to the Duet.


Monday, 31 March 2014

Setting up Eclipse for Arduino Due to allow for compilation and upload of RepRap Firmware on the Duet

This is a guide to installing and configuring the Eclipse environment on Windows in order to modify and compile the RepRap Firmware for Duet electronics. It may be generally useful for getting Eclipse to play nicely with the Arduino Due board as well.

Note that many printer settings can be changed in g-code within the RepRap firmware and you may not need to edit and compile a new firmware binary to run the RepRap firmware on your printer.

This guide draws from a number of sources: Adrian's initial guide, 3D-ES's post on the RepRap forum and personal experience. I would really appreciate comments and feedback on how this works on other versions of Windows. If anyone is able to do a similar guide for Mac/Linux that would be greatly appreciated.


32 Bit. Throughout this guide I have stuck with using the 32bit version of Eclipse. This should work in more situations than the 64 bit version however let me know if you are successful with the 64 bit versions.

Paths. To keep it simple I have used C:\arduino, C:\eclipse and C:\workspace\RepRapFirmware as directory paths in this example - other paths should work but ensure you substitute the new paths in the instructions below.

Install Arduino: download 1.5.6-rc2, Extract and move to C:\arduino

Install Eclipse: download Juno C/C++ SR2. Extract and move into C:\eclipse

Create workspace: make directories:  C:\workspace,  C:\workspace\RepRapFirmware and C:\workspace\RepRapFirmware\Libraries

Run Eclipse: C:\eclipse\eclipse.exe. When prompted for the workspace enter C:\workspace and choose not to be prompted again. Close the welcome help window.

Install the Arduino Eclipse plugin: Select the Help Menu, Install new software. Paste in the "work with" field and click "Add". It will prompt you to name the repository, use "Arduino Plugin". Uncheck "Group items by category" checkbox then select "Arduino eclipse extensions" item. Click through Next a few times then accept the agreement and finish. Yes to unsigned content, then restart Eclipse.

Setup the Arduino Eclipse plugin:  Select Window menu, "Preferences",  "General",  "Workspace" Check "Save automatically before build". Then click "Arduino" and enter C:\arduino  in the Arduino IDE path and C:\workspace\RepRapFirmware\Libraries in the Arduino Library path. Apply the changes.

Note the "bossac" port number: With your Duet board plugged into USB (but not 12V) press the "erase" button (next to the ethernet port), then the reset button (next to the USB port). If you have not done this before on your PC it may start to install the driver for the native USB port. One this is done go to Control Panel, Devices and Printers and you will see the native USB port. For some reason Windows thinks this is a GPS camera for me:

This shows the port as COM8, note this for the next step

Setup the RepRap Firmware project: Select Arduino menu, "New Sketch". Set the project name to "RepRapFirmware". go next then select C:\arduino\hardware\arduino\sam\boards.txt and select Arduino Due (Native USB Port) as the board.
             NOTE the Arduino Due (Programming Port) will not work with the Duet. 
Set the port to "COM8" or whatever you found in the previous step.
Exit Eclipse

Get the RepRap Firmware source:  Get the version of RepRapFirmware you want to work with. Good options are:

The choice depends on what you are using the firmware for, and you can change to a different branch later. Whichever version you choose, click "Download ZIP" button on the right side of the page and copy the contents of the zip file into  C:\workspace\RepRapFirmware
Only overwrite "RepRapFirmware.cpp" and "RepRapFirmware.h" do not overwrite the other files.

Copy the Libraries: Download the Libraries (click download zip on the right hand side). Copy the sub directories of "Arduino-libraries-master" into the C:\workspace\RepRapFirmware\Libraries\
directory. Next copy C:\arduino\hardware\arduino\sam\libraries\Wire
to C:\workspace\RepRapFirmware\Libraries\

Setup the Paths: Open eclipse, in the Project Explorer window on the left click on the "RepRapFirmware" project and select refresh. All the source files should now appear in the project explorer tree. Next right click on the RepRapFirmware project again and select properties. Navigate to C/C++ General, Paths and Symbols:

the core and variant entries will already be there, add the rest making sure you select "Is a workspace path" and "Add to all languages":

Except the "C:\arduino\hardware\arduino\sam\system\libsam\include" path which needs to be added as a filesystem path:

Note If using the Dc42 version on the firmware you must add the "flash" directory as well:

Once they are all added click apply, choose to rebuild the index and select OK to close the window.

Eclipse is now setup and ready to compile the firmware.

Compiling RepRap Firmware: The compilation output is visible on the console tab selected at the bottom center. Choose the Project menu, clean, clean all, OK. Then click on the green tick to "Verify", ie compile the code.

The progress of the compilation will show in the console window and when complete there will output something like this:

Uploading the Firmware: With the Duet plugged into USB if you have not erased the loaded firmware click the erase button, then the reset button on the Duet. Then click the green arrow on the toolbar "Upload Sketch". The upload will start, shoose "always run in background". In the console windown the upload progress and then the verify progress will be shown:

The compiles firmware is now uploaded to the Duet board. Note if you look in devices and printers the port will have changed to the Arduino Due port:

With a different com port, this is the one you use in Pronterface to talk to the firmware over USB.

Firmware Modification

Detailed information modifying the firmware is outside the scope of this blog post. Printer configuration defaults are in Platform.h:

The screenshot above shows part of the platform.h for the Multi Extruder branch which defines all 8 channels for the Duet and Duex4.

I hope this post has been useful!

Thursday, 16 January 2014

Duet on board power supply testing

There have been a number of discussions on the reprap forum (1,2,3 for starters) about the effect of electrical noise causing hanging/freezing on the Duet board requiring reset attributed to this. Radian originally highlighted that a significant spike on the 12V line was caused by the switch of of the Heated Bed FET could be the cause.

We have done  quite a bit of investigation now into this particular effect, its causes and options to reduce it which is covered below. All the scope plots were recorded by Andy, one of the Duet designers. Throughout the green trace is the voltage under investigation and the purple trace is the heated bed current.

The relevant portion of the schematic is shown here for quick reference, full design files are on Github:

Bed FET Switching Transient Spike

Due to the fast switch off of the MOSFET, combined with the inductance of the PCB heatbed (average measurements 1uH) there is significant ringing (47.8V pp). The FET is avalanching at that point.

12V at he MOSFET Drain during bed switch off
This noise is relatively local to the MOSFET though, at the 12V input connector it is down to 750mV pp.

12V at the input connector

Once through the buck DC-DC convertor on the 5V line the noise is down to 130mV pp.
5V at buck output

and by the time that goes through the 3.3V regulator its down to 63 mV

3.3V at LDO regulator output
 At this point the 3.3V is further filtered and converted onboard the processor to 1.68V.

Mitigating the Spike

Some of these ideas have come form suggestions on the RepRap forums - thanks for the input!

First Andy added an RC snubber across the FET  with a 10nF capacitor and a 10R resistor. This removed the ringing but the large spike was still evident. Adding a catch diode across the heat bed contact made a small additional difference

RC snubber added across FET (10nF + 10R)

Snubber + catch diode across heat bed contacts
Finally R18 (see schematic at the top) was changed for 470R and 100R added in series with the FET gate. This has the effect of speeding up the turn on and slowing down the turn off of the FET. With all of this in place the spike is still significant but as the second trace below shows the noise on the 3.3V line is now only ~18mV

Snubber + catch diode + R18 changed to 470R and 100R added in series with TR2 gate
3.3V LDO output during heated bed switching
So what?

Our assessment at this point is that the 12V spike caused by the heated bed switching is not, in of itself, causing any negative effects to the Duet processor. In addition the avalanching causes minimal additional heating to the FET when "Bang, Bang" switching or low speed (<1KHz) PWM is used. High speed PWM is bad due mainly to the slow turn on time which causes significant heating.

During this testing we had 3 Duet boards using PWM on the heated bed for a number of days with no modifications, those processors have been subjected to hundreds of millions of these noise spike without a single crash and hang. That is not saying that its not possible but there are probably other contributory factors, see "Further Work" below

Further Work

More investigation is needed into the effects of USB ground loops which may be causing some issues. Other USB noise can also cause problems, the investigation by markbee, posted on the forums is a very useful starting point.

The firmware is being continually updated (special thanks to dc42 for all the work he has already done). This has already fixed some causes of Duets hanging so make sure you are using the most up to date firmware if you are having issues.

I must again thank everyone who is contributing so much on the forums!

Friday, 10 January 2014

4 Extruder Printing - Duet + Kraken

According to Wikipedia the Kraken is "a legendary sea monster of giant proportions". It is also a new hotend from E3D which has 4 nozzles and is water cooled - packing all that into a form size of modest proportions.

I have been experimenting with the Kraken printing on the Lasercut Mendel90 using the Duet and Duex4 which supports up to 5 extruders. I was lucky enough to get my hands on one of the Krakens while still in beta (thanks Sanjay!) so there may be one or two modifications between the one I have and the final version they are bringing out soon.

Colossal octopus by Pierre Denys de Montfort.jpg
Legendary sea monster
Predicted to be Legendary Hotend

Setup in overview

Modified Lasercut Mendel90: changes include:
  • Re-designed X Carriage to accommodate the Kraken.
  • Additional extruder wiring loom.
  • 4 RepRapPro filament drives
  • Duet and Duex4 electronics which can drive up to 5 extruders
  • Updated RepRapFirmware for multiextruders
  • The Kraken! (with water cooling system)


so far I have done a couple of 4 colour prints

X carriage modifications

The carriage itself has been modified to fit the kraken underneath, secured with 4 M3 fasteners. There is a cutout for the Bowden and water pipes and two more cutouts for the wiring.

I wanted to keep using the extruder wiring loom that the Mendel90 is designed with. This normally plugs into a bracket on the extruder motor on a non-Bowden system, so I had to design a carriage mounted bracket.

This allows for two of Nophead's 15 Way D Type extruder breakout boards to be mounted. The bracket is a bit of a pain to print as it needs support but I like the way it all fits together. This picture shows it part way through assembly.

The OpenSCAD and STL files are shared on our github:


The second ribbon cable follows the same route as the original Mendel90 extruder wiring loom.

Ribbon Cable A is the original Mendel90 wiring loom, Ribbon Cable B is a 14 core ribbon cable wired to mirror Ribbon Cable A as shown in the table below. Ribbon A has not changed from my Dual extruder setup and uses the original motor wires to carry the second extruder with the probe circuit carrying the second thermistor.

DescriptionWirePCB 1 (Left side)Notes
E0 Thermistor GNDRibbon A #4P2 Pin 2 (T)Common with E1 Therm GND
E0 Thermistor SignalRibbon A #3P2 Pin 2 (T)
E1 Thermistor GNDRibbon A #4P4 Pin 1 (P)Common with E0 Therm ground. no separate cable at Duex4 end
E1 Thermistor SignalRibbon A #5P4 Pin 2 (P)
E0 switched GNDRibbon A #9, 10, 11P2 Pin 4 (H)
E0 +12VRibbon A # 6, 7, 8P2 Pin 3 (H)
E1 +12VRibbon A #13P3 Pin 1 (MR)
E1 +12VRibbon A #14P3 Pin 2 (MB)
E1 switched GNDRibbon A #15P3 Pin 3 (MG)
E1 switched GNDRibbon A #16P3 Pin 4 (MK)

PCB 2 (Right side)
E2 Thermistor GNDRibbon B #2P2 Pin 2 (T)Common with E3 Therm GND
E2 Thermistor SignalRibbon B #1P2 Pin 1 (T)
E3 Thermistor GNDRibbon B #2P4 Pin 1 (P)Common with E2 Therm ground. no separate cable at Duex4 end
E3 Thermistor SignalRibbon B #3P4 Pin 2 (P)
E2 switched GNDRibbon B #7,8,9P2 Pin 4 (H)
E2 +12VRibbon B #4,5,6P2 Pin 3 (H)
E3 +12VRibbon B #11P3 Pin 1 (MR)
E3 +12VRibbon B #12P3 Pin 2 (MB)
E3 switched GNDRibbon B #13P3 Pin 3 (MG)
E3 switched GNDRibbon B #14P3 Pin 4 (MK)

It is much less pretty at the Duet + Duex4 end:

Both these boards are designed to allow for IDC connectors but the wiring looms to use them are still a work in progress, hence the screw terminals. The Lasercut Mendel90 was always designed to accommodate 5 filament drives, with the "extruder sandwich" as part of the frame. Although I only need 4 for now I have all 5 mounted for future developments:

The filament drives fitted are the RepRapPro design for their Mono and Tricolour Mendel.


I have extended the RepRap Firmware to accommodate 5 extruders and added one or two legacy commands that other firmwares support. This is definitely still a work in progress to get all the functionality we have become accustomed to with firmware like Marlin.

My fork of the firmware is available here:

The Kraken!

The main thing that sets the Kraken apart from other hotends is the "cold end", this is designed to take up to 4 hot ends that can move up and down in the block, secured by two grub screws each. It incorporates a water cooling passage and two "barbs" to take the hoses for the water. The first thing I tested was the water system to ensure it did not leak:

I used fish tank airline silicone tubing because it was easy to get hold of, cheap and flexible. I think any tubing which is flexible enough and fits on the coupling well will do - what will be interesting is the long term effects of the flexing on the tubing. The other end of the tubing has a small pump supplied by E3D and it is just dumped in a water container.

Next I installed the cold block into the x carriage and wired up 4 thermistors and fitted the heater cartridges. I prefer to use axial leaded thermistors (like these) as they are more robust and easy to wire but the heater blocks also have holes for radial leaded thermistors like the EPCOS and tiny ones used in other hotends.

The view from underneath

At this point its more like a Medusa with all the wires and hoses! The D bracket holders and PCBs fit and the 4 M3 fixings for the Kraken hold it all in place (so the 2 M4 holes in the carriage are not required)

I did not fit the Bowden cables yet as it would have been even more unwieldy and the Kraken has a ingenious push fit Bowden connector integrated into the cool block so they can be added later.

I then mounted the X carriage and installed two of the bowden tubes. Leveling the bed is extremely important as the "end effector" is now the size of the square made up of the 4 hot end tips. I started with one hotend tip lower than the other three to make the bed levelling easier.

First print:

You may be able to see that the unused hotend tips are slightly higher. This turned out quite well at 0.2mm layer height:

its "Bucket O' Octopodes (thicker legs)" model by moleofproduction.

Once I had single extruder printing confirmed I centred the carriage on the bed and lowered it until the lowest tip was just touching (making sure everything is at the same temperature). I then dropped the other tips to the same level (relative to the bed) by loosening the grub screws, securing them in place by re-tightening the grub screws. This was a rather fiddly operation but actually much easier than trying to level four individual extruders. (Well, easier than two so it must be easier than four!).

With the 4 nozzles level it was on to a 4 colour print

I have uploaded this test piece to thingiverse. As can be seen Slic3r is building a full- height skirt around it which catches the ooze. That combined with a 20C drop in temperature between the active and standby hotends is reducing the ooze effect. I also cheated in this design as the similar corners of the triangles are 20mm apart, the same spacing as the nozzles.

My next idea was to make up a 4 colour "kraken" scene to try something a bit more difficult. Using OpenSCAD I imported the "Bucket O' Octopodes (thicker legs)" and Daid's "Small OpenSCAD Ship" slightly modified to be easier to print. I cut out the eyes and added some spheres to use another colour and then built up a scene with some "water".

This is the OpenSCAD render

Ignore the weird tentacle shaped gap in the head - it's a rendering artifact.

And then printed it (excuse the camera shake in this picture):

The print with the anti-ooze wall still on:

Not perfect by any stretch! I think it will a big improvement when I design a fan duct for this setup which should help the thin sails to print better.

The ooze wall did not fully catch all the ooze - I think a 30 or 40C change in temperature might be needed but that will take ages for every colour change.

I have also found an issue with extrusion in Slic3r when using multiple extruders - it sometime extrudes a huge amount too much which may account for some of the blobby-ness.  Update: not an issue with slic3r - I entered 90 rather than 0.9 in the top infil box!

Plenty more to improve on but it has been really fun setting this up and working with the Kraken - its a great multi nozzle hotend!