Estimate smartphone accelerometer bias
According to this IEEE article: https://github.com/liulinbo/slam/blob/master/A%20robust%20and%20easy%20to%20implement%20method%20for%20IMU%20calibration%20without%20external%20equipments.pdf

You can model errors this way:
$$ a = f*a' + g + b + \eta$$
where $a$ is the actual acceleration, $f$ is a 3x3 matrix to model scaling, misalignments, cross-axis and ... errors. $a'$ is sensor's data, $g$ is gravity, $b$ is 3x1 matrix to model bias, and $\eta$ is 3x1 matrix to model noise.

You can calibrate accelerometer by reading $a'$ from sensor data when the accelerometer is in static positions. In static positions, the only force effecting accelerometer is gravity. So by minimizing this summation, $f$ and $b$ can be computed(calibration):
$$ (|a_0|^2 - |g|^2)^2 + (|a_1|^2 - |g|^2)^2 + ... + (|a_N|^2 - |g|^2)^2 $$
where $N$ is number of static positions.