Jump to content

Search the Community

Showing results for tags 'mpu6050'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 7 results

  1. Hi, I am having trouble interfacing the MSP432 with MPU6050. I have pulled the SDA and SCL lines up to 3.3V with 10k resistors. When I initiate the communication using the I2C_masterSendMultipleByteStart(), the program enters an infinite loop waiting for the TXIFG to be set after the STT is sent. I can see that the STT remains set and TXIFG never gets set. What could be the issue? Please let me know if you want me to post the code. Thank you.
  2. dookeywater

    Interfacing MSP430G2553 with MPU6050

    Does anybody have working code that interfaces the msp and mpu6050. I'm trying to use it as a pedometer. Thanks in advance.
  3. pokmo

    Working with MPU6050 on MSP430

    Hi I'm just getting started in working with MSP430 with MPU6050. Is Jeff Rowberg's library the go-to library for interfacing with the MPU6050? Ideally, I'd like to use DMP, but that the i2cdevlib library doesn't seem to have that feature. Does anyone know a good way to work with the MPU6050 (preferably DMP) on MSP430? Any thought appreciated. Thanks
  4. thuanbk55

    Interface MSP430 and MPU6050

    MPU6050 are accelerometer and gyroscope sensor , cheap and very useful.But there aren't a lot of library codes available for MSP430.Here is the library,include initialing and reading MPU6050.I had convert this library from AVR's library. Use for : MSP430x2xx ,other MSP430 must redefine some register of I2C Module or rewrite "I2C_USCI.h" function Link Download: Code MSP430 and MPU6050 I2C_USCI Library use for MPU6050 Library: //////////////////////////////////////////////////////////////////// // LIBRARY CONTROL I2C USCI MODULE // Write by : PHAM VAN THUAN DTVT07-K55 // Email: terran991992@gmail.com // Blog : http://thuanbk55.blogspot.com/ // ................................................................. // USE FOR MSP430 //******************************************************************/ #ifndef I2C_USCI_H #define I2C_USCI_H // Address #define MPU6050_ADDRESS 0x68 #define BQ32000_ADDRESS 0x68 #define DS1307_ADDRESS 0x68 #define LM92_ADDRESS 0x48 /******************************************************************************\ * Prototype * \******************************************************************************/ void I2C_USCI_Init(unsigned char addr); //Init I2C void I2C_USCI_Set_Address(unsigned char addr); //Change Slave's Address unsigned char I2C_USCI_Read_Byte(unsigned char address); //Read 1 byte //Read many Byte unsigned char I2C_USCI_Read_Word(unsigned char Addr_Data,unsigned char *Data, unsigned char Length); //Write 1 Byte unsigned char I2C_USCI_Write_Byte(unsigned char address, unsigned char Data); /******************************************************************************\ * Function * \******************************************************************************/ void I2C_USCI_Init(unsigned char addr) { P1SEL |= BIT6 + BIT7; // Assign I2C pins to USCI_B0 P1SEL2|= BIT6 + BIT7; // Assign I2C pins to USCI_B0 UCB0CTL1 |= UCSWRST; // Enable SW reset UCB0CTL0 = UCMST+UCMODE_3+UCSYNC; // I2C Master, synchronous mode UCB0CTL1 = UCSSEL_2+UCSWRST; // Use SMCLK, keep SW reset UCB0BR0 = 40; // fSCL = SMCLK/40 = ~400kHz UCB0BR1 = 0; UCB0I2CSA = addr; // Set slave address UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation } void I2C_USCI_Set_Address(unsigned char addr) { UCB0CTL1 |= UCSWRST; UCB0I2CSA = addr; // Set slave address UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation } unsigned char I2C_USCI_Read_Byte(unsigned char address) { while (UCB0CTL1 & UCTXSTP); UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX,START while (!(IFG2&UCB0TXIFG)); UCB0TXBUF = address; while (!(IFG2&UCB0TXIFG)); UCB0CTL1 &= ~UCTR; // I2C RX UCB0CTL1 |= UCTXSTT; // I2C RESTART IFG2 &= ~UCB0TXIFG; while (UCB0CTL1 & UCTXSTT); UCB0CTL1 |= UCTXSTP; return UCB0RXBUF; } unsigned char I2C_USCI_Read_Word(unsigned char Addr_Data,unsigned char *Data, unsigned char Length) { unsigned char i=0; while (UCB0CTL1 & UCTXSTP); // Loop until I2C STT is sent UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition while (!(IFG2&UCB0TXIFG)); IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag if(UCB0STAT & UCNACKIFG) return UCB0STAT; UCB0TXBUF = Addr_Data; while (!(IFG2&UCB0TXIFG)); if(UCB0STAT & UCNACKIFG) return UCB0STAT; UCB0CTL1 &= ~UCTR; // I2C RX UCB0CTL1 |= UCTXSTT; // I2C start condition IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag while (UCB0CTL1 & UCTXSTT); // Loop until I2C STT is sent for(i=0;i<(Length-1);i++) { while (!(IFG2&UCB0RXIFG)); IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag Data[i] = UCB0RXBUF; } while (!(IFG2&UCB0RXIFG)); IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag UCB0CTL1 |= UCTXSTP; // I2C stop condition after 1st TX Data[Length-1] = UCB0RXBUF; IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag return 0; } unsigned char I2C_USCI_Write_Byte(unsigned char address, unsigned char data) { while (UCB0CTL1 & UCTXSTP); UCB0CTL1 |= UCTR + UCTXSTT; while (!(IFG2&UCB0TXIFG)); if(UCB0STAT & UCNACKIFG) return UCB0STAT; UCB0TXBUF = address; while (!(IFG2&UCB0TXIFG)); if(UCB0STAT & UCNACKIFG) return UCB0STAT; UCB0TXBUF = data; while (!(IFG2&UCB0TXIFG)); if(UCB0STAT & UCNACKIFG) return UCB0STAT; UCB0CTL1 |= UCTXSTP; IFG2 &= ~UCB0TXIFG; return 0; } #endif /* I2C_USCI */ MSP430 vs MPU6050.rar
  5. Hello, i need help with running GY521 gyro on my Stellaris Launchpad with Energia. I found something about wiring GND -> GND 3,3V -> VCC Analog4 -> SDA Analog5 -> SCL and also read this topic at arduino http://playground.arduino.cc/Main/MPU-6050 there is a sketch but i dont know how to port it at Energia for stellaris launchpad. So i want to ask if there is anybody, who was playing with gyro and can help me understand the way it works. Thanks
  6. superbrew

    MPU6050

    I have been getting familiar with the Tiva Launchpad and I have started working with the MPU6050. After some help from this forum, I was able to get it up and running and thought I would share some of my results. I have a goal of building a self balancing robot, but I am trying to take tiny steps to get there. Here is a short video of my progress. I am still a long way off, but I am happy to be progressing. PS, is there a way to embed youtube videos?
  7. Willpower

    MPU6050 Complementary

    Hello everybody, I'm now working on Gy-521 MPU6050 and Stellaris Launchpad. I use the ported Jeff Rowberg's library from here (https://code.google.com/p/launchpad-stellaris-energia/wiki/Mpu6050Usage) and it work great to get the raw values from sensors. But when I apply complementary to compute the angles, it does not work whether I add the acc-angles calculation, it builds successfully but the serial monitor stop at "Initializing I2C devices...". I've attached my code below, anyone could help me out, thanks. //Sorry for my bad english. #include "Wire.h" #include "I2Cdev.h" #include "MPU6050.h" #include "math.h" MPU6050 accelgyro; int16_t ax, ay, az; int16_t gx, gy, gz; bool blinkState = false; float acc_x, acc_y, acc_z; float gyro_x, gyro_y, gyro_z; float base_ax, base_ay, base_az, base_gx, base_gy, base_gz; float acc_angle_x, acc_angle_y, acc_angle_z; float gyro_angle_x, gyro_angle_y, gyro_angle_z; unsigned long last_read_time; float last_x, last_y, last_z; float dt, t_now; void calib() { int samples = 10; float acc_x_calib = 0; float acc_y_calib = 0; float acc_z_calib = 0; float gyro_x_calib = 0; float gyro_y_calib = 0; float gyro_z_calib = 0; int16_t Ax, Ay, Az, Gx, Gy, Gz; for(int i=0; i<samples;i++) { accelgyro.getMotion6(&Ax, &Ay, &Az, &Gx, &Gy, &Gz); acc_x_calib += float(Ax); acc_y_calib += float(Ay); acc_z_calib += float(Az); gyro_x_calib += float(Gx); gyro_y_calib += float(Gy); gyro_z_calib += float(Gz); delay(50); } base_ax = acc_x_calib/samples; base_ay = acc_y_calib/samples; base_az = acc_z_calib/samples; base_gx = gyro_x_calib/samples; base_gy = gyro_y_calib/samples; base_gz = gyro_z_calib/samples; } void set_last_read(unsigned long time, float x, float y, float z) { last_read_time = time; last_x = x; last_y = y; last_z = z; } inline unsigned long get_last_time() { return last_read_time;} inline float get_last_x() { return last_x; } inline float get_last_y() { return last_y; } inline float get_last_z() { return last_z; } void setup() { // join I2C bus (I2Cdev library doesn't do this automatically) Wire.begin(); // initialize serial communication // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but // it's really up to you depending on your project) Serial.begin(9600); // initialize device Serial.println("Initializing I2C devices..."); accelgyro.initialize(); // verify connection Serial.println("Testing device connections..."); Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); // configure Arduino LED for pinMode(GREEN_LED, OUTPUT); calib(); set_last_read(millis(), 0, 0, 0); } void loop() { // read raw accel/gyro measurements from device accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); unsigned long t_now = millis(); // these methods (and a few others) are also available //accelgyro.getAcceleration(&ax, &ay, &az); //accelgyro.getRotation(&gx, &gy, &gz); float acc_x = float(ax)/16384; float acc_y = float(ay)/16384; float acc_z = float(az)/16384; float gyro_x = (float(gx) - base_gx)/131; float gyro_y = (float(gy) - base_gy)/131; float gyro_z = (float(gz) - base_gz)/131; /* - not work float R2D = 180/M_PI; float acc_angle_y = atan2(acc_x, sqrt(acc_y*acc_y + acc_z*acc_z))*R2D; float acc_angle_x = atan2(acc_y, sqrt(acc_x*acc_x + acc_z*acc_z))*R2D; float acc_angle_Z = atan2(sqrt(acc_x*acc_x + acc_y*acc_y), acc_z); */ //filter gyro float dt = (t_now - get_last_time())/1000.0; float gyro_angle_x = gyro_x*dt + get_last_x(); float gyro_angle_y = gyro_y*dt + get_last_y(); float gyro_angle_z = gyro_z*dt + get_last_z(); //Complementary float alpha = 0.96; float angle_x = alpha*gyro_angle_x + (1 - alpha)*acc_angle_x; float angle_y = alpha*gyro_angle_y + (1 - alpha)*acc_angle_y; float angle_z = gyro_angle_z; set_last_read(t_now, angle_x, angle_y, angle_z); //Serial.print Serial.print(acc_x, 2); Serial.print("\t"); Serial.print(acc_y, 2); Serial.print("\t"); Serial.print(acc_z, 2); Serial.print("\t"); Serial.print(gyro_x, 2); Serial.print("\t"); Serial.print(gyro_y, 2); Serial.print("\t"); Serial.print(gyro_z, 2); Serial.println("\t"); Serial.print(dt, 4); Serial.print("\t"); Serial.print(angle_x, 3); Serial.print(","); Serial.print(angle_y, 3); Serial.print(","); Serial.print(angle_z, 3); Serial.println(); // blink LED to indicate activity blinkState = !blinkState; digitalWrite(GREEN_LED, blinkState); delay(20); }
×