edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Neuhaus Barsuhn
Published © CC BY

Using Math AI for Step-by-Step STEM Calculations

A practical workflow for explaining equations behind sensor data, calibration, and engineering prototypes.

BeginnerProtip1 hour3
Using Math AI for Step-by-Step STEM Calculations

Things used in this project

Software apps and online services

Google Sheets
Google Sheets
Optional spreadsheet used to independently cross-check the linear calibration formula and substitution result.

Story

Read more

Schematics

Sensor calibration workflow diagram

A three-stage diagram showing how calibration points become a step-by-step model and a substitution check.

Code

Linear sensor calibration cross-check

Python
A small Python script that reproduces the sample slope, intercept, estimated measurement, and substitution check.
"""Cross-check the linear sensor calibration example used in the Hackster project."""

VOLTAGE_AT_LOW_POINT = 0.42
LOW_POINT = 10.0
VOLTAGE_AT_HIGH_POINT = 2.18
HIGH_POINT = 50.0
TARGET_VOLTAGE = 1.36

slope = (VOLTAGE_AT_HIGH_POINT - VOLTAGE_AT_LOW_POINT) / (HIGH_POINT - LOW_POINT)
intercept = VOLTAGE_AT_LOW_POINT - slope * LOW_POINT
estimated_measurement = (TARGET_VOLTAGE - intercept) / slope
reconstructed_voltage = slope * estimated_measurement + intercept

print(f"slope: {slope:.6f} V/unit")
print(f"intercept: {intercept:.6f} V")
print(f"estimated measurement: {estimated_measurement:.4f} units")
print(f"substitution check: {reconstructed_voltage:.4f} V")

Credits

Neuhaus Barsuhn
5 projects • 0 followers

Comments