I am working on installing 5 sensors around a workshop to measure the mass of different storage boxes.

I wish to use the same codebase to record and log all the data from each sensor setup.

One issue I am running into is how to account for different calibration factors for each sensor. My current solution is to have a separate settings file with all the calibration factors stored in it. When the main code is run, it looks up the serial number of the RPi currently running it, references what sensor IDs are connected to it in a database which is manually configured, and then reads the calibration factors from the setting file.

For example:

  1. Run main script
  2. Look up serial number of RPi running it and determines it is ‘ABC’
  3. Look at manually configured database and sees sensor X and Y is attached to RPi with serial number ‘ABC’
  4. Look up calibration factors for X and Y
  5. Use calibration factors to correctly scale sensors

For small scale deployments this would probably work fine. However, in a situation where you might install 100s of sensors, it doesn’t make sense to me that you would store the same database on every device. Alternatively you could have the database stored remotely but then you would need an internet connection simply to access these values.

Is there an industry standard way to address this problem?

  • 1
    If there were a way to store the calibration factor in the weighing device itself, you'd be able to calibrate the weighing scale and be done. You could even add a tare/zero button. If all you have is a raw sensor, yes, you'd have to have it in a database. You maybe able to cache the last x calibrations if you had to. Alternatively, if the calibrated value is not immediately needed, the raw sensor value (and ids) can be logged and the data can be postcalibrated before use as weight. May 10, 2022 at 13:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.