jlab-sensing / ENTS-node-firmware

Firmware for STM32 and ESP32 microcontrollers on the Soil Power Sensor board
MIT License
0 stars 3 forks source link

Add adc calibration support #88

Closed stevegtaylor closed 1 week ago

stevegtaylor commented 5 months ago

name: Stephen Taylor about: calibration eqn for the demo title: 'Junior Specialist' labels: '' assignees: 'jmadden173' reviewers: 'jmadden173'

Name/Affiliation/Title Stephen Taylor, UCSC, staff

Purpose of the PR Added a 'calibration' folder for calibration procedure. Integrated the positive voltage calibration for the purposes of the demo

Development Environment Windows

Test Procedure Run calibrate adc with a soil power sensor and the 2450 and see if it outputs reasonable values.

Additional Context Closes #50

stevegtaylor commented 5 months ago

least_squares_calibration.py is the Jupiter notebook file you made converted directly to a python file. linear regression.py is my file that i started from scratch

jlin143 commented 1 week ago

Here was the fix:

  1. HAL_Delay(60) // at least 50.01 ms after configure in readvoltage readcurrent
  2. re-enable calibration and make sure that the readcurrent calibration is not commented out --> change to the const not the defines
  3. single shot mode: adjust the argument passed to ADC configure to not have the second least bit high ( & ~0b10)
  4. consider adjusting the Data Rate (DR field in the config register) if the sample period (20 SPS ~ 50.01 ms) is too slow.