Scaling ADC inputs for filament width sensor

I’m currently tinkering with hall sensors for filament width measurements, and the current Klipper support already performs perfectly fine for me.

Using two hall sensors to compensate temperature drift is a good idea. Adding up the ADC readings for two opposite-facing sensors compensates sensitivity drift, assuming the two sensors are “symmetric” in that regard. Unfortunately, it adds up null drift (the temperature dependent bias) of the two sensors.

This could be solved by letting the two sensors face in the same direction (which also is way easier with SMD parts) and subtracting the ADC readings. This compensates sensitivity and null drift, as long as the used sensors have reasonably similar temperature drift characteristics.

The current implementation in already scales both ADC readings using a fixed factor of 10000. I made these values configurable to account for different sensor layouts.

Any opinions, improvements or other ideas about that?

This is somewhat unrelated, but still in regards to filament width sensors (unfortunately not many use them and I don’t know of an extruder design that uses one). Have you considered using hall effect sensors with temperature drift compensation? Main klipper does not support singular sensor setups, however checking distributors these sensors are cheaper than the genuine SS49E usually used (especially two of them) and it would certainly make design and assembly easier.

You can use singular sensor setups by pulling the second ADC input to a fixed voltage. It’s wasteful, but it works. Creating a custom klipper module is probably a better idea.

Regarding temperature drift compensated hall sensors… I looked around a bit and found the DRV505x models by TI, which use different approaches: Some have mostly constant sensitivity, while others try to compensate for the (reversible) decrease in remanence exhibited by permanent magnets (0.09 to 0.12 %/K for neodymium).

The latter is probably preferable if the permanent magnet and the sensor have the same temperature, which should be the case here.

I think I’ll get my hands on some of them and see how they do.

I remember having bought one of these I believe. I would have to check. Or I bought three, but used two for the sensor due to being unaware of the trick you mentioned.