An error regarding the g_scale for calculating g from accelerometer voltage was pointed and corrected by Steve Ferry (thank you Steve).
adc_resolution = 3.3 / 1024 # Vref = 3.3V, 10 bit ADC.
accelerometer_sensitivity = 1000/300 # 300 mv/g
g_scale = adc_resolution * accelerometer_sensitivity = (3.3 / 1024) * (1000/300)
The Python 3 program has been corrected with this new value.
I think the mistake was to assume that +-3g would cover the whole ADC range, but it will cover only around 2 V, not all the 3.3 V (Vref) range.
Looking through the ADXL335 datasheet, the output is ratiometric (proportional to supply voltage), and the 300 mV/g is the approximate value using a 3.0 V supply. This numbers can have around 10% variation between devices, so I think that an additional correction factor will have to be introduced and calculated (calibrated) for each different accelerometer used.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.