Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'i2cdev'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • I2Cdevlib Web Tools
    • I2C Protocol Analyzer
    • I2C Device Entry Interface
    • I2C Device Library API
  • I2Cdev Platform Discussion
    • Arduino (ATmega)
    • Arduino Due (ARM Cortex M3)
    • MSP430
    • Other Platforms
  • I2C Device Discussion
    • AD7746 capacitance-to-digital converter (Analog Devices)
    • ADS1115 16-bit A/D converter (Texas Instruments)
    • ADXL345 3-axis accelerometer (Analog Devices)
    • AK8975 3-axis magnetometer (AKM Semiconductor)
    • BMA150 3-axis accelerometer (Bosch Sensortec)
    • BMP085 pressure sensor (Bosch Sensortec)
    • DS1307 real-time clock (Maxim)
    • HMC5843 3-axis magnetometer (Honeywell)
    • HMC5883L 3-axis magnetometer (Honeywell)
    • iAQ-2000 indoor air quality sensor (AppliedSensor)
    • IQS156 ProxSense capacitive touch sensor (Azoteq)
    • ITG-3200 3-axis gyroscope (InvenSense)
    • L3G4200D 3-axis accelerometer (STMicroelectronics)
    • MPL3115A2 Xtrinsic Smart Pressure Sensor (Freescale)
    • MPR121 12-bit capacitive touch sensor (Freescale)
    • MPU-6050 6-axis accelerometer/gyroscope (InvenSense)
    • MPU-9150 9-axis accelerometer/gyroscope/magnetometer (InvenSense)
    • PanelPilot multi-screen digital meter (Lascar Electronics)
    • SSD1308 128x64 OLED/PLED driver (Solomon Systech)
    • TCA6424A 24-bit I/O expander (Texas Instruments)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 5 results

  1. Hello so im trying to use the code for the AD7746 chip, however it includes a file called I2Cdev.h that i don't know where to find it? could anyone help me find the file
  2. Hello I am combinig MPU6050 with Encoder for cycle simulation. But as I move the encoder very fastly it stopped automatically giving readings. I am little bit confused whats is the exact problem? My Code #define BAUDRATE 38400 //Encoder //#define pinA A1 #define ARDUINOPIN A2 #define STATE_UNINIT 0 #define STATE_INIT 1 byte systemState; volatile long count; int pinA = 2; int pinB = 3; int limitSW_1 = 4; boolean sigA = 0; boolean sigB = 0; boolean status_L1 = 0; //Ends Encoder //Start MPU #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" #include "PinChangeInt.h" #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE #include "Wire.h" #endif #define OUTPUT_READABLE_QUATERNION //#define OUTPUT_READABLE_YAWPITCHROLL //Ends MPU MPU6050 mpu; // MPU control/status vars bool dmpReady = false; uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU uint8_t devStatus; // return status after each device operation (0 = success, !0 = error) uint16_t packetSize; // expected DMP packet size (default is 42 bytes) uint16_t fifoCount; // count of all bytes currently in FIFO uint8_t fifoBuffer[64]; // FIFO storage buffer // orientation/motion vars Quaternion q; // [w, x, y, z] quaternion container VectorInt16 aa; // [x, y, z] accel sensor measurements VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements VectorFloat gravity; // [x, y, z] gravity vector float euler[3]; // [psi, theta, phi] Euler angle container float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector // packet structure for InvenSense teapot demo uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' }; // ================================================================ // === INTERRUPT DETECTION ROUTINE === // ================================================================ volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high void dmpDataReady() { mpuInterrupt = true; } // ================================================================ // === INITIAL SETUP === // ================================================================ void setup() { // join I2C bus (I2Cdev library doesn't do this automatically) #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE Wire.begin(); TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz) #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif Serial.begin(BAUDRATE); //while (!Serial); // mpu.initialize(); devStatus = mpu.dmpInitialize(); mpu.setXGyroOffset(52); mpu.setYGyroOffset(18); mpu.setZGyroOffset(-24); mpu.setZAccelOffset(1030); // 1688 factory default for my test chip if (devStatus == 0) { mpu.setDMPEnabled(true); pinMode(ARDUINOPIN, INPUT_PULLUP); // attachInterrupt(ARDUINOPIN, dmpDataReady, RISING); attachPinChangeInterrupt(ARDUINOPIN, dmpDataReady, RISING); mpuIntStatus = mpu.getIntStatus(); dmpReady = true; packetSize = mpu.dmpGetFIFOPacketSize(); } else { } systemState = STATE_UNINIT; // pinMode(pinA, INPUT_PULLUP); // attachPinChangeInterrupt(pinA, interruptA, CHANGE); // pinMode(pinB, INPUT_PULLUP); // attachPinChangeInterrupt(pinB, interruptB, CHANGE); attachInterrupt(0, interruptA, CHANGE); attachInterrupt(1, interruptB, CHANGE); } // ================================================================ // === MAIN PROGRAM LOOP === // ================================================================ void loop() { if (!dmpReady) return; while (!mpuInterrupt && fifoCount < packetSize) {} mpuInterrupt = false; mpuIntStatus = mpu.getIntStatus(); fifoCount = mpu.getFIFOCount(); if ((mpuIntStatus & 0x10) || fifoCount == 1024) { mpu.resetFIFO(); } else if (mpuIntStatus & 0x02) { while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount(); mpu.getFIFOBytes(fifoBuffer, packetSize); fifoCount -= packetSize; //YPR #ifdef OUTPUT_READABLE_YAWPITCHROLL // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); // Serial.print("ypr\t"); //Serial.print(ypr[0] * 180/M_PI); // Serial.print(","); // Serial.print(ypr[1] * 180/M_PI); // Serial.print(","); // Serial.println(ypr[2] * 180/M_PI); #endif //Quaternion #ifdef OUTPUT_READABLE_QUATERNION // display quaternion values in easy matrix form: w x y z mpu.dmpGetQuaternion(&q, fifoBuffer); // Serial.print("quat\t"); Serial.print(q.w); Serial.print(","); Serial.print(q.x); Serial.print(","); Serial.print(q.y); Serial.print(","); Serial.print(q.z); Serial.print(","); #endif Serial.print(count); Serial.print(','); Serial.print(status_L1); Serial.println(); // Stream.flush(); } status_L1 = digitalRead(limitSW_1); if (status_L1 == 1 && false) { count = 0; systemState = STATE_INIT; } // delay(50); } //interupt for PinA void interruptA() { sigA = digitalRead(pinA); switch(sigA) { case 0: if(sigB == 1) count++; else count--; break; case 1: if(sigB == 0) count++; else count--; break; } } //interupt for PinA void interruptB() { sigB = digitalRead(pinB); switch(sigB) { case 0: if(sigA == 0) count++; else count--; break; case 1: if(sigA == 1) count++; else count--; break; } }
  3. Hello I am using MPU6050 + Encoder + Switch. While running the sketch its show output in Serial monitor for some time then suddenly its stop.Please give me some suggestion asap. Code: #define BAUDRATE 9600 //Encoder #define pinA A1 #define STATE_UNINIT 0 #define STATE_INIT 1 byte systemState; volatile long count; //int pinA = 2; int pinB = 3; int limitSW_1 = 4; boolean sigA = 0; boolean sigB = 0; boolean status_L1 = 0; //Ends Encoder //Start MPU #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" #include "PinChangeInt.h" #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE #include "Wire.h" #endif #define OUTPUT_READABLE_QUATERNION //#define OUTPUT_READABLE_YAWPITCHROLL //Ends MPU MPU6050 mpu; // MPU control/status vars bool dmpReady = false; uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU uint8_t devStatus; // return status after each device operation (0 = success, !0 = error) uint16_t packetSize; // expected DMP packet size (default is 42 bytes) uint16_t fifoCount; // count of all bytes currently in FIFO uint8_t fifoBuffer[64]; // FIFO storage buffer // orientation/motion vars Quaternion q; // [w, x, y, z] quaternion container VectorInt16 aa; // [x, y, z] accel sensor measurements VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements VectorFloat gravity; // [x, y, z] gravity vector float euler[3]; // [psi, theta, phi] Euler angle container float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector // packet structure for InvenSense teapot demo uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' }; // ================================================================ // === INTERRUPT DETECTION ROUTINE === // ================================================================ volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high void dmpDataReady() { mpuInterrupt = true; } // ================================================================ // === INITIAL SETUP === // ================================================================ void setup() { // join I2C bus (I2Cdev library doesn't do this automatically) #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE Wire.begin(); TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz) #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif Serial.begin(BAUDRATE); //while (!Serial); // mpu.initialize(); devStatus = mpu.dmpInitialize(); mpu.setXGyroOffset(52); mpu.setYGyroOffset(18); mpu.setZGyroOffset(-24); mpu.setZAccelOffset(1030); // 1688 factory default for my test chip if (devStatus == 0) { mpu.setDMPEnabled(true); attachInterrupt(0, dmpDataReady, RISING); mpuIntStatus = mpu.getIntStatus(); dmpReady = true; packetSize = mpu.dmpGetFIFOPacketSize(); } else { } systemState = STATE_UNINIT; pinMode(pinA, INPUT_PULLUP); attachPinChangeInterrupt(pinA, interruptA, CHANGE); //attachInterrupt(0, interruptA, CHANGE); attachInterrupt(1, interruptB, CHANGE); } // ================================================================ // === MAIN PROGRAM LOOP === // ================================================================ void loop() { if (!dmpReady) return; while (!mpuInterrupt && fifoCount < packetSize) {} mpuInterrupt = false; mpuIntStatus = mpu.getIntStatus(); fifoCount = mpu.getFIFOCount(); if ((mpuIntStatus & 0x10) || fifoCount == 1024) { mpu.resetFIFO(); } else if (mpuIntStatus & 0x02) { while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount(); mpu.getFIFOBytes(fifoBuffer, packetSize); fifoCount -= packetSize; //YPR #ifdef OUTPUT_READABLE_YAWPITCHROLL // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); // Serial.print("ypr\t"); //Serial.print(ypr[0] * 180/M_PI); // Serial.print(","); // Serial.print(ypr[1] * 180/M_PI); // Serial.print(","); // Serial.println(ypr[2] * 180/M_PI); #endif //Quaternion #ifdef OUTPUT_READABLE_QUATERNION // display quaternion values in easy matrix form: w x y z mpu.dmpGetQuaternion(&q, fifoBuffer); // Serial.print("quat\t"); Serial.print(q.w); Serial.print(","); Serial.print(q.x); Serial.print(","); Serial.print(q.y); Serial.print(","); Serial.print(q.z); Serial.print(","); #endif Serial.print(count); Serial.print(','); Serial.print(status_L1); Serial.println(); // Stream.flush(); } status_L1 = digitalRead(limitSW_1); if (status_L1 == 1 && false) { count = 0; systemState = STATE_INIT; } // delay(50); } //interupt for PinA void interruptA() { sigA = digitalRead(pinA); switch(sigA) { case 0: if(sigB == 1) count++; else count--; break; case 1: if(sigB == 0) count++; else count--; break; } } //interupt for PinA void interruptB() { sigB = digitalRead(pinB); switch(sigB) { case 0: if(sigA == 0) count++; else count--; break; case 1: if(sigA == 1) count++; else count--; break; } }
  4. Hello Forum User, First off, thank you for taking the time to read this. Second, I require some assistance in the rewriting of the InvenSence DMP lib for the TI microcontroller for use with the Arduino Uno and MPU6050. I have managed to remove most of the syntax errors that occured when switching from .c to .cpp, and removed the TI microcontroller specific code, but I am having problems with utilizing the Wire.h twi libraries for the I2C communication (specificly writing a function to call the twi libs when the i2c_write or i2c_read functions are called.) Ideally, it would use the included Wire.h library or the i2cdev library for the i2c communication. The main reason for this rewrite is to provide the ability of the users to call all of the listed functions of the DMP. In my case, this is primarally for the Pedometer functions which are not included in other libraries, but it can be used for the other functions as well. Below is a link to the dropbox file with the original library and the modified library. https://www.dropbox.com/s/4umn96yhh5hb9gu/eMPL_Rewrite.zip?dl=0 Thank you very much for your assistance in the matter. -Amatoxin-
  5. Hi everyone, I have been playing with a MPU6050 and an Arduino for a while now and I think it time to replace my Arduino with my new pic32mx. I d like to create a "bridge" in order to use the I2Cdev library on a pic. First of all, if I managed to miss it during my google search, I would love the link If not, well, I m willing to try and build it myself. However I could use some guidelines... I would not say I m a noob in programming but I m certainly not an expert. The way I understand it: All the Class in this library use functions coming from "I2Cdev.cpp/h" "I2Cdev" is using functions coming from "Wire.cpp/h" (I know there is other possibilities but It can work using only the Wire class correct?) Then "Wire" use "twi.cpp/h" (with the TwoWire object created outside of the class ?!? (extern TwoWire Wire;) that's where c++ starts to be a bit confusing for me...) My first (and still main) idea was to create a whole new "Wire.cpp" and to rewrite all its original functions with code appropriate to pic32. But an other option could be to keep the Wire classe from Arduino and rewrite the TWI class instead... The second option would permit to keep the twi class almost intact (with all its benefit) and change only the necessary part. Third option : Anyone ??? What I have today is a class with the following functions (working for my pic) sendStart (bool restart) send a start or a restart signal sendStop() send a stop signal transmitOneByte(char data) just put a byte in the buffer (hardware send it automatically) sendData(char *data, int quantity) // Call sendStart // transmit *data with data[0] = slave address // Call sendStop readData(char *dataTX, int nb param, char *dataRX, int quantity) // Call sendStart // transmit *data with data[0] = slave address, data[1] = register1 , data[2] = register 2 .... // sendStart restart // transmit slave address+write // read the different byte, store them in dataRX and send a Nack at the end // Call sendStop I believe they are close to the Wire class so that should be the easy option however Wire is a daughter class of Stream.h which is daughter of print.h which is daughter......... So the really easy option would be to download that library from a dark website in one of your post below ;-) ;-) ;-) Looking forward to reading you Joachim
×
×
  • Create New...