Skip to content

[Bug]: Unexpected behaviour of the sensor ADC to Diameter  #56

@CCMCAGP

Description

@CCMCAGP

What happened?

Sensor is flashed with infidel_release_ee.ino, board with host_ee_prog.ino. This is calibration over I2C.
I have drill bits of different sizes to calibrate with: 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 mm [for my sensor, 2mm doesn't fit at all, 1.9mm doesn't even go all the way in, and 1mm doesn't move the lever].

I expect the normal behaviour of the sensor to be as coded in infidel_release_ee.ino, and indicated in the docs, as shown by orange curve on the graph -> ADC increases with decreasing diameter.

What actually happens with my readings (Command 6) is the opposite (Blue curve). My ADC readings increase with diameter.

unexpected_sensor_behaviour

Of course this means bad behaviour of the interpolation function convert2dia in infidel_release_ee.ino, so I get incorrect readings when you import the calibrated values in EEPROM starting from the biggest diameter to the smallest, because it includes if (dia_table[i][0] > in) ... return (out); break.

Another issue is that the ADC range is less wide than expected. The range of ADC values given in firmware.rst is [617,999] for drill bits from 1 to 2mm, for me they are spread out from 26 to 282 for drill bits 1.4 to 1.9mm. The resolution is about 2 (=500/256) values of ADC per micron, it's still ok but I'm wondering whether this shift towards lower ADC values, and slight reduction in range is normal. Probably not...

Any solutions?

To solve the incorrect readings, I simply flipped the calibration table so that ADC are sorted in ascending order with the line index of the table.
image

This solved the problem and my readings seem accurate. However I am wondering if I am the only one getting this deviation from the docs or if this is something that should be corrected in the documentation.

Additional info

I got the unpopulated PCB from Aisler, not altering anything from the SMT files there. Also got the BOM from Kitspace without deviations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions