This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using nrf51822 board with adxl335 accelerometer (ADC)

Hi,

I'm trying to use adxl335 accelerometer to detect motion.

I'm having trouble understanding what the output of the accelerometer means. Obviously, it should tell me something about the acceleration but it's in unit mV/g. How do I interpret this output and convert it into data related to acceleration or motion?

Also, I've found a lot of codes on adxl335 with Arduino, but there seems to be less resources on adxl335 with nrf51822 kit. I'm trying to use the GPIOs and program it to do the ADC conversion. Could anyone help me on this?

Thank you a lot.

Parents
  • According to the datasheet, www.analog.com/.../ADXL335.pdf, the output is analog, hence the mV/g.

    0 g will output (typically) 1.5V on the z, x and y outputs, and the typical change in voltage is 300mV per g. So lying still on a table you could expect the x and y outputs to be 1.5V and the z axis to be 1.2V (1.5V - 300mV) because of the 1 g (=9.81 m/s^2) downward gravitational force from earth.

    To sample this information in the nrf51 you would need to use the ADC, since the output is analog. See the reference manual section 31. Connect the three outputs to three of the analog input pins on the nRF51. Since the nRF51 only has one ADC you would need to multiplex between the 3 inputs. Change the input pin by changing the PSEL register, and read of the value, then the next pin and so on.

    Now you would need to do some math (and calibration) to convert the sampled value to a g value, knowing that a 300 mV offset equals a 1 g acceleration (or a 9.81 m/s^2 acceleration).

Reply
  • According to the datasheet, www.analog.com/.../ADXL335.pdf, the output is analog, hence the mV/g.

    0 g will output (typically) 1.5V on the z, x and y outputs, and the typical change in voltage is 300mV per g. So lying still on a table you could expect the x and y outputs to be 1.5V and the z axis to be 1.2V (1.5V - 300mV) because of the 1 g (=9.81 m/s^2) downward gravitational force from earth.

    To sample this information in the nrf51 you would need to use the ADC, since the output is analog. See the reference manual section 31. Connect the three outputs to three of the analog input pins on the nRF51. Since the nRF51 only has one ADC you would need to multiplex between the 3 inputs. Change the input pin by changing the PSEL register, and read of the value, then the next pin and so on.

    Now you would need to do some math (and calibration) to convert the sampled value to a g value, knowing that a 300 mV offset equals a 1 g acceleration (or a 9.81 m/s^2 acceleration).

Children
No Data
Related