Diameter wrong with TSL1401CL filament width sensor, bed temperature 20° too low

Basic Information:

Printer Model: self made based on prusa
MCU / Printerboard: MKS Robin nano 3.1
Host / SBC Rasperry PI3
klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Dimensions are shown completely wrong in kipper with TSL1401CL width sensor, difference is about 1.1 mm too big. For example, filament is 1,58 mm, shown is 2,77 mm. The sensor works fine with ramps board on marlin 2 for years.
Also bed temperature is not correct, set temperature to 100°C, real temperature is abot 82°C. Temperature sensor is right, measurements of resistance is correct. It is a 3950 100K sensor, configured as generic_3950.
Maybe there is something wrong with analog inputs of the printer controller board?

klippy.log.zip (745.5 KB)

Welcome ba0547,

I guess you read Configuration reference - Klipper documentation

I saw in your klippy.log you played with “default_nominal_filament_diameter” and “max_difference”. You never touched “measurement_delay: 100”.
Is your distance from sensor to the melting chamber exactly 100 mm?

Yes, i have read all information i found about this Sensor in Dokumentation. I mean that this value would Not Change the current measured diameter. This value has only influence while printing is active.

Do you understand the workflow of klipper/klippy/extras/tsl1401cl_filament_width_sensor.py at master · Klipper3d/klipper · GitHub?

I don’t know the 128 × 1 linear sensor array and how it works. Also, my python knowledge is not good enough.

But I know enough to state “measurement_delay” is needed by tsl1401cl_filament_width_sensor.py to work properly.

Did you try the correct “The distance from sensor to the melting chamber as mm” for your printer?

Did you do https://www.klipper3d.org/Config_checks.html?h=pid#calibrate-pid-settings?

This sensor is really rarely used, so unfortunately, I cannot offer much guidance.

How the Klipper module works:

  • The TSL1401CL returns a voltage value.
  • Klipper samples this voltage value via an ADC-capable pin on the MCU.
  • The detected voltage translates one-to-one to the diameter; this means if 1.5 V are measured, the filament diameter is assumed to be 1.5mm.
  • Via the default_nominal_filament_diameter, a correction factor for the extrusion amount is calculated and applied via M221.
  • The measurement_delay determines after which distance of forward-moving filament the correction factor needs to be applied during printing.

So, assuming that Klipper does ADC correctly (otherwise all temperature measurements would be screwed and there is no indication for such), the displayed diameter has a direct relationship to the output of the module.

Do you have a link to the specific product that you are using?

I know how this sensor works, and it works together with Marlin2 on a Ramps board and a mega2560 for years. The voltage is translated as you described. This is correct, there is no hardware problem with the sensor itself. The M221 is a correction value for the filament diameter. This is a one shot correction, the sensor corrects this values instantely while printing the percentage of the filament will be adapted automaticly. this worked for me for many years on other hardware and software platform. But not on klipper with mks robin nano v3.1!! I mean that someting is wrong with measurement of analog values, maybe some reference voltage is wrong calculated in software or there is a hardware fault on my board. at least measurement of heat bed temperature is wrong. I do not know how to find out what is the cause. I do not know how to make shure it is a hardware fault. Unfortunately MKS does not specify all restors and diodes in their documentation. schematics are supplied incomplete.
I am using this sensor: Filament Width Sensor Prototype Version 3 by flipper - Thingiverse
As i said before, the sensor translates the dimensions correctly. this is not the problem.

no, unfortunately my python knowledge is also not good enogth to understand everything in this script. Maybe i can try and error if i can modify something in this script which can bring a possible solution. the measurement delay is the dimension from the sensor to the end of the extruder. this value has no influence to the measured diameter when you want to show the diameter via terminal macro/instruction. yes, of course it is needed, but when the diameter is calculatet wrong, i can not even start printing. because the difference is not acceptet by klipper when it is more than 1 mm. pid settings also does not cause a correct measurement of the temperatures. I did run the calibrate pid settings macro.

Unfortunately, I cannot offer any more guidance here. To the best of my knowledge:

  • Some MKS boards (and others as well) are known for unstable ADC workings, but I’m not aware of any reports concerning the Nano 3.1, which is a quite widespread board.
  • Usually, errant temperature readings are due to defects in the wiring or the NTC itself and can manifest in multiple ways.
  • The board has 3 dedicated temperature ports in total. One troubleshooting approach might be to connect different probes to different ports and compare their readings against a common temperature source - for example, tape them to a heated bed.

Edit: I just noticed that you have

[heater_bed]
...
sensor_type = Trianglelab-NTC100K-B3950
...
pullup_resistor = 6700

in your config. Neither is Trianglelab-NTC100K-B3950 a valid sensor type in Klipper, nor 6700 a valid pull-up value for this board in its standard configuration. Unless you put this with good reason, both will of course lead to crappy results.

It might make sense to cross check against known configuration files, e.g. https://github.com/makerbase-mks/Klipper-for-MKS-Boards/blob/main/MKS%20Robin%20Nano%20V3.x/generic-mks-robin-nano-v3.cfg and Common thermistors

I read some articles about this board where people also have problems with incorrect temperature measurements. My NTC and the wiring is completely correct and not defective. It works well with other combination of hardware and firmware. Swapped extruder and bed temperature measurement ports with almost the same results. maybe extruder temperature measurement is also wrong. but i can not verify the extruder temperature.
yes, i know. tried to find a solution for correct bed temperatures. Trinangle Lab sensor type added to config files with my measures. pullup resistor was another try to find a solution. i know, normally pullups are 4,7kohms. higher values gets me better results. known configuration files does not match my configuration. i have at least other temperature sensors. my current config file is mutch bigger, with much more features.

Did you read Temperature sensor "NTC 100K beta 3950" is very inaccurate · Issue #4054 · Klipper3d/klipper · GitHub?

have found a particial solution. changing the value of the measured dimension. The python script for the dimension width sensor does not seem to calculate correct filament dimension. at least for my combination of hardware. please see attached screenshots..
I am a new user, therefore i can attach only one upload!!??

Bildschirmfoto zu 2025-07-14 22-27-21

maybe tomorrow i can attach more uploads?

@administrators

Could you split this thread? It’s getting confusing :wink:

Sorry, dont know how to split. The problem with the diameter sensor has been solved by myself. Also found a (bad) solution for the bed temperature problem. Still do not know if its a hardware or software problem. Think a better MKS robin nano documentation can help getting a better solution. Dont know if the chinese producer will support. As i said before, got no answer from them.

You can’t. Just administrators.

You are talking about Diameter wrong with TSL1401CL filament width sensor, bed temperature 20° too low - #11 by ba0547 could you please explain, what you didi?

Which one? Could you explain?

One question. Why did you choose a Mercury One against a Voron 2.4?

So why do you ask me to split when you know that only admins can do?
Already explained, three days ago. Please see the image in the post. canged a value in /home/pi/klipper/klippy/extras/tsl1401.. from read_value * 5 to read_value * 2.85198. Details in previous post. bed temperature problem “dirty” fixed with pullup_resistor = 7700, this is not recommended, but it gives me better temperature values. Already explained before.
What do you mean with Mercury One against a Voron 2.4?

Sorry, my fault. I got mixed up with Looking for help with input shaper. Again, sorry.

Which Prusa printer?

Based on that: Haeckel - RepRap

But with many modifications and improvements, e.g. x axis based on prusa i3.

First generation was based on prusa mendel, but this is long ago.

1 Like