# Calibrate
Source: [https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html](https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html)
Sensors that are sensitive to changes in the operating environment produce inappropriate
output values due to factors, such as temperature variations, mechanical wear, or shift
in the operating range. Sensor calibration is the process to adjust or fine-tune the
sensor hardware to ensure accuracy and minimize the errors. Calibration involves
comparing the expected output based on the theoretical models or standards with the
actual measured output from the sensor. By precise adjustments, the sensor calibration
enhances performance, accuracy, and reliability, which ensures that the sensor provides
reliable data.
On successful calibration and
associated registry update (as described in the following sections), the value of
ver registry item increments. For example, if the bias offset in
registry item has ver value of 0, then on a
successful calibration and registry update, the registry item is updated with the new
bias offset and the ver value increments to
1.
Note: The
<registry\_path> referred in the following sections should be
considered as one of the existing paths on the device:
/etc/sensors/registry/registry/ or
/var/cache/sensors/registry/registry/.
## Factory sensor calibration
Source: [https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html](https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html)
The factory sensor calibration is a process to adjust or fine-tune the sensors during the
manufacturing phase.
### Accelerometer
The following table lists the accelerometer calibration procedure:
Table : Accelerometer calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| ssc_drva_test -sensor=accel -factory_test=2 -duration=10Copy to clipboard
Note: A test result (PASS or FAIL) indicates only the test execution status whether the test is completed or not. | Run the command, while keeping the device stationary on a flat surface. | The following is the example of the QCS6490 device (ICM42688 sensor):
The `/qcs6490_rbx_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.bias` file is created/updated automatically, and stores the bias offset after the calibration. |
### Magnetometer
The following table lists the magnetometer calibration procedure:
Table : Magnetometer calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| NA |
Get/calculate corr_matrix and bias scale values (if applicable) for your device with the help of the sensor vendor.
Set the values into the corr_matrix section in the platform-specific magnetometer JSON file of the sensor.
| The following is an example of the QCS6490 device (AK09915 sensor):
The
`/qcs6490_rbx_navmez_ak991x_0.json.ak0991x_0_platform.mag.fac_cal.corr_mat` file is created/updated automatically, and stores the bias offset after the calibration. |
### Proximity
The following table lists the proximity calibration procedure:
Table : Proximity calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| ssc_drva_test -sensor=prox -factory_test=2 -duration=10Copy to clipboard |
Keep an obstacle/object at a required distance (for example, 5 cm or as mentioned in the specification) from the proximity sensor and run the command.
Verify that the test returns a PASS result.
This procedure uses 5 cm as the threshold and the distance within the threshold is considered as near and the distance more than the threshold is considered as far.
| The following is an example of the TMD3702 sensor:
The
`/tmd3702_platform.prox.fac_cal` file is created/updated automatically, and stores the bias offset after the calibration. |
### Ambient light
The following table lists the ambient light calibration procedure:
Table : Ambient light calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| ssc_drva_test -sensor=als -factory_test=2 -duration=10Copy to clipboard | Confirm the test procedure specified by the sensor vendor and run the command. | The following is an example of the TMD3702 sensor:
The
`/tmd3702_platform.als.fac_cal` file is created/updated automatically, and stores the bias offset after the calibration. |
## Runtime sensor calibration
Source: [https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html](https://docs.qualcomm.com/doc/80-70015-7/topic/calibrate.html)
Runtime sensor calibration is a process to adjust or fine-tune the sensors during their
operational phase, rather than during the manufacturing phase. It occurs dynamically
while the sensor actively collects the data in the real-world scenarios.
### **Gyroscope**
The gyroscope calibration sensor `gyro_cal` is used for gyroscope
runtime calibration. The following table lists the gyroscope calibration
procedure:
Table : Gyroscope calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| Use `see_workhorse` to enable a gyroscope calibration sensor (`gyro_cal`).
see_workhorse -sensor=gyro_cal -on_change=1 -duration=120 -display_events=1Copy to clipboard |
While keeping the device stationary, request the gyroscope calibration sensor gyro_cal data for more than 120 sec and then stop.
After the command is executed, check the status field in the received event for the calibration accuracy status.
Note: The gyroscope sensor always produces noncalibrated values. Hence, for the client/algorithm that needs the calibrated gyroscope values run the `gyro_cal` sensor to generate and provide calibration offset/bias. The bias received from the `gyro_cal` sensor can then be subtracted as shown in the following pseudocode:
calibrated_gyro_x_val = (gyro_data.x_val - gyro_cal.x_bias);Copy to clipboard
calibrated_gyro_y_val = (gyro_data.y_val - gyro_cal.y_bias);Copy to clipboard
calibrated_gyro_z_val = (gyro_data.z_val - gyro_cal.z_bias);Copy to clipboard | The
`/sns_gyro_cal_persist_sX.bias` file (where, X = sensor index) is created/updated automatically, and stores the bias offset after the calibration:
Note: Gyroscope calibration runs approximately for every 60 sec. The gyroscope bias is stored into the registry only after the existing streaming clients for the gyroscope are disabled. |
### Magnetometer
The magnetometer calibration sensor `mag_cal` is used for the
magnetometer runtime calibration. The following table lists the magnetometer
calibration procedure:
Table : Magnetometer calibration
| Command | Procedure | Bias values |
| --- | --- | --- |
| Use `see_workhorse` to enable the magnetometer calibration sensor `mag_cal`.
see_workhorse -sensor=mag_cal -on_change=1 -duration=500 -display_events=1Copy to clipboard |
Bring the device to an open area where there is no magnetic field interference.
Stream the magnetometer data and move the device in motion 8 for more than 60 sec. Moving the device in motion 8 is mandatory.
After the command is executed, check the status field in the received event for the calibration accuracy status.
| The
`/sns_mag_cal_persist_sXmY.bias` file (where, X = sensor index and Y = device mode index) is created/updated automatically, and stores the bias offset after the calibration. |
Last Published: Oct 14, 2024
[Previous Topic
Tools](https://docs.qualcomm.com/bundle/publicresource/80-70015-7/topics/test_tools.md) [Next Topic
Verify](https://docs.qualcomm.com/bundle/publicresource/80-70015-7/topics/verify.md)