Loading

Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

Filament Width Sensor with Arduino Pro Micro and TSL1401CL

by inornate, published

Filament Width Sensor with Arduino Pro Micro and TSL1401CL by inornate Jan 15, 2015

Contents

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

9127Views 1307Downloads Found in 3D Printer Parts

Summary

WARNING: THIS THING IS OUTDATED.
======================================
Please visit http://www.thingiverse.com/thing:704897 for updated version.


I've modified flipper's great filament width sensor design to use an Arduino board, which is considerably more familiar to most makers.

This sensor board have equivalent sub-pixel accuracy which came from the flipper's design. It dismisses the calibration button, however it allows serial communication via USB (Atmega32u4) that permits in-situ calibration and monitoring of the reading values. Also, this approach enables easy firmware update even after installation.

With very limited soldering equipment (no reflow oven), I decide to use ready-made Arduino Pro Micro (https://www.sparkfun.com/products/12640) board from Sparkfun electornics. (As an alternative sourcing place, a cheap ebay one only costs <7$)

I designed the board to be CNC-familiar; it needs few (maybe two for GND and one for AO) jumpers when you make an one-sided board with home CNC milling machine.

I modified the case to fit 1.75mm filament instead of 3mm. (If you wanna get it back, you may simply remove several cylinders from OpenSCAD source.) Also, 2mm rod is used for calibration instead of 1.57mm which is rare in metric world.

This part is still work-in-progress, so I'm not able to provide very instructive guide to build this, but I think the source codes and pictures are self-explanatory.

BOM)
1 x Arduino Pro Micro board
1 x PCB (can be CNC-milled)
1 x TSL1401 Line scan sensor
2 x 1K resister (SMD 2012 size)
1 x 10nF ceramic capacitor (SMD 2012 size)
1 x 0.1uF ceramic capacitor (SMD 2012 size)
1 x 1x5 right angled pin header
1 x High-brightness blue LED (5mm radius)

  • electric wires, pin header sockets, solder, ...

More from 3D Printer Parts

view more

All Apps

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

Is it possible to use a Arduino Nano with not to much changing?

Hi,
I've seen the 45 deg version and its great, but i want to measure 3mm filament too.
Would this version be able to measure 3mm filament?

Probably not. The shadow will be getting out of sensing range at 45deg. 3mm Filament need a longer sensor such as TSL1402 which have an identical communication protocol to TSL1401, however the PCB design and some source code should be changed.

Hi

Thank you very much for your reply. I do know the 3 LED version - and I am going for that also. I Understood that the electronics was identical - and that was found here. I have ordered the PCB of the web - so problem solved.

Hi there

This is so cool - and I must have one for my filament extruder and 3D printer. i have ordered the components. But I can not open the .brd and .sch files in Eagle (yes I can... but) and export the gerber file that I need. Eagle comes with 3 warnings and my normal procedure do not give me the files that I need. In which program have you made the electronics?

Have only made my own PCB's which works just fine but this is the first time I am trying to use others - so I might be doing something basic wrong when opening, or the like...

I'm using Eagle 7.2.0 and it opens the files without problem. If you're using older version, consider update them.

Also I've updated the sensor with 3 directional measurement feature. Please consider http://www.thingiverse.com/thing:704897. By simple modification in OpenSCAD, you may use them only have one LED tower, indeed, which is backward compatible.

Filament Width Sensor with 3 LEDs, TSL1401CL, and Arduino Pro Micro

That's right , i am reading Arduino Tutorials and other examples and try to make some correct circuit when i will get components.

Thanks!!!

@inornate, actually i never worked on Arduino before so it is good for me if you can help me for all assembly and code.
Please check this Circuit Diagram Image
http://goo.gl/dvTX7p
But can't understand how to hookup these with Pro Micro board.
Please help me make this assembly and required code for it.

Dear @1990ankitjain. The schematic looks OK. But the pro micro board seems different (24 pins for mine but 34 pins in your diagram). Check that. Also, you need to wire up ENABLE, Reset, Sleep, MS1~3 pins as well. They don't need to be connected to MCU but need some voltage assignment. (I recommend assign some GPIO pin to ENABLE pin. It would save current when it's not in use).

Anyway, your request is not that easy for me. I'm just a weekend hobbyist having limited time. IMHO, you need to study basic electronics and study programming. Also. read datasheets. Thanks to internet world, there are tons of examples and tutorials. Usually, the request like "help me for all assembly and code" need some compensation for one's labor.

@inornate, Nice work, i just order these Arduino Pro Micro board and TSL1401 Line scan sensor,
Can you help me to use this with Pololu - A4988 Stepper Motor Driver to control Nema 17 Stepper Motor.
I want to add this with my Filastruder Filament Extruder puller assembly.

@1990ankitjain. I'd love to hear that you like this.
First, You need to additionaly setup the 12V power supply for the stepper driver (VMOT), and some wire hookups between MCU and stepper driver.
And then, now do firmware works. Assign DIR and STEP pins and add some pulse generating method stub. Read the filament width as a feedback, and adjust extrusion speed within the closed feedback loop. This require an arduino coding skill.

What part of above needs my help?

I just need to mention that this project uses the tsl1401cl sensor.
This is just for the google bot in order to help other people, might be a good idea to also update the title.

I've been planning to port the sensor to arduino and it's a good thing I read the comments on Flipper's page before starting.

Thank you for your suggestion. I'll update the title.

Thank you for porting this projekt to an Arduino based board. Today I finished making the PCB. I have not yet printed the case (I guess I will do a redesign, CAD is something I'am quite good at). After flashing the firmware i checked the workshop for a small rod and found a brass pipe 2mm in diameter (my caliper showed 1.99 mm). I just used an LED flashlight about 50cm away from the sensor and it immeadiately, whitout doing any calibration, showed a diameter of 1.97 mm (diviating +-0.02mm). All of this was done by just looking at the serial output.
Once everything is done i will post some pictures! Keep up the good work and thank you again for your efforts.

I wish good luck with your build.

I recommend to use a normal LED (No high-brightness. this will probably saturate the sensor) and select a resister with care.
I would probably add some lightness adjusting feature like filpper's original code.
My current code add 900ms integration time. This value seems more robust.

I'll update this soon.

Excellent build. Its great to see an Arduino version out there. I like that you can use an off-the-shelf Arduino and still fit it in the case.

Thank you for your reply flipper.

I've used this sensor for couple of days, and found some issues. You've probably bumped some problem already. It would be good to have some discussion about these problems.

1) Dust on the sensory area is actually a problem. I tuned the LED brightness as low as possible to deal with a transparent filament (edges are getting dark enough for detection). It was quite successful attempt, but a single thread of my cat's fur shaded the sensor and scrambled the value reading. I'm attacking some image processing technique to compensate this kind of noise. Currently, I extend the integration time by a factor of 2 and sacrifice the maximum sensibility.

2) Arduino doesn't have a true DAC capability. It only provide PWM, which is problematic with fast "shutter speed (=short integration time)". A cheap low-pass filter may be the solution, but I couldn't avoid oscillation and noisy sensor image. I have plan to add some variable resistor and provide a visualization tool. One can adjust it manually while checking the real-time sensor image.

3) In-situ USB communication is beneficial. I add a function that monitoring filament width and log them with a computer attached to the sensor. As a result, I could visually inspect the constancy of the filament. Some of them have +-0.05mm clearance and some are not. So informative!
Any more idea?

4) Oval shaped filament cannot be correctly compensated, as long as there are only a single scanning direction. I have a plan to place two LEDs arranged in V-shape above the sensor, and alternating them to get a 2D cross sectional view

Again, I give a word of big thanks to flipper who initiated this awesome project.

Inornate, my code automatically adjusts the LED intensity so that the sensor does not saturate. That might help. I think transparent filament will need some special image processing to work. As far as output, the PWM uses a simple lowpass RC filter to turn the pulses into a DC signal. Yes you could add multiple LEDs at different angles and light each one at a time to get various cross sections. Each one would need to have its own calibration factor, since the cast shadows will have different scales due to their angle. They could be recombined to produce a measurement of the cross sectional area.

Great work. I had started on a similar project. Nice to know you saved me the effort!

Thank you for reply. If you find any improvement, please post them!

Top