-
Notifications
You must be signed in to change notification settings - Fork 2
Add current sensor calibration documentation #95
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
13a70d4
Initial commit
anirudhupadhyaya 389f267
Update readme
anirudhupadhyaya 9c85d49
Update readme
anirudhupadhyaya f477839
Update readme
anirudhupadhyaya ba8b2d8
Add files
anirudhupadhyaya d070217
Update files
anirudhupadhyaya 9bdcf98
Changes
anirudhupadhyaya 11b4a4b
Changes
anirudhupadhyaya 56110b8
Update files
anirudhupadhyaya 554b202
Get rif of scope image
anirudhupadhyaya 5ea2b99
Minor updates
996ae82
Merge pull request #101 from Severson-Group/user/npetersen2/patch-1
anirudhupadhyaya 3371b62
Address review comments
anirudhupadhyaya efa5850
Remove resources
anirudhupadhyaya c149819
Add back resources
anirudhupadhyaya fdd3e31
Address review comments
anirudhupadhyaya 3863bd2
Address review comments
anirudhupadhyaya f0b25e1
Update index.md
elsevers 911e319
Edit current sensor calibration method section
elsevers b77e573
Edit calibration method section
elsevers f48e356
Add section on Recalcilating current sensor offset
elsevers f0d00a2
Clarify that we measure a voltage.
elsevers cdcb633
Edit conclusion
elsevers 3047a09
Update index.md
elsevers 0097469
Update index.md
elsevers fb84857
Merge pull request #105 from Severson-Group/elsevers/edit_current_sen…
anirudhupadhyaya 941ff1b
Address review comments
anirudhupadhyaya 355cf05
Update doc
anirudhupadhyaya 4bf6d53
Update index.md
anirudhupadhyaya 89d7632
Update index.md
anirudhupadhyaya e26351e
Update index.md
anirudhupadhyaya 5806313
Apply suggestions from code review
anirudhupadhyaya b2da7cb
Update source/getting-started/control-with-amdc/current-sensor-cal/in…
elsevers 93bf498
Update source/getting-started/control-with-amdc/current-sensor-cal/in…
elsevers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 55 additions & 1 deletion
56
source/getting-started/control-with-amdc/current-sensor-cal/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,58 @@ | ||
| # Current Sensor Calibration | ||
|
|
||
| How to calibrate current sensor feedback | ||
| ## Background | ||
|
|
||
| Motor drives typically require current sensors to provide feedback to the control system. This document describes a method to calibrate the current sensors to a linear model during commissioning of a motor drive. The calibration is characterized by two parameters, a gain and an offset, that describe how the sensed current appears as a voltage to the AMDC. | ||
|
|
||
| Current sensors are transducers which produce an output signal (either current or voltage) proportional to the primary current flowing through the sensor. There are different types of current sensors relying on different physical phenomenons such as shunt resistors and hall-effect. For the purpose of this document, the specific type of sensor does not matter---just that the output signal is linear with the primary current, and that it is measured as a voltage by the control system. The current sensor needs to be calibrated against an appropriate reference before it can be used in the control system. This reference is a known, trusted current sensor, such as a precision digital multimeter (preferred), hall-effect current clamp, or the setpoint of a DC power supply. While the manufacturer datasheet provides nominal parameters, calibration of the current sensor is necessary to get accurate measurements to account for any deviation due to process variation. | ||
|
|
||
| ## Calibration Method | ||
|
|
||
| A method is now provided to calibrate the current sensors in a motor drive. An example of the assumed system for a three phase motor is shown in the figure below. | ||
|
|
||
| <img src="./resources/current_sensor_drawing.svg" width="50%" align="center"/> | ||
|
|
||
| Typically, each phase has a current sensor associated with it that needs to be calibrated. This method assumes that the signal measured by the AMDC for each sensor is a voltage that must be converted into a current value. | ||
|
|
||
| 1. Connect the reference curent sensor (i.e. precision digital multimeter) to the phase U cable of the motor. | ||
| 1. Set up your AMDC system to enable you to log the raw reading of the drive's current sensor attached to phase U (presumably, by sampling an ADC channel). It is recommended to use the AMDC's logging functionality so that data can be collected over a period of time (e.g. 100 ms) and post-processed to find the average value. | ||
| 1. Record the drive's sensor reading when there is no current flowing through phase U. _Hint:_ remember to calculate this value as the average over a period of time. | ||
| 1. Cause a "small" curent to flow through phase U (i.e., apply a voltage across phase U). The value of current is left to the discretion of the user based on the system nominal ratings. | ||
| 1. Record the drive's sensor reading as well as the reference sensor's reading of the current flowing through the phase U cable. | ||
| 1. Progressively increase the phase U current and record the readings. Do this over the full range of rated current, both positive and negative. | ||
| 1. Tabulate the measurements as shown in this example [`exp_data.csv` file](./resources/exp_data.csv). | ||
| 1. Fit a linear expression of the form $\text{Reading [V]} = \text{Gain [V/A]} \times \text{Current [A]} + \text{Offset [V]}$ to the obtained measurements. This [example Jupyter notebook](./resources/current_sensor_calibration.ipynb) is provided to illustrate the process. | ||
| 1. Repeat the exercise for the remaining phases of the system. | ||
|
|
||
| An example of the results are shown in the plot below. The obtained gain and offset can be used directly in the control code to convert the sensor reading into the actual current measurement. | ||
|
|
||
|
|
||
| <img src="./resources/fit.svg" width="50%" align="center"/> | ||
|
|
||
| ```{tip} | ||
| Be sure to conduct the calibration process over the full range of current data (both positive and negative current) to account for any variation in the current sensor reading due to directionality of current. | ||
| ``` | ||
| ## Use of Calibration Data | ||
|
|
||
| The below codeblock can be utilized by the user to convert between raw measurements from the sensor and the actual currents. | ||
|
|
||
| ```C | ||
| #define INV_GAIN (1.0/0.621) // Inverse of gain obtained from curve fit (1/0.621) | ||
| double offset = 4.739; // [V], offset from curve fit. This is a variable so that the drive can remeasure and adjust the offset at startup | ||
|
|
||
| double current_measurement; // Actual current measurement, to be used in control algorithm | ||
|
|
||
| current_measurement = (sensor_reading - offset)*INV_GAIN; // sensor_reading is the raw measurement and needs to be obtained by the user | ||
|
|
||
| ``` | ||
|
|
||
| ## Recalculate Offset At Startup | ||
| The offset value of the current sensors can drift over time. It is recommended that drive developers include code in their control logic to automatically re-zero the current sensor at startup, as follows: | ||
|
|
||
| 1. Prior to enabling the PWM, when it is known that there is no current flowing in the motor, record approximately 100 ms of sensor data on each phase. | ||
| 2. For each phase, calculate the average of this data and use it as the new `offset` value in the code block above. | ||
| 3. Proceed with starting-up the drive. | ||
|
|
||
| ## Conclusion | ||
|
|
||
| The current sensor calibration method presented in this article should be viewed as a best-practice for motor drive development. Readers are welcome to directly use the provided code and Jupyter notebook in their motor drives. | ||
243 changes: 243 additions & 0 deletions
243
...rrent-sensor-cal/resources/.ipynb_checkpoints/current_sensor_calibration-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
243 changes: 243 additions & 0 deletions
243
...g-started/control-with-amdc/current-sensor-cal/resources/current_sensor_calibration.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.