Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adc calibration support #88

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open

Add adc calibration support #88

wants to merge 66 commits into from

Conversation

stevegtaylor
Copy link
Member

@stevegtaylor stevegtaylor commented May 20, 2024


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
N/A

Copy link
Contributor

@jmadden173 jmadden173 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between least_squares_calibration.py and linear_regression.py?

I think there is a way to get a single calibration function for the entire range rather than have two separate calibration equations. The two equations will use more memory on the FRAM chip and more floating point computations. If the ADC outputs a 24bit full scale number there should be a way to get it to a uint32 with 0 as -3.3V and 2^24 as 3.3V.

calibration/LICENSE Outdated Show resolved Hide resolved
calibration/PingSMU.py Outdated Show resolved Hide resolved
calibration/PingSPS.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify if any of these settings are being used? They all look like they're from v1 of the board

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haven't touched this file, so they probably are from v1 of the board

calibration/least_squares_calibration.py Show resolved Hide resolved
stm32/Src/examples/calibrate_adc.c Outdated Show resolved Hide resolved
stm32/Src/examples/calibrate_adc.c Outdated Show resolved Hide resolved
stm32/Src/examples/example_adc.c Outdated Show resolved Hide resolved
@@ -143,9 +143,9 @@ int main(void)
reading_len = sprintf(output, "Voltage: %f\r\n", voltage_reading);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be able to use SysApp_Init or whatever it's actually defined as to start the UTIL_Timer and give us access to APP_LOG instead of having to use sprintf which get messy.

stm32/Src/main.c Outdated
@@ -39,6 +39,7 @@
#include "phytos31.h"
#include "rtc.h"
#include "sensors.h"
#include "transcoder.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this included in main?

@stevegtaylor
Copy link
Member Author

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

@jmadden173 jmadden173 changed the title 50 calibrate adc Add adc calibration support Jun 20, 2024
@jmadden173 jmadden173 self-assigned this Jun 20, 2024
@jmadden173 jmadden173 self-requested a review June 20, 2024 20:20
@jmadden173 jmadden173 linked an issue Jun 20, 2024 that may be closed by this pull request
Copy link
Contributor

@jmadden173 jmadden173 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run linter on python code following the soil_power_sensor_protobuf module

As talked about move calibration traces to separate repos.

I think we should remove calibration python files that aren't use so make it more accessible. Possible archive them in Google Drive so that if we have a use case in the future they are there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file needed?

git Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

python Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File name should be all uppercase or else cpplint will not work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be flushed out and explain what each of the files are and how to use them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file looks like its not needed anymore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think scipy and numpy are included in this requirements.txt

@jmadden173 jmadden173 assigned stevegtaylor and unassigned jmadden173 Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perform calibration of ADC (Due: 2024-03-15)
3 participants