|
| 1 | + |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +# MPU_IMU Click |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +- **CIC Prefix** : MPUIMU |
| 10 | +- **Author** : Nenad Filipovic |
| 11 | +- **Verison** : 1.0.0 |
| 12 | +- **Date** : Aug 2018. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +### Software Support |
| 17 | + |
| 18 | +We provide a library for the MPU_IMU Click on our [LibStock](https://libstock.mikroe.com/projects/view/1002/mpu-imu-click-example) |
| 19 | +page, as well as a demo application (example), developed using MikroElektronika |
| 20 | +[compilers](http://shop.mikroe.com/compilers). The demo can run on all the main |
| 21 | +MikroElektronika [development boards](http://shop.mikroe.com/development-boards). |
| 22 | + |
| 23 | +**Library Description** |
| 24 | + |
| 25 | +The library covers all the necessary functions to control and read X, Y & Z axis accel, gyro coordinates and temperatuer data from MPU IMU Click . |
| 26 | + |
| 27 | +Key functions : |
| 28 | + |
| 29 | +- ``` void mpuimu_readAccel( int16_t *accelX, int16_t *accelY, int16_t *accelZ ) ``` - Function read Accel X-axis, Y-axis and Z-axis |
| 30 | +- ``` void mpuimu_readGyro( int16_t *gyroX, int16_t *gyroY, int16_t *gyroZ ) ``` - Function read Gyro X-axis, Y-axis and Z-axis axis |
| 31 | +- ``` float mpuimu_readTemperature() ``` - Function read temperature data |
| 32 | + |
| 33 | +**Examples Description** |
| 34 | + |
| 35 | +Description : |
| 36 | + |
| 37 | +The application is composed of three sections : |
| 38 | + |
| 39 | +- System Initialization - Initializes I2C, set INT pin as input. |
| 40 | +- Application Initialization - Initialization driver enable's - I2C, initialize MPU-6000 and start write log. |
| 41 | +- Application Task - (code snippet) This is a example which demonstrates the use of MPU IMU Click board. |
| 42 | + Measured accel and gyro coordinates (X,Y,Z) and temperature in degrees C are being sent to the uart where you can track their changes. |
| 43 | + All data logs on usb uart for every 1 sec. |
| 44 | + |
| 45 | + |
| 46 | +```.c |
| 47 | + |
| 48 | +void applicationTask() |
| 49 | +{ |
| 50 | + mpuimu_readAccel( &accelX, &accelY, &accelZ ); |
| 51 | + Delay_100ms(); |
| 52 | + mpuimu_readGyro( &gyroX, &gyroY, &gyroZ ); |
| 53 | + Delay_100ms(); |
| 54 | + temperature = mpuimu_readTemperature(); |
| 55 | + Delay_100ms(); |
| 56 | + |
| 57 | + mikrobus_logWrite( " Accel X :", _LOG_TEXT ); |
| 58 | + IntToStr( accelX, logText ); |
| 59 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 60 | + mikrobus_logWrite( " | ", _LOG_TEXT ); |
| 61 | + mikrobus_logWrite( " Gyro X :", _LOG_TEXT ); |
| 62 | + IntToStr( gyroX, logText ); |
| 63 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 64 | + mikrobus_logWrite( " *", _LOG_TEXT ); |
| 65 | + mikrobus_logWrite( "*****************", _LOG_LINE ); |
| 66 | + |
| 67 | + mikrobus_logWrite( " Accel Y :", _LOG_TEXT ); |
| 68 | + IntToStr( accelY, logText ); |
| 69 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 70 | + mikrobus_logWrite( " | ", _LOG_TEXT ); |
| 71 | + mikrobus_logWrite( " Gyro Y :", _LOG_TEXT ); |
| 72 | + IntToStr( gyroY, logText ); |
| 73 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 74 | + mikrobus_logWrite( " * ", _LOG_TEXT ); |
| 75 | + mikrobus_logWrite( "Temp.:", _LOG_TEXT ); |
| 76 | + IntToStr( temperature, logText ); |
| 77 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 78 | + mikrobus_logWrite( "° * ", _LOG_LINE ); |
| 79 | + |
| 80 | + mikrobus_logWrite( " Accel Z :", _LOG_TEXT ); |
| 81 | + IntToStr( accelZ, logText ); |
| 82 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 83 | + mikrobus_logWrite( " | ", _LOG_TEXT ); |
| 84 | + mikrobus_logWrite( " Gyro Z :", _LOG_TEXT ); |
| 85 | + IntToStr( gyroZ, logText ); |
| 86 | + mikrobus_logWrite( logText, _LOG_TEXT ); |
| 87 | + mikrobus_logWrite( " *", _LOG_TEXT ); |
| 88 | + mikrobus_logWrite( "*****************", _LOG_LINE ); |
| 89 | + |
| 90 | + mikrobus_logWrite("---------------------------------------------------------", _LOG_LINE); |
| 91 | + |
| 92 | + Delay_1sec(); |
| 93 | +} |
| 94 | + |
| 95 | +``` |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +The full application code, and ready to use projects can be found on our |
| 100 | +[LibStock](https://libstock.mikroe.com/projects/view/1002/mpu-imu-click-example) page. |
| 101 | + |
| 102 | +Other mikroE Libraries used in the example: |
| 103 | + |
| 104 | +- UART |
| 105 | +- Conversions |
| 106 | + |
| 107 | +**Additional notes and informations** |
| 108 | + |
| 109 | +Depending on the development board you are using, you may need |
| 110 | +[USB UART click](http://shop.mikroe.com/usb-uart-click), |
| 111 | +[USB UART 2 Click](http://shop.mikroe.com/usb-uart-2-click) or |
| 112 | +[RS232 Click](http://shop.mikroe.com/rs232-click) to connect to your PC, for |
| 113 | +development systems with no UART to USB interface available on the board. The |
| 114 | +terminal available in all Mikroelektronika |
| 115 | +[compilers](http://shop.mikroe.com/compilers), or any other terminal application |
| 116 | +of your choice, can be used to read the message. |
| 117 | + |
| 118 | +--- |
| 119 | +--- |
0 commit comments