This is an improved version of Filament Width sensor thing #636420, based on shadow casting idea by Flipper's #454584.
Now this sensor measures the filament width in three directions: -45, 0, and 45 deg. Three LEDs are sequentially light up and the sensor measures shadows from each direction. It (hopefully) compensate out-of-round filament shape.
45deg measurement limits the maximum measurable filament width around 2.5mm, so, unfortunately, this version is only applicable to 1.75mm filament. For 3mm filament, consider upgrade the line array sensor to wider one, such as TSL1402.
Update: Download Filament_Widh_Sensor_3LEDs_forUNO.zip for Arduino UNO board.
- Download the 20150302_Filament_Width_Sensor_3LEDs.zip
- Prepare PCB and solder the components. (tricky and costly part!)
- Print case/sensorCover.stl in matt black material. ABS was better than PLA in many cases. If the material is not dark enough, paint the black inside the towers.
- print three case/led_cap.stl as the cover. mount 5pi LED and cover them with the cap. Connect LEDs like the picture. Aware the polarity.
- Upload the firmware: Filament_Widh_Sensor_3LEDsFilament_Widh_Sensor_3LEDs.ino. You need to install TimerOne library to Arduino IDE. Refer http://arduino.cc/en/pmwiki.php?n=Guide/Libraries and TimerOne-r11.zip
- Turn on the visualizer (TSL1401_visualizer) in Processing. (http://processing.org). Through the case, put a 2mm rod as a reference. Type [0, 1, 2] will select the LED and [j, k] will decrease and increase the LED intensity. Decrease the intensity and slowly increase them until the edge detection algorithm works just fine. The green/red lines indicate the detected edge.
6-1. ([email protected] 26, 2016) If this step crashes and complains about size() function, replace line 31 with [ size (387, 316); ]. Current processing does not allow any variable with size() function.
- Type [c] to calibrate the sensor. Now you're good to go!
- If you need more help, type [h] in Serial [email protected] IDE. Look inside the source files.
- Any suggestion and additional contribution will always be welcomed.
1 x Arduino Pro Micro board
1 x PCB
1 x TSL1401 Line scan sensor
1 x 1Kohm resister (SMD 2012)
1 x 10nF ceramic capacitor (SMD 2012)
1 x 0.1uF ceramic capacitor (SMD 2012)
3 x 200ohm resister (SMD 2012)
3 x 10uF multi-layer ceramic capacitor (SMD 2012)
1 x 2x3 pin header
1 x Molex 5046 (right angle, male type mount)
1 x Molex 5051 (female type socket)
3 x High-brightness LED (5mm radius)
8 x 2mm x 8mm sheet metal screw
- electric wires, pin header sockets, solder, ...