It's Here! Chris Odom's Physical Computing & Robotics with the Arduino IDE - Volume Two!

3 Axis Accelerometer Sensor Gyroscope 6DOF MPU-6050

$4.70

There are only 3 items left in stock.


Based on the popular MPU-6050 

Power supply :3-5v (internal low dropout regulator) 

Communication: I2C communication protocol standard 

Chip 16bit AD converter 16 outputs  

Gyro range: ± 250 500 1000 2000 ° / s 

Acceleration range: ± 2 ± 4 ± 8 ± 16g 

MPU-6000 is the world's first integrated 6-axis motion processing components, compared to the multi-component programs, eliminating the inter-axis gyroscope and accelerator when the combination of the problem of poor, reducing the amount of packaging space. MPU-6000 integrates a 3-axis gyroscope, three-axis accelerometer, and may contain other brands of the accelerator by a second I2C port connection, magnetic sensors, or digital motion processing other sensors (DMP: Digital Motion Processor) hardware acceleration engine, the main I2C ports to form a single data stream, to complete the application side of the output shaft 9 fusion algorithm technology

InvenSense's motion processing library that can handle complex data movement sensing, motion processing reduces the computing load the operating system, and provide a framework of API for application development.

MPU-6000 full-frame angular velocity sensing range of ± 250, ± 500, ± 1000 and ± 2000 ° / sec (dps), though this is very fast and accurate recovery slow movement, and the user can program the full control of the accelerator grid flu measuring range of ± 2g, ± 4g ± 8g and ± 16g. Product transport through the I2C or up to 400kHz up to 20MHz SPI.

MPU-6000 can operate at different voltages, VDD supply voltage referred to 2.5V ± 5%, 3.0V ± 5% or 3.3V ± 5%, the logical interface VVDIO power to 1.8V ± 5%. MPU-6000 package size 4x4x0.9mm (QFN), the size of the industry is revolutionary. Other features include a built-in temperature sensor is included in the operating environment, only ± 1% change in the oscillator.


Sample Code:


/* ============================================
  I2Cdev device library code is placed under the MIT license
  Copyright (c) 2011 Jeff Rowberg
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
  ===============================================
*/
/*
   Notes from Brian Patton 4/19/18
   connection to the Teensy
   MPU 6050     Teensy
   Vcc          3.3V
   GND          GND
   SCL          pin A5
   SDA          pin A4
   XDA          NC  (no connection)
   XCL          NC  (no connection)
   ADO          NC
   INT          pin 2
*/

#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"

MPU6050 accelgyro;
unsigned long time;
int16_t ax, ay, az;
int16_t gx, gy, gz;
float heading;
#define LED_PIN 13
bool blinkState = false;

void setup() {
  Wire.begin();   // join I2C bus (I2Cdev library doesn't do this automatically)
  Serial.begin(115200); // Set baud rate to 115200 (figure out ways to double it)
  while (!Serial);

  Serial.println("Initializing I2C devices...");
  delay(500);
  accelgyro.initialize();
  accelgyro.setI2CBypassEnabled(true);

  // verify connection
  Serial.println("Testing device connections...");
  Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
  delay(500);
  accelgyro.setFullScaleAccelRange(0);
  pinMode(LED_PIN, OUTPUT);   // configure Arduino LED
}


void loop() {
  time = millis();  //prints time since program started
  // read raw accel/gyro measurements from device
  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

  // these methods (and a few others) are also available
  // accelgyro.getAcceleration(&ax, &ay, &az);
  // accelgyro.getRotation(&gx, &gy, &gz);

  printData();
//  plotAccel();
//  plotGyro();
  blinkState = !blinkState; // blink LED to indicate activity
  digitalWrite(LED_PIN, blinkState);
  //  delay(100); // run at ~100 Hz
}

void printData() {
  // display tab-separated accel/gyro x/y/z values
  Serial.print("a/g/m/Time:\t");
  Serial.print(ax); Serial.print("\t");
  Serial.print(ay); Serial.print("\t");
  Serial.print(az); Serial.print("\t");
  Serial.print(gx); Serial.print("\t");
  Serial.print(gy); Serial.print("\t");
  Serial.print(gz); Serial.print("\t");

  Serial.println(time);
  delay(100); // run at ~100 Hz
}

void plotAccel() {
  Serial.print(ax); Serial.print(",");
  Serial.print(ay); Serial.print(",");
  Serial.println(az);
  delay(100); // run at ~100 Hz
}

void plotGyro() {
  Serial.print(gx); Serial.print(",");
  Serial.print(gy); Serial.print(",");
  Serial.println(gz);
  delay(200); //
}