These files are the basic Arduino sketch interfacing the Infidel, LCD-display and a simple library implementing running statistics. The original library usage of double precision floats works better than the own hacked fixed-precision one I hacked, so I removed it.
The LCD display just shows the actual value, mean value, standard deviation, minimum value, maximum value and the number of measurements. The Serial console displays more fractional digits and also values from the original RunningStat library. The Min() and Max() were my addition.
The 0.4 version add simple support for two buttons at the A2 and A3 pins:
- upper button - start count
- lower button - stop count
- both buttons - reset statistic data
The lower right character position is used to indicate running status with alternating '-' and '|' characters. If the counting is stopped, a space is printed.
Output of the Serial console looks like this:
...
Diameter: 1.68 mm, Count: 4, Mean: 1.6862, Variance: 0.000012, Stdev: 0.0035, Min: 1.68, Max: 1.69,
Diameter: 1.68 mm, Count: 5, Mean: 1.6846, Variance: 0.000023, Stdev: 0.0048, Min: 1.68, Max: 1.69,
Diameter: 1.68 mm, Count: 6, Mean: 1.6833, Variance: 0.000028, Stdev: 0.0053, Min: 1.68, Max: 1.69,
Diameter: 1.68 mm, Count: 7, Mean: 1.6823, Variance: 0.000031, Stdev: 0.0056, Min: 1.68, Max: 1.69,
...
- Source RunningStat library: https://www.johndcook.com/blog/standard_deviation/
- Infidel info: https://www.youmagine.com/designs/infidel-inline-filament-diameter-estimator-lowcost-10-24
ToDo:
- work out why the Arduino IDE doesn't want to work with the library header file. Including source code is not the correct way, but it appears to work.
- Allowing changing the measurement interval, now fixed to 5 seconds. There is a rudimentary command interpreter included, but only commands for starting, pausing, muting, umuting and clearing are implemented.
- Add reset for min and max values.
- Add '' and '/' to running status sequence.
F.J. Kraan, fjkraan@electrickery.nl