pyr0ball / pyr0piezo

An AVR/ARM based piezoelectric sensor for use in ultra-precise applications
https://docs.pyroballpcbs.com/
Other
71 stars 23 forks source link

[FR] Need to add a function or sub-program to calibrate the Atmega internal reference #33

Closed pyr0ball closed 4 years ago

pyr0ball commented 4 years ago

Is your feature request related to a problem? Please describe. The method used to sense Vcc relies on the internal 1.1v reference built into the Atmega core. There's minor drift in voltage between IC's

Describe the solution you'd like This can be compensated for in the software by changing the "voltMeterConstant" variable.

Currently this can only be set by changing the constant value in the firmware source, but I think adding a function to update it and save to EEPROM would make the process much less painful.

Additional context Method to calculate the correct voltmeter constant:

The reading can be fine-tuned by using a multimeter, and this equation:

scale_constant = internal1.1Ref * 1023 * 1000

where

internal1.1Ref = 1.1 * Vcc1 (per voltmeter) / Vcc2 (per readVcc() function)
pyr0ball commented 4 years ago

Basic function to allow user input added in https://github.com/pyr0ball/pyr0piezo/commit/9e885f316effc105f29027d1b859969f77477851