@cwilt: With a general 10-7 OhmMeter resistance of steel, it is quite a challenge to confidently detect a delta of almost nothing... copensating for environmental effects may even be a bigger hurdle (as it is also for a magnetic solution). The initial value and variation of magnetic field of a neodyn is 7+ orders easier... Btw, resistance vs tension was tried but failed, succeded capacitive (with telescopic coil spring). Capacitve could a solution (see bottom of the post).
Back to @Gordon's suggested magnet field solution:
Assuming, @Ducky's average magentic field from the earth is about 0.000'048T or 0.48Gauss (see text and chart and calculated); electromagnetic field intensity measurement unit conversions: 1 T(esla) = 10'000 G(auss).
Assuming the plunger moves 4 inches, the magnetic field of an axially (+-y) magnetized neodyn 42 disk of 1/4" (0.25) thickness and 1/2" (0.5) " diameter varies with a 4" plunger movement:
with y=0 for:
x=0.50" to 4.50" from _490.8G to 0.6G --- ~ ratio 1:820```
with x=0 for
y=0.125" to 4.125" from 4674.3G to to 1.5G --- ~ ratio 1:3100```
y=0.750" to 4.750" from _218.5G to to 1.0G --- ~ ratio 1:220```
(calculated, calculator courtesy of K&J Magnetic Inc. based on their product).
Arrangments starting farther away from the magnet are easier to measure (may be...see next paragraph)... Courtesy Honeywell Solid State Sensors SS49/SS19 Series Analog Position Sensors: Hall Effect sensor's data sheet(s) and magnetoresistive-hall-effect-applications applications notes should be able tell. Wether the placement with magnet in the plunger and sensor at the bottom of the clip or vice-versa has to be figured out experimentally, as well as what the effect of the most-likely steel spring has.
With the earth magnetism taken into account, things look pretty bleak for distances of 4":
Earth magnetism by itself reaches 30% to 50% of the magnet's magnetism for x=0 and varying y. The setup with y=0 and x varying becomes a no-option... :(
Conclusion: Measuring over a distance of 4" is a challenge... a complicated calculation with a x,y,z device to compensate for the (locally known) x,y,z components of the earth magnetism may work, though.
Alternatives:
Choosing a measurable setup - shorter distance - may give accurate feedback only for the last 50% of remaining rounds
Measure from 'both ends' with sensor in plunger and magnet axially to plunger moving direction half way
Fix multi-magnet and moving single sensor arrangement
Sngle movig magnet and fix multi-sensor arrangement
A optical - reflecting - solution:
With not too much in rounds in the clip, a multi-IR-proxymity-sensor as a binary encoder (in the plunger with non/reflection on the clip inside-wall may work...
A mechanical-optical solution:
Attach a non-transparent tape with as many wholes as rounds to the plunger, let it pull through the bottom of the clip throught the slit of a IR sensor... The tape could roll onto a spring loaded drum (spring much weaker than the plunger spring).
A laser solution:
Hack a "Laser Measuring Tape" --- expensive and may-be bulky...
A mechanical-resistive solution:
Get a sliding/linear potentiometer and connect the plunger to the slider... If the slide is two short, creat some 'linear-planetary' reduction (cogwheel on the slider, one cogbar attached to the plunger, one to the clip (clip may end up longer)
The capacitive solution:
place a wired, rectangular shaped alu foil piece on one of the wider sides of the plunger
place a wired, isosceles triangle shaped foil on the inside wall facing the foiled plunger side of the clip with the triangle's base at the bottom of the clip and cover it with an insulating foil (tape). The capacity between the wires will decrease with the rounds remaining in the clip. Make sure the distance between the foild plunger side and the foiled clip side are constant (by adding something that 'presses' the plunger against the foild clip side... The cpacity vs position could be a very interesing graph, because the spring - electrically connected to the plunger foil - (and the rounds) may influence the measurment positively. The capacity iself and its change though is very low as well and could be difficult to measure.
Btw, how many rounds are in a clip, and how much moves the plunger? kind-a got it a bit better: @Ducky, is that what you are talking about?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@cwilt: With a general 10-7 OhmMeter resistance of steel, it is quite a challenge to confidently detect a delta of almost nothing... copensating for environmental effects may even be a bigger hurdle (as it is also for a magnetic solution). The initial value and variation of magnetic field of a neodyn is 7+ orders easier... Btw, resistance vs tension was tried but failed, succeded capacitive (with telescopic coil spring). Capacitve could a solution (see bottom of the post).
Back to @Gordon's suggested magnet field solution:
Assuming, @Ducky's average magentic field from the earth is about 0.000'048T or 0.48Gauss (see text and chart and calculated); electromagnetic field intensity measurement unit conversions: 1 T(esla) = 10'000 G(auss).
Assuming the plunger moves 4 inches, the magnetic field of an axially (+-y) magnetized neodyn 42 disk of 1/4" (0.25) thickness and 1/2" (0.5) " diameter varies with a 4" plunger movement:
with y=0 for:
x=0.50" to 4.50" from _490.8G to 0.6G --- ~ ratio 1:820```
y=0.125" to 4.125" from 4674.3G to to 1.5G --- ~ ratio 1:3100```
y=0.750" to 4.750" from _218.5G to to 1.0G --- ~ ratio 1:220```
(calculated, calculator courtesy of K&J Magnetic Inc. based on their product).
Arrangments starting farther away from the magnet are easier to measure (may be...see next paragraph)... Courtesy Honeywell Solid State Sensors SS49/SS19 Series Analog Position Sensors: Hall Effect sensor's data sheet(s) and magnetoresistive-hall-effect-applications applications notes should be able tell. Wether the placement with magnet in the plunger and sensor at the bottom of the clip or vice-versa has to be figured out experimentally, as well as what the effect of the most-likely steel spring has.
With the earth magnetism taken into account, things look pretty bleak for distances of 4":
Earth magnetism by itself reaches 30% to 50% of the magnet's magnetism for x=0 and varying y. The setup with y=0 and x varying becomes a no-option... :(
Conclusion: Measuring over a distance of 4" is a challenge... a complicated calculation with a x,y,z device to compensate for the (locally known) x,y,z components of the earth magnetism may work, though.
Alternatives:
A optical - reflecting - solution:
With not too much in rounds in the clip, a multi-IR-proxymity-sensor as a binary encoder (in the plunger with non/reflection on the clip inside-wall may work...
A mechanical-optical solution:
Attach a non-transparent tape with as many wholes as rounds to the plunger, let it pull through the bottom of the clip throught the slit of a IR sensor... The tape could roll onto a spring loaded drum (spring much weaker than the plunger spring).
A laser solution:
Hack a "Laser Measuring Tape" --- expensive and may-be bulky...
A mechanical-resistive solution:
Get a sliding/linear potentiometer and connect the plunger to the slider... If the slide is two short, creat some 'linear-planetary' reduction (cogwheel on the slider, one cogbar attached to the plunger, one to the clip (clip may end up longer)
The capacitive solution:
Btw, how many rounds are in a clip, and how much moves the plunger? kind-a got it a bit better: @Ducky, is that what you are talking about?
@Ducky, thanks for challenge!