2017

June 2017

# 3d printer filament roll holder and monitor for Arduino

Posted by balearicdynamics Jun 24, 2017

## Introduction

This project aims to solve two issues I have experienced working with 3D printers: controlling the filament consumption while the 3D printer is working. After exploring several possible approaches I decided that the most reliable solution should be based on the weight control.

The ability to dynamically measure the plastic material (filament) in use by a 3D printer includes some interesting non-obvious aspects helpful in many phases of the 3D printing process.

On June, 30 this project has been featured on Tindie Blog | 3D Printer Filament Weight/Length Monitor

### Weight vs length and vice-versa

3D printers filament is sold in weight; the most common packages are 1 or 2 Kg filament rolls. The reason is that the product format, i.e. the filament in our case is the most important aspect for the end-user but meaningless for producers. Producers just sell kilograms of plastic material (PLA or ABS); the filament is the form factor provided on the market for a specific usage. I suppose that the same company that provides PLA filament it is not excluded will also provide the same material in other formats (e.g. plates, powder, pipes, film etc. for other applications). But for a similar reason 3D printers users needs to measure their filament in length. Slicer algorithms calculate the meter of filament needed for a certain 3D printed object so it is important to know how much meters remain in the roll before starting a new object printing and how many meters are used during a print job.

We know the specific weight of the materials used for 3D printing: PLA and ABS have different specific weight and this is a constant value. We also know the filament diameter; this means that 1 Kg 1.7 mm diameter filament will be longer than 3 mm diameter filament, same weight.

Calculating the conversion between weight and length it not so difficult knowing these parameters. You can just play with an algorithm with this nice online filament calculator.

## Finding and testing the load sensor (scale sensor)

The first step was to find the right weight sensor and test its sensitivity. I should thank to michaelkellett that addressed me in the right direction; I bought a first series of four scale sensors in the weight range of 0-5 Kg and about half gram sensitivity for 3\$/piece including the HX711 based amplifier circuit (the IC datasheet is in attach to the bottom of this post)

Using a 3 mm MDF sheet I have created a simple test sample to see the kind of data I should expect; after writing a few lines of code to show the readings on the serial terminal from an Arduino UNO I got a satisfying result and I definitely adopted this hardware solution.

## The filament roll scale design

Recycling the idea of my 3D printer filament spool holder design I have made the design of a compact scale supporting a rotating filament roll as shown in the images below. As shown in the 3D representation the filament roll lies on the four wheels that rotates free and the support is connected to the base through the scale sensor.

One support can be entirely built 3D printing 22 pieces with some M3 and M4 Allen screws and nuts at a very low price

## Assembling the parts

After all the 22 pieces has been printed can be easily assembled together. The top and bottom surfaces will be the filament spool support and the weight material scale at the same time. The filament is tensioned by the extruder so the roll should be free to rotate lying on the four free wheels (the orange ones). As shown in the assembly steps in the image gallery below top and bottom sides of the support are joined through the load sensor. It should be in the range 5-10 Kg max to support the filament roll that weight between 1,5 Kg and 2,5Kg (2Kg plastic rolls).

{gallery} Scale roll support parts and assembly

3D printed base

3D printed top

The free wheels supports

The free wheel supports

The free wheel supports mounted on the top part

The top part with the free wheels assembled

Free wheel detail (top support)

The base with the four calibration screws, top view

The base with the four calibration screws, bottom view

Calibration screw with spring of the base

The base with the load sensor mounted, bottom view

The base with the load sensor mounted, top view

The top support mounted on the base through the load sensor

The final assembly side view

Testing the support 3D printing

Testing the support 3D printing

### Some structure improvements

Testing the first version of the 3D printed scale I saw that filament rolls can have different spool dimensions, also if the same weight. To manage the different widths between spools (may depends on different providers or different production batches) the top base design has been update; now it is possible to set the position of the four free wheels supports as shown in the images below.

The wires coming from the load sensor are very thin and delicate so I decided that it was too risky to add a connector do I decided to include in the scale building also the HX711 filter adding two holes to the bottom part to fix the small IC board.

## Circuit and wiring

The image below shows the functional design of the circuit and the interface

As the filament is usually available in two different dimensions, 1.75 and 3 mm diameter, the rolls are available in different weights and we should consider using at least two kinds of materials it was necessary to provide a three dip switch to select these three settings before starting the system. Making the first experiments I saw tat it was impossible to distinguish automatically the three phases when a 3D print job starts:

### 2. Place the filament roll and wait the weight stabilises

(consumption can be expressed in grams or centimeters)

I have added two push buttons; an action button to manually set the three phases and a measure unit switch to select the visualisation on the display: filament units in grams or in centimeters/meters.

To have a complete status of the hardware a 3mm orange LED blink during every weight reading cycle while for the display I have used a shift register display (the full documented project is in these two articles: Enrico Miglino on ElectroSchematics.com  and Arduino 16x2 LCD Shift Register Library - Part 2 ) based on 74HC595 shift-in register I have built in past to reduce the usage of Arduino pins.

As the MC711 already generates a digital signal only two pins are needed to connect it to the Arduino board.

### The project in action

The video below shows the first prototype and the final building in action after software filtering calculations have been included in the building.

The initial part of the video shows how connecting the sensor only without controls, due to unpredictable weight fluctuations it is almost impossible to control the three phases mentioned above while the second part shows the final version accordingly with the wiring scheme.

## The software

The Arduino sketch is built in two parts for better readability: an header file defining all the constants used by the calculations as well as the pin settings and the source functions in the .ino file. All the project is distributed under the LGPL 3.0 license and is available on GitHub: https://github.com/alicemirror/3DPrinterFilamentMonitor-LCD

Additional libraries added to the sketch are the bodge MX711 library fo manage the scale IC and the updated library for the shift-LCD fixed compatible with the last versions of Arduino IDE, available in attach to this post.

# Arduino Project : Three-Finger Ring - Part 3 Assemble the Ring!

Posted by Cabe Atwell Jun 24, 2017

Project build Index:

Arduino Project : Three-Finger Ring - Part 1 Getting started and 3D Printing

Arduino Project : Three-Finger Ring - Part 2 Code & the Circuit

Arduino Project : Three-Finger Ring - Part 3 Assemble the Ring!

----------------------------------------------------------------------------------

Step 6: Assemble the ring and install the components.

At this point, disassemble the breadboarded circuit and begin installing it into the ring. Glue and a hobby knife are essentials in this step. Unless you got lucky or have a printer that fabricates with a nigh-zero deviation from mathematical perfection, you will need to use a hobby knife to trim the printed parts.

The power pack is made by sandwiching the batteries together with a positive and negative wire and wrapping the whole affair tightly with electrical tape (Figure 5).

Hot glue was used to fasten the parts in place (Figure 6).

The #4 screws are used as pins for the hinge and to fasten the ring’s lid down (Figure 7).

Figure 5: The ring battery pack. It is a bit inelegant, but it works.

Figure 6: Glue the parts into the ring.

Figure 7: The #4 screws fasten the ring together.

Step 7: Power it up and show it off.

You might want to create some fresh images for your ring. Our pics didn’t increase our popularity quite as much as was hoped. Here are a few examples.

Final Notes:

We used a 128x64 OLED screen with that goofy yellow and blue background color. You can use whatever screen you want (almost whatever screen) as long as you adhere to a few guidelines. Make sure that the screen communicates via I2C.

The circuit and code do not use the RESET line. If the screen you get does have a RESET line, pull it HIGH by wiring it to the 5V output on the Trinket Pro.

If the resolution of the screen is anything other than 128x64 pixels, you will have to:

• Size your images appropriately using a picture editor. You will not be able to use the CPP arrays in the provided code. You will have to create new arrays for your screens exact resolution.
• You will have to adjust the U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK) line in the code so that the U8glib library knows what screen size to work with. There are no provisions in the code or the hardware for detecting any information on the screen, so you have to tell it what is going on.

You are not obligated to use two CR2032 batteries to power your ring. Use a Li-Po battery back, an AAA with a boost converter, whatever. It doesn’t matter. The Trinket Pro can be powered by anything from 5.5-16 volts. If you wanted, there is no reason why a tiny Lithium-polymer battery and a battery management board couldn’t be used in place of the coin cells. Or a solar cell in conjunction with a super-cap or rechargeable battery.

Thanks for reading! Good luck with you own ring project!

# Arduino Project : Three-Finger Ring - Part 2 Code & the Circuit

Posted by Cabe Atwell Jun 24, 2017

Project build Index:

Arduino Project : Three-Finger Ring - Part 1 Getting started and 3D Printing

Arduino Project : Three-Finger Ring - Part 2 Code & the Circuit

Arduino Project : Three-Finger Ring - Part 3 Assemble the Ring!

----------------------------------------------------------------------------------

You have everything ready from Part 1 right? Good. Now it's time to program and get images on that screen.

Before installing anything, test it on a breadboard. That way, it will be so much easier to troubleshoot. See the electrical schematic in Figure 4.

Figure 3: Breadboard the circuit before installing it.

Figure 4: The electrical schematic for the Screen Ring.

Step 5: Upload the code to the Trinket.

There are a few special considerations for using the Adafruit Trinket. The IDE available from the Arduino site does not natively support it. You will need to either download a special version of the IDE from Adafruit with the board data pre-loaded, or you will have to follow the instructions on the Adafruit website detailing how to load the board data into the IDE. Either way, you will need to start HERE at the Adafruit introduction to the Trinket.

The cornerstone of the Screen Ring code is the U8glib library. It takes care of all the heavy lifting regarding control of the screen. The specifics of this library are well beyond the scope of this article but, if you want to learn more about it, start HERE.

Step 5-2: Create some sweet bitmaps for the ring.

The Arduino code cannot read PNGs or JPGs and the like. It requires BMP images to be converted into data arrays which are then pasted into the code. One of the easiest ways to accomplish this is to use the online image2cpp converter. Just upload a BMP, convert it and then copy the generated code into the Arduino sketch (Figure 5).

There are some rules for getting the converted images to display properly. This can all be done in Windows Paint.

• Images must be in black and white.
• Images must be created with a size of 128x64 pixels.

Figure 5: The beginning of an array pasted into the sketch.

Resources: The CODE.

Attached to this post is code used in the Three Finger Ring.

In it, you can change the code to for any images you convert.

# Arduino Project : Three-Finger Ring - Part 1 Getting started and 3D Printing

Posted by Cabe Atwell Jun 24, 2017

Project build Index:

Arduino Project : Three-Finger Ring - Part 1 Getting started and 3D Printing

Arduino Project : Three-Finger Ring - Part 2 Code & the Circuit

Arduino Project : Three-Finger Ring - Part 3 Assemble the Ring!

----------------------------------------------------------------------------------

I already teased this project back on "Geek Day," June 9th 2017. It's now completely finished!

This writeup will go over all the steps taken to build the screen ring. However, you dear reader won’t have to personally execute every step. You have the option of skipping steps because we will provide the 3D models for the ring and the accompanying code. You can procure the parts and print the ring without any of the design work. The one aspect of the design that you may have to change is the size of the holes in the ring to accommodate finger size.

In this section, we are going over all the mechanical aspects of the ring. What parts to gather. And how to get the ring 3D-Printed. (Part 2 is where we will cover the circuit design and code.)

Step 1: Decide on the parts to use.

For the dangerous end of the ring, we used a 128 x 64 pixel 0.96-inch OLED screen, very similar to this screen here. The exact screen we used is permanently blue with a yellow band across the top third. The yellow top third was probably originally intended to display data like the time and the battery charge.

An Adafruit Trinket Pro 5V provided the brains. It has far more IO than is needed but that’s OK. All those extra pins and features can be used on the next version of the Screen Ring.

While the options for powering the ring are many, we went with a couple of CR2032 coin cells. Each coin cell outputs 3V so stacking two of them in series yields a handy 6 volts. This is just enough to power the Trinket and for the Trinket’s onboard MIC5225 to regulate the voltage down to 5V for the OLED screen.

Bill of Materials

Quantity 1 - OLED Display, 128x64, I2C

Quantity 1 - Tactile Switch or something roughly equivalent

Quantity 2 - Adafruit Trinket Pro 5V

Quantity 2 - CR2032 coin cells

Quantity 3 - 10k resistor

Quantity 4 – #4 x 0.5” (12.7mm) machine screws

Step 2: Design the ring.

The ring was designed in SolidWorks, but any 3D CAD software like LIBRECAD or FREECAD will work. Again, you don’t have to design anything if you don’t want to. However, for the those who would attempt it, here is a bit of design advice.

• It always helps to have at least a nebulous concept in mind.
• Start by creating 3D models of the parts you know will be used. In this case, the screen, the batteries, the button and the Trinket. The level of detail applied to each of these models is up to you. You may not need to model the Trinket down to the point where all of the components on the board are represented. However, it would be a good idea to at least make the model large enough to fill the immediate space around the Trinket.
• Start with a box big enough to hold all of these.
• Position your parts inside the box where you think you would like them.
• Start removing material where you don’t need it and adding it where necessary. For example, you might add bosses or studs for holding parts.

Once this "box full of parts" was designed, it was obvious that a single finger wasn’t going to be enough support it. For stability and coolness, it was decided that three rings bridged together would do the job. To get the size just right, a few of the ring-only sections were printed up and tested on actual hands.

Figure 1: 3D modeling in progress. (NOTE: This image is far from the final design)

Step 3: Print the ring.

The 3D models can be sent off to a service like Shapeways or you can print them up yourself if you have access to a printer. For the ring seen here, we used our MakerGear M2. A quick shout out to MakerGear, the M2 deserves all the approbation it gets. It really is a workhorse.

We used this particular blue color (Figure 2) because it’s cool and kind of makes things look like they’re from the future. Oh, and because we had several rolls of that color already on hand.

Figure 2: This blue color is so rad.

Resources: 3D Models.

Attached to this post is a collection of the 3D models used in the Three Finger Ring.

You could use this as a starting point for your custom design too.

By date: By tag: