ADXL335 + MCP3208 output G's question
Dwayne Dibbley
Posts: 63
I am using Mike Rector's MCP3208_DEMO. I have the sparkfun ADXL335 connected to 3 inputs on the MCP. This works fine in returning a number from 0 - 4096, how do i convert this to mV and G's. in the adxl doc i mentions this if running on 3.3v:
USE WITH OPERATING VOLTAGES OTHER THAN 3 V
The ADXL335 is tested and specified at VS = 3 V; however, it can be powered with VS as low as 1.8 V or as high as 3.6 V. Note that some performance parameters change as the supply voltage is varied.
The ADXL335 output is ratiometric, therefore, the output sensitivity (or scale factor) varies proportionally to the supply voltage. At VS = 3.6 V, the output sensitivity is typi- cally 360 mV/g. At VS = 2 V, the output sensitivity is typically 195 mV/g.
The zero g bias output is also ratiometric, thus the zero g output is nominally equal to VS/2 at all supply voltages.
am i correct the the ratiometric value when running at 3.3v would be 330 mV/g ? and therfore the g formula should be something like :
x,y or z reading [ 0-4096 ] - ( 4096 / 2 ) * 1000 / 330 [ ratiometric value calculated ? ] of do i need to convert eh MCP value to mV first?
Thanks
USE WITH OPERATING VOLTAGES OTHER THAN 3 V
The ADXL335 is tested and specified at VS = 3 V; however, it can be powered with VS as low as 1.8 V or as high as 3.6 V. Note that some performance parameters change as the supply voltage is varied.
The ADXL335 output is ratiometric, therefore, the output sensitivity (or scale factor) varies proportionally to the supply voltage. At VS = 3.6 V, the output sensitivity is typi- cally 360 mV/g. At VS = 2 V, the output sensitivity is typically 195 mV/g.
The zero g bias output is also ratiometric, thus the zero g output is nominally equal to VS/2 at all supply voltages.
am i correct the the ratiometric value when running at 3.3v would be 330 mV/g ? and therfore the g formula should be something like :
x,y or z reading [ 0-4096 ] - ( 4096 / 2 ) * 1000 / 330 [ ratiometric value calculated ? ] of do i need to convert eh MCP value to mV first?
Thanks
Comments
however nothing is displayed on the serial terminal
John Abshier
also is the 4096 the correct divider or should it be 4095? adc value when feeding 3.3v is 4095? i only assumed 0-4095 is 4096 places
Thanks
I think you are right about the 4,096 value. There are 4096 places. (I'm not sure about this.)
I didn't have time to hook up and ADC chip so I simulated it with input from PST.
John Abshier
If its ratiometric then you don't need to know the supply voltage, the same ADC output value will appear - that's what ratiometric means. Here the sensitivity is Vcc/10 per g. With a 12 bit ADC that means 409.6 counts = 1g, and the zero is at 2048. So you calculate (adc_value - 2048) * 10 / 4096
Thanks Duane, true they are not floats so not really worth converting
Thanks works fine resulting in 3.299
i just found jwoods 5dof obex (no point in reinventing the wheel) and although not using the gyro have hooked up the adxl335 x,y,z and when returning the axis i get 0ish on z, 0ish on y and 415ish on z, so pretty close to the 409.6 Mark_T formula uses.
i think i need to average the readings now to get a smoother result.
Thanks for the help so far