Accel 12 Click Board
Accel 12 Click Board
The Accel 12 Click Board™ is an advanced 3-axis motion tracking Click Board™, which utilises the MC3216, a low-noise, and low power 3-axis accelerometer. This Click Board™ allows linear motion and gravitational force measurements in ranges of ±2 g, ±4 g, ±8, and ±16 g in three perpendicular axes and support directional tap detection in ±X, ±Y or ±Z. The output of each axis is digitised by 14-bit ADC and offered directly, over the standard I2C Interface. The built-in Event Detection feature allows the user to set an interrupt when a specific event is detected.
Software Support
We provide a library for the Accel 12 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register. The library includes function for read X/Y/Z axis data and function for Tap detection interrupt. The user also has the function for configuration register and function for read interrupt state.
Key Functions
void accel12_getAxisData(int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
- Accel axis data.uint8_t accel12_getTapDetection()
- Tap detection.void accel12_configuration(uint8_t reg, uint8_t dataIn)
- Functions for configuration register.
Example Description
The application is composed of three sections :
- System Initialization - Initializes I2C module and sets INT pin as INPUT.
- Application Initialization - Initialization driver init and configuration Accel measuremen and Tap detection interrupt.
- Application Task - Reads the acceleration data in 3 axis and detects the tap on the axes. All data logs on the USB/UART every 1.5sec.
void applicationTask() { /* Accelerometer measurement */ accel12_getAxisData(&X_Axis, &Y_Axis, &Z_Axis); IntToStr(X_axis, demoText); mikrobus_logWrite(" X axis : ", _LOG_TEXT); mikrobus_logWrite(demoText, _LOG_LINE); IntToStr(Y_axis, demoText); mikrobus_logWrite(" Y axis : ", _LOG_TEXT); mikrobus_logWrite(demoText, _LOG_LINE); IntToStr(Z_axis, demoText); mikrobus_logWrite(" Z axis : ", _LOG_TEXT); mikrobus_logWrite(demoText, _LOG_LINE); /* TAP interrupt */ tap = accel12_getTapDetection(); switch(tap) { case 1: { mikrobus_logWrite(" X Positive ", _LOG_LINE); break; } case 2: { mikrobus_logWrite(" Y Positive ", _LOG_LINE); break; } case 3: { mikrobus_logWrite(" Z Positive ", _LOG_LINE); break; } case 4: { mikrobus_logWrite(" X Negative ", _LOG_LINE); break; } case 5: { mikrobus_logWrite(" Y Negative ", _LOG_LINE); break; } case 6: { mikrobus_logWrite(" Z Negative ", _LOG_LINE); break; } } mikrobus_logWrite("---------------------", _LOG_LINE); Delay_ms( 1500 ); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
Additional notes and informations
Depending on the development board you are using, you may need a USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The Accel 12 Click Board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
Accel 12 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.