Introduction: The Robotic Filament Dispenser for Arduino

About: Balearic Dynamics SL, owned by Enrico Miglino, is a R&D company located in Spain integrating technologies, creating new products and developing software and firmware components improving with low-cost tool…

Why a motorised tool

3D printers filament - usually almost robust - is pulled by the extruder while the roll is placed nearby to the printer, free to rotate. I have observed meaningful differences in the material behaviour depending on the usage level, referred to 1Kg filament rolls. A new (full) filament spool flows almost well but the force applied by the extruder should be relatively relevant: the weight is at least 1.5 Kg.

The extruder motor (most of the cases a Nema17 stepper) ha sufficient power to do the job but the two gears of the extruder pushing the filament to the hot-end side while working collect particles of the filament due the applied forces; this requires frequent extruder maintenance to avoid the nozzle clogging. These particles tends to detach and mix with the clean filament while it is feeding, increasing nozzle problems and a more frequent nozzle wear; this occurs more frequently with 0.3 mm diameter nozzles.

When the filament roll is half used or more its spirals become smaller and in some environmental conditions the filament tend to break too frequently. Long print jobs become less reliable and stressful; I can't leave the printer working alone for an entire night without controlling it. Thus controlling the filament feed by motor figures solving a series of issues.

The kit is available on Tindie.com

Step 1: The Kit Content

The kit includes all the 3D printed parts and mechanics to assemble the motorised filament dispenser. There are instead two optional parts: the motor and the motor controller board.

In my setup I have used a 12 V McLennan geared brushed motor but any geared 37 mm diameter motor can fit properly inside the motor support.

The best performances are reached with a TLE94112LE Arduino shield by Infineon (full review here); this DC motor controller board can support up to 6 different robotic dispenser kits at the same time.

I have tested the entire system on both an Arduino UNO R3 and the Arduino compatible board XMC1100 Boot kit by Infineon and the system was very well responsive with both the micro controller boards.

The use of the TLE94112LE shield is suggested but not essential. Any DC motor controller for Arduino - including your own project ! - can work fine with this tool

The kit is divided in two sets of components as two parts are built to work together. The base platform, will support the filament roll rotating on the four free wheeling bearings. The base is fixed to the weight sensor to control the rotating mechanism triggering its activation as well as monitoring the filament conditions: weight, meters and percentage. A lot of information as well as a complete command set are accessible from the Arduino through a serial terminal.

Tools you need

To complete the assembly you need some robust plastic glue for some parts, a screwdriver and a set of Allen screws.

Step 2: The Project and Design

This project is the third evolution of the 3D printer filament dispenser series Some times ago I created the rotating base to optimise the flow of the filament when pulled by the 3D printer extruder.

The second model included a weight sensor for real time monitoring the filament usage with an Arduino board. This last project includes the automated release of the filament depending on the needs of the 3D printer job. It is based on the virtual weight variation when the extruder start pulling the filament. This event trigger the micro controller through the weight sensor and the motorised filament roll start releasing some inches of material then decelerate and stop.

The components have been exported in STL format and 3D printed, then refined and assembled together. I have created a custom support to align the motion part to the base. The longer Aluminium rail was also used to support the Arduino and the motor shield to make the entire tool compact and easy to move.

Creating the design I followed a series of assumptions:

  • Making the automated engine almost simple and easy to reproduce
  • Reduce as much as possible the number of non-3D printable components to make it
  • Reduce as much as possible the stress applied to the extruder while printing
  • Use a low cost and easy to program micro controller board
  • Use the weight load sensor to keep under control the filament consumption and filament feeding Manage the environmental noise interfering with the filament weight measures

This is the result I reached.

Step 3: Assembling the Base

The first step is assembling the base with the weight sensor.

  1. Insert the small bearing axis tube in the bearing hole
  2. Put the two separator discs to the sides of the bearing
  3. Introduce the components inside the "U" sized bearing support aligning the holes
  4. insert the Allen screw to one side and the washer and the nut to the other side closing the nut without too much effort

You should repeat the operation on all the four bearing supports. Then test the assembly: the bearings should rotate freely.

Now fix with the Allen screws the four bearing supports on the top base with the four regulation holes. Align the bearing supports to keep them parallel. Regulate the distance depending on the width of your filament rolls.

The next step is assembling the weight sensor bar holding the bottom and top base together. The weight sensor has two different Allen screws on both sides and you should orient it so the max weight label is readable when the base is correctly positioned. The bottom base has two extra side holes to fix the weight sensor A/D amplifier. The amplifier based on the HX711 IC will be powered and connected to the Arduino board through the four wires as shown in the attached sensor data sheet.

The last step is assembling the complete top base over the weight sensor already fixed to the bottom part.

The first component has been setup!

Step 4: Assembling the Spool Motion Engine Parts

The easier procedure to assemble the spool motion engine is assembling separately the four most important components then complete the final building:

The geared DC motor in the motor transmission box

The DC motor should be mounted in the central part of the structure support; before screwing the motor you should decide what will be your preferred side where to put the gears side to align correctly the two arms that holds the motor and the driven large gear.

The driven large gear

The large gear should be screwed with the truncated conical block with the four Allen screws. This gear will be blocked on the rotating axis by nuts; the conical part will hold the filament spool that is locked to the other side by a similar lock nuts inside another truncated conical block. This solution not only holds the moving mechanism in place but direction all the weight to the base and it is the tare weight of the system.

The spool lock holder

This is the truncated conical block that together with the driven gear similar locking side will hold the motion mechanism to the filament spool. As a matter of tact it is the filament roll that complete the building while the motion two arms support is free to move on the other side.

As it is shown in the images the spool lock holder is built in two parts. First insert the M4 nut in the bigger part of the block then glue the second part (the cover) keeping the blocks together. The nut remain imprisoned inside the lock holder that will be screwed to the threaded driven axis.

The bearings box

The bearing box has two functions: grant a good support to the transmission gears and a smooth and silent motion. To assemble the bearing box follow these easy steps:

  1. Screw the first M4 nut to one of the two ends of the threaded spool holder driven axis
  2. Insert the first bearing
  3. Insert the separator
  4. Insert the second bearing
  5. Screw the second nut and lock it moderately. The internal plastic separator will oppose sufficient force to keep the things in place also for long time use.
  6. Insert the assembled bearings in the bearing box. It should be done forcedly to grant the better results so don't expand too much the internal of the box when refining the plastic parts.

We are ready for the final components assembly!

Step 5: Completing the Assembly of the Motion Engine

We are about to finish the structure assembly then we can move to test motion. Now you need again some few glue. The bearing box - assembled in the previous step - should be inserted in the box holder hole of the two arm engine support and possibly glued before to screw the box cover.

Warning: do not glue the box cover, only screw it. The cover is important for dust protection and should be removable for any future maintenance operation.

When this setup is complete before adding the driven gear (the bigger) add the small separator ring: it keeps the big gear aligned with the motor gear acting as a washer to fix the driven moving assembly.

Then insert the driver gear (the small one) in the motor shaft. Note that there is a flat side in the motor as well in the gear central hole to keep the gear rotating driven by the DC motor.

Last step, inset the large driven gear as shown in the images and lock it to the threaded axis with two M4 nuts.

The mechanics building is complete!

Step 6: Bonus: How I Customised the Support to Manage the Kit

To keep the kit in place I made a very simple structure based on two Aluminium square tubes to support both the base and the motion structure. The base has been fixed with four screws to the two rails (about 25 cm length) and with a couple of small 3D printed supports I have fixes the motion engine free to be moved to make easy the insertion and removal of the filament roll.

Anyone can chose its own solution depending on how his workbench is organised.

Step 7: Wiring and Connecting to Arduino

As explained in the Kit content step, I have used a Infineon TLE94112LE DC motor shield for Arduino and tested the engine on both Arduino UNO R3 and Infineon XMC110 Boot Kit.

If you will control the motor (need PWM features) with a DC controller board of your choice, just adapt the instructions to the technical specifications of your shield.

A note on the TLE04112LE Arduino Shield

One of the limits I have experienced with other motor control shields for Arduino is they use the features of the same micro controller (i.e. PWM and GPIO pins); this means that your board becomes dedicated to these tasks while only few other resources (MPU and GPIO) are available for other uses.

Having the possibility to put the hands on the TLE94122LE Arduino shield for road testing, the most evident advantage of the IC the board is based on is just its completeness. The Arduino board communicates to the shield via the SPI protocol using only two pins. Every command you send to the shield is processed autonomously by the TLE94112LE IC without consuming MPU resources. Another remarkable feature of the Infineon board is the possibility to control up to six brushed motors with three programmable PWM channels. This means that Arduino can setup one or more motors, start them and continue working on other tasks. This shield revealed perfect to support up to six different filament rolls at the same time s motion is only one of the tasks in charge to the MPU.
Considering the possibility to manage six different filament spools with a single Arduino + shield the micro controller cost impacts on every single filament controller for less than 5 Euro.

The weight sensor

After doing some experiments I saw it was possible to control the entire system - monitoring and automatic feeding - with a single sensor; a load cell (weight sensor) is able to dynamically measure the filament spool weight variations providing all the information we need.

I used an inexpensive load cell in the range 0-5 Kg together with a small board based on the HX711 AD Amplifier, an IC specific to manage the load cells sensors. There was not interfacing problems as it is available a well working Arduino library.

Three steps for setting the hardware

  1. Insert the shield on top of the Arduino board or the Infineon XMC110 Boot Kit
  2. Connect the motor wires to the Out1 and Out2 screwed connectors of the shield
  3. Connect the power and signals from the HX711 AD weight sensor amplifier to the Arduino pins. In this case I have used pins 2 and 3 but all the free pins are fine.

Warning: pins 8 and 10 are reserved by the TLE94113LE shield for the SPI connection

That's all! Ready to setup the software? Go ahead.

Step 8: The Software and Control Command Set

The full documented software can be downloaded from the GitHub repository 3DPrinterFilamentDispenserAndMonitor

here we consider only the most meaningful parts and the control commands.

There is a reason imposed by the number of available pins on the Arduino UNO I decided to control the system via the USB serial terminal; As every motorised unit is based on a weight sensor, controlling six different filament dispensers requires reading data from six weight sensors. Every load cell "consumes" two pins, pin 0 and 1 are reserved (Tx/Rx) for the serial and pins 8 and 10 are reserved for the SPI channel connecting the TLE94112LE shield.

System status

The control software works through four different states, defined in filament.h:

#define SYS_READY "Ready"       // System ready  

#define SYS_RUN "Running"       // Filament in use  

#define SYS_LOAD "Load"         // Roll loaded  

#define SYS_STARTED "Started"   // Application started    

// Status codes  

#define STAT_NONE 0  

#define STAT_READY 1  

#define STAT_LOAD 2  

#define STAT_RUN 3

Status : Started

This status occurs after a hardware reset or when the system is powered on. The power-on (and setup() call when the sketch starts) initialises the internal default values and should be started with no extra weight on the platform as part of the initialisation sequence is the acquisition of the absolute tare to reach the physical zero weight.

Status : Ready

The ready state occurs after a soft reset (sent from the serial terminal). It is similar to the physical resect but no tare is calculated; the reset command can be launched also when the system is running.

Status : Load

The load status occurs when the load command is sent by the terminal. This means that the filament roll has been loaded and the dynamic tare has been calculated. The exact filament weight is obtained by the kind of roll setup subtracting the weight of the motor unit and the empty roll.

Status : Running

This status enable the automatic weight calculation and the automatic filament dispenser.

Terminal messages

The current version of the software returns human readable messages to the terminal depending on the commands. The string messages are defined in two header files: commands.h (command related messages and responses) and filament.h (strings used by the parser to create compound messages).

Commands

Two different files are involved in the command management: commands.h including all the commands and related parameters and filament.h including all the constants and definitions used by the weighting system and by the parser.

While the internal calculations are done automatically by software I have implemented a series of commands to set the behaviour of the system and manually control some parameters.

Command keywords are case sensitive and should just be send from the terminal. If a command is not appropriate for the current status of it is not recognised a wrong command message is returned else the command is executed.

Status commands

Change the current status of the system and the behaviour is adapted as well

Filament commands

Using separate commands it is possible to setup the filament and roll characteristics based on the most common weight and sizes today available on the market

Units commands

These are a couple of commands to set the visualisation of the measure units in grams or centimetres. As a matter of fact it is possible to eliminate this commands and always represent data in both units.

Information commands

Show groups of information depending on the system status

Motor commands

Control the motor for filament feed or pull.

All motor commands follow an acceleration/deceleration path. The two commands feed and pull executes a short sequence as defined in motor.h by the constant FEED_EXTRUDER_DELAY while feedc and pullc commands runs indefinitely until a stop command is not received.

Running mode commands

The running status accept two modes; mode man just read periodically the weight and the motor moves until a motor control command is not sent. Mode auto instead executes two feed commands when the extruder needs more filament.

The principle is based on the weight readings, contextualised to this particular environment. We expect that the filament consumption is relatively slow, 3D printers are almost slow and the normal weight oscillations depends on the environment vibration (better if you don't put the entire stuff on the 3D printer)

When the extruder pulls the filament instead the weight difference dramatically increase (50 g or more) in very few time, typically between two o three readings. This information is filtered by the software that "deduct" that new filament is needed. To avoid wrong readings weight variations while the motor is running are ignored at all.

Application logic

The application logic is distributed in the .ino main (the Arduino sketch) along three functions: setup(), loop() and parseCommand(commandString)

The sketch uses two separate classes: FilamentWeight class to manage all the filament calculations and sensor reading via the HX711 IC and MotorControl class interfacing the low level methods of the TLE94112LE Arduino shield.

setup()

Launched once when at power-on or after a hardware reset initialise the instances of the classes, setup the hardware and the terminal communication.

loop()

The main loop function manage three different conditions.

While there are two classes for weight sensor and motors relatively complex, there is the advantage that the resulting sketch is really easy to understand and manage.

  1. Check (in mode auto) if the extruder needs more filament
  2. If the motor is running check for hardware errors (returned by the TLE94112LE)
  3. If there are serial data available parse the command

parseCommand(commandString)

The parsing function check for the strings coming from the serial and when a command is recognised it is immediately processed.

Every command act as a state machine impacting on some parameter of the system; following this logic all the commands are reduced to three sequential actions:

  1. Send a command to the FilamentWeight class (weight commands) or to the MotorControl class (motor commands)
  2. Executes a calculation to update weight values or update one of the internal parameters
  3. Show on the terminal and information output when the execution complete

Install the HX711 Arduino library, download the software from GitHub and upload it to your Arduino board then enjoy!