Jump to content
I2Cdevlib Forums

All Activity

This stream auto-updates     

  1. Today
  2. Last week
  3. Earlier
  4. i’m using mpu 6050 for my project and i need to get impact values in case of car accidents how can i get the impact value from x,y,z values the project has nothing to do with the actuall impact values, but to detect wether there was an impact made or not can please anyone help me with this problem
  5. Hi guys, First of all, many thanks to luisrodenas for sharing this work! And to all who contributed on the thread along this years. Studying the code, I have stumbled on a doubt that many here have posted without a definitive answer, which was asked also in many other sources that refers to this calibration code. What is the motivation for the division by 8 and 4 in the calibration function? ax_offset=-mean_ax/8; ay_offset=-mean_ay/8; az_offset=(16384-mean_az)/8; gx_offset=-mean_gx/4; gy_offset=-mean_gy/4; gz_offset=-mean_gz/4; I have searched a lot but couldn't figure it out. Was it based on trial and error? Also, when we use the setOffset functions, what those really do in the sensor? accelgyro.setXAccelOffset(ax_offset); accelgyro.setYAccelOffset(ay_offset); accelgyro.setZAccelOffset(az_offset); accelgyro.setXGyroOffset(gx_offset); accelgyro.setYGyroOffset(gy_offset); accelgyro.setZGyroOffset(gz_offset); For example, if I took the ax_offset, ay_offset, az_offset, gx_offset, gy_offset, and gz_offset values, and subtract from raw data taken from the sensor (without any offset configuration), would that have the same effect? I am looking forward to experiment it myself, but I still don't have access to the resources yet. Many thanks
  6. hey I am making a project using mpu 6050 to analyse human gait so if you have any source code regarding the topic then can you post it
  7. Hello, My name is Robert, I'm a 3'rd year computer science student i i'm working on a bracelet using the MPU 6050 and PSOC 4 BLE chip. I am in need of a bit of help as i have very little knowledge on programming hardware like this. The problem i have is that the chip doesn't produce data. So a standard run works like this: 1. it initializes ok, err is 0 2. fifo count and packet count = 42 dec, 2a hex but isDataReady is false first pass in the for loop so it skips the if 3. second pass in the for isDataReady is true so it processes the data (no new data in the fifo meanwhile, still 42) 4. reads the data from fifo into the buffer and outputs a quaternion, now fifo is empty 5. 3'rd pass fifo count still 0 and isDataReady is true 7. it gets trapped on line 144 at the while loop for reading the fifo count as 0 forever And i have no idea why. Some of the code for the dmp i translated myself from c++ but i'm pretty sure it's ok because i didn't modify the logic behind. P.S. i have some random variables that i use for debugging around there and i know it's dirty but i'm just testing main.c
  8. Hi!, I've been struggling with a couple of MPU-6050's and I think I've found a solution for my problem so I'd like to share this.. I'm using the teapot arduino sketch as the base for my project. After calibrating offsets (there are some topics about this on the forum) the first MPU-6050 worked really good but the other two had some problem. I'm using quaternions and most of the time it started with a Z value near zero (like 0.008830) but sometimes it started with a random Z value (like 0.403030, 0.94000, etc). I've tried compiling the skecth enabling DEBUG on MPU6050_6Axis_MotionApps20.h and the problem dissapeared. It seems that there is a timing problem on the initialization function but it only affects some modules. I've solved my problem in a quick and dirty way by disabling DEBUG and adding an small delay in each DEBUG_PRINT* function. Something like this: #ifdef DEBUG #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTF(x, y) Serial.print(x, y) #define DEBUG_PRINTLN(x) Serial.println(x) #define DEBUG_PRINTLNF(x, y) Serial.println(x, y) #else #define DEBUG_PRINT(x) delay(1) #define DEBUG_PRINTF(x, y) delay(1) #define DEBUG_PRINTLN(x) delay(1) #define DEBUG_PRINTLNF(x, y) delay(1) #endif I know it requires further investigation but for now the problem is solved, at least in my case. I Hope this is useful for someone else.
  9. Hello , i'm french student and iam using MPU6050 SPARKFUN with MPU6050.DMP6, but the sensor block in '' Initializing I2C devices..." what is the problem please ? thanks for your answer
  10. dingari

    ICM-20948 DMP load error

    Hi, I'm trying to flash the DMP image to an ICM-20948 to use the built-in sensor fusion. I've adapted my source code to use the code from the "Embedded MotionDriver (eMD) ICM-20948 v.1.0 for Nucleo Board" functions. I'm using nRF52832 to talk to ICM-20948 through I2C. My problem is twofold: 1) The transfer of the DMP firmware (dmp3a) sometimes fails. The ICM-20948 NACKs a byte (strangely it always seems to be a packet in memory bank 19 or 30), and then I have to power-cycle the chip to get an ACK from any register read/write. 2) In the cases where the DMP firmware transfer is successful, the verification routine fails. The bytes that my device reads back to compare to the firmware bytes are just all zeroes. For reference, this is the firmware upload routine from the MotionDriver source code: int inv_icm20948_firmware_load(struct inv_icm20948 * s, const unsigned char *data_start, unsigned short size_start, unsigned short load_addr) { int write_size; int result; unsigned short memaddr; const unsigned char *data; unsigned short size; unsigned char data_cmp[INV_MAX_SERIAL_READ]; int flag = 0; if(s->base_state.firmware_loaded) return 0; // Write DMP memory data = data_start; size = size_start; memaddr = load_addr; while (size > 0) { write_size = min(size, INV_MAX_SERIAL_WRITE); if ((memaddr & 0xff) + write_size > 0x100) { // Moved across a bank write_size = (memaddr & 0xff) + write_size - 0x100; } result = inv_icm20948_write_mems(s, memaddr, write_size, (unsigned char *)data); if (result) return result; data += write_size; size -= write_size; memaddr += write_size; } // Verify DMP memory data = data_start; size = size_start; memaddr = load_addr; while (size > 0) { write_size = min(size, INV_MAX_SERIAL_READ); if ((memaddr & 0xff) + write_size > 0x100) { // Moved across a bank write_size = (memaddr & 0xff) + write_size - 0x100; } result = inv_icm20948_read_mems(s, memaddr, write_size, data_cmp); if (result) flag++; // Error, DMP not written correctly if (memcmp(data_cmp, data, write_size)) return -1; data += write_size; size -= write_size; memaddr += write_size; } #if defined(WIN32) //if(!flag) // inv_log("DMP Firmware was updated successfully..\r\n"); #endif return 0; } I've looked at the I2C lines on a scope, and the bytes are successfully written to the ICM-20948, but somehow they are not making it to the DMP memory. I've attached a screenshot of the NACK event (third byte). I assume the following constants are suitable for the ICM-20948: #define DMP_LOAD_START 0x90 #define REG_MEM_START_ADDR (BANK_0 | 0x7C) #define REG_MEM_R_W (BANK_0 | 0x7D) #define REG_MEM_BANK_SEL (BANK_0 | 0x7E)
  11. Thanks a lot. After calibrating my sensor, it kinda stopped drifting.
  12. Problem resolved. The problem was the configuration of the INT pin. MPU6050 for some reason does not respond when it issues a pulse with a duration of 50 us, when DMP data ready. The problem was solved by the INT pin configuration so that the MPU6050 held its pin until the data was read.
  13. The gyro values give you angular velocity, not tilt angle.
  14. Hello. i need to know what should i do run run an adxl375 with using adxl345 sources. these two are nearly the same acceleration sensors but adxl375 is with wider range. i will appreciate if anyone help me about it. i need to know what kind of parameter i need to change. i have already tried the raw data example of adxl345 on adxl375, but i just get zero values. thank in advance.
  15. Hello, I would like to know the difference between the output Euler angles and the output yawpitchroll in the DMP6 example from Jeff Rowberg library. The details I would like to know are in terms of how they both work, their frames of reference, fixed or mobile referential and the sequences used like XYZ or ZYX etc. Thank you.
  16. I never use this VHDL code as previously mentioned. It is possible to guess that this VHDL code is not for I2C MPU6050 (or the code is using an external processor to transform i2c to serial). Perhaps it's the problem . An other Mike Field's project is interesting : http://hamsterworks.co.nz/mediawiki/index.php/I3C2 It's a dedicated i2c processor. Because I was interesting in this project I tried it but it but never work. It's very easy to find why : - source code of "i3c2_assemble.c" shows clearly the instruction "MASTERACK" (a very very important instruction) - in VHDL source code i3c2.vhd you never see this very important instruction. I guess the last version is not published. It is then impossible to make both files to work together. I have written Mike Field without answer but discover recently when reading Mike Field's source code there is another email address. Have try to email him. FYI I used already other Mike Field source code without problem. Good luck
  17. I have problem with MPU6050. Approximately every 1 - 2 minutes I get the NACK on the I2C bus from the sensor. This situation arises entirely by chance. I receive NACK during read "Current FIFO buffer size" register, but after reading this register again, the device responds normally. Do not know what could be the reason?
  18. Hey there. I just stumbled upon your site a couple days ago. I have a project to try and measure the vibrations wirelessly inside of a (quite large) machine. WIth the adafruit feather esp8266 and an ITG/MPU6050 breakout board. I have tried to apply the auto calibration scripts posted on the forums...and even the suggested manual one with 'raw' values. But neither managed to give me values that weren't obscenely far away from all zeros except for z at 16364 or simply never worked at all (the auto cal) As I have come to understand it, 16384 is the raw value for 1g. Or approx 9.81m/s/s. Is this correct? My problem however is, when running the example file MPU6050-DMP6-ESPWIFI.ino...and trying to read/plot OUTPUT_READABLE_REALACCEL...I have a large offset in the output data that I don't know how to interpret. My X . and Y converge to (nearly) zero after 15~seconds...however my Z converges around 3900...somethings...What is the unit that this function outputs? Gs? m/s/s? // supply your own gyro offsets here, scaled for min sensitivity mpu.setXGyroOffset(220); mpu.setYGyroOffset(76); mpu.setZGyroOffset(-85); mpu.setZAccelOffset(1788); // 1788 factory default for my test chip These Offsets take RAW values. However when adjusting them even a tiny amount the new plotted values are incredibly off. And because I'm unsure of the plotted value units. I'm not sure what I should exactly be reading nor where to begin with on adjusting the calibrated values. For further infos, the room this is being tested in, is about 16 degrees C...I've seen mentioned temperature needs to be calibrated...Could this is part of the issue? Thank you for the amazing work! As a side question, How do I adjust to different sensitivities 4/8/16Gs...within the arduino code/registers? MPU6050::getFullScaleAccelRange(x) x being between 0 and 3, I have found on the library...is this correct? Thanks again! I'll continue to hunt around the forums, incase I managed to just miss the subject posted somewhere else and update accordingly
  19. FYI I have done FPGA interface with mpu6050 but in a way you are probably not interested in. Because I used a AVR Mega16 free soc I have make a i2c peripheral which is compatible 90% with the true peripheral. This is documented in French in the Wikiversité : https://fr.wikiversity.org/wiki/Very_High_Speed_Integrated_Circuit_Hardware_Description_Language/Travail_pratique/Utiliser_des_shields_Arduino_avec_les_FPGA#De_l'I2C_pour_accéder_à_d'autres_capteurs If you have no experience with soc, I think it would be better for you to use Mike Field's work : http://hamsterworks.co.nz/mediawiki/index.php/MPU6050_sensor_RTL Good luck
  20. Hello everyone, I am trying to interface mpu 6050 with fpga, can anyone help me in acquiring the data from the sensor.
  21. aniket_prasad

    MPU6050 calibration

    Hello guys I have been trying to get yaw values from gyro MPU6050 for my application. The application is basically to control a robot's movement with respect gyro readings. Recently I started facing some issues relating calibration of the gyro. In my code I am mapping all the values of the whole range of yaw (-180 to 180) to pwm range (0 to 200). So ideally the sensor should get calibrated every time at value 100. The situation I am facing is that it gets calibrated at 100 just 3 times out of 10. What may be the possible issue? I am attaching the code for reference. Thank you GYRO.txt
  22. I am interested in any feedback or caveats regarding the following capacitance measurement method before I begin setting it up. For an experiment, I have come across the need to measure and track the spacing between two samples, with resolution of 0.1 mm or better. Due to the constraints of the rest of my setup, after a little bit of research, it appears to me that a capacitive measurement method is most suitable to infer the spacing. Consider the following simplification as the goal: I would like to measure/track the distance between 2 copper plates (each 2cm X 2cm) that essentially form a big capacitor. Note: AD7746 below is a 2-channel, 24-bit sigma-delta Capacitance-to-digital converter The idea: Starting with C=ε0εrAdC=ε0εrAd, where the plate area the dielectric of air are constant, it's of course true that the measured capacitance is inversely proportional to distance. So I could first take some calibration data, and using that, adjust accordingly to infer the distance from any measured capacitance value. The measurement method: Given my fairly stringent requirement of 0.1 mm resolution or better, I plan to go for a precise measurement by using Analog Devices capacitive measurement IC AD7746 datasheet: http://www.kynix.com/uploadfiles/pdf/AD7746ARUZ.pdf. What things should I be careful about to get as clean a measurement as possible, or what aspects can I improve upon? Could the above get me my desired resolution, or is it prone to error sources that I'm not seeing? One possible improvement is: I was thinking, since AD7746 has two channels, I could even use the extra channel to also simultaneously measure a separate pair of completely fixed/reference plates, and use that to nullify any temperature or EMI effects. Hmm, not sure how important those factors are... UPDATE (more detail): A bit more about my setup, and what constraints exist: The experiment involves a larger sample that is directly above, kissing the top plate. The sample is about 75mm X 75mm (non-metallic) and it sort of crushes the top plate down during the vertical motion. As a result, there is no scope for placing any sensors vertically parallel to the Y-axis motion. Any sensing of the vertical displacement/gap would have to be accomplished either horizontally, or with parts mounted on a board in the position of the bottom plate. With that said, the top plate was added just for my proposed way of measurement, and is not strictly necessary. My primary goal is to measure how far away my aforementioned 75mm X 75mm sample ends up vertically from the bottom. UPDATE (Measurement result): I ran a quick test on the capacitive measurement, and I was able to distinguish the capacitance data fairly clearly at about 0.2 mm steps in the displacement. The noise I'm getting in the capacitance measurement is, as of now, too large to get better resolution than that. I am trying to vary a few things to see if I can improve the SNR in the capacitance measurement.
  23. Same issue here. After: (MPU6050.ccp) void MPU6050::initialize() { setClockSource(MPU6050_CLOCK_PLL_XGYRO); setFullScaleGyroRange(MPU6050_GYRO_FS_250); setFullScaleAccelRange(MPU6050_ACCEL_FS_2); setSleepEnabled(false); // thanks to Jack Elston for pointing this one out! } ... * <pre> * AFS_SEL | Full Scale Range | LSB Sensitivity * --------+------------------+---------------- * 0 | +/- 2g | 8192 LSB/mg * 1 | +/- 4g | 4096 LSB/mg * 2 | +/- 8g | 2048 LSB/mg * 3 | +/- 16g | 1024 LSB/mg * </pre> So the MPU6050_6Axis_MotionApps20.h expands... uint8_t MPU6050::dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity) { // get rid of the gravity component (+1g = +8192 in standard DMP FIFO packet, sensitivity is 2g) v -> x = vRaw -> x - gravity -> x*8192; v -> y = vRaw -> y - gravity -> y*8192; v -> z = vRaw -> z - gravity -> z*8192; return 0; } But the MPU 6050 Product Specification says: If the values are queried with the Rowberg-Skript, they are to low. But if I divide the "output_readable_realaccel" aaReal by 8192 instead 16384 it seems to be correct. How to fix it correctly? Sorry for take up the old topic, but its pretty confusing.
  24. Muxis

    MPU- 6050

    What are the prblems / limitations of using MPU-6050? How can we overcome with these problems?
  25. Muxis

    MPU- 6050

    What are the prblems / limitations of using MPU-6050? How can we overcome with these problems?
  26. Thanks for the info. I can't understand why the constant value of 36.53 is added to convert degrees C in the code that everyone uses. The data sheet says the offset is -521 and since the sensitivity is 340 per degree c, surely 521/340 = 1.53 ?? Yes, I do see the 35 degrees under Conditions - but this was the test condition that the spec was determined under - right? Why is it (apparently) added to the 1,53 to get the 36.53 ? Thanks Russell
  27. I see that this a very old thread but in these days I'm facing the thread subject. Using an MPU9250 and the Invensense motion driver (6.1), I'm able to put compass data in the fifo while DMP is enabled, without hacks on the original DMP firmware. I achieved this result by changing the original fifo reset function: the slave 1 fifo bit must be enabled before activating the fifo and dmp features in user control register. The resulting saved record is: 8 byte of compass data (compass status1 + 6 bytes of true data + compass status 2) followed by the original DMP record. Another way: the slave 1 fifo bit can be enabled after the FIFO and DMP enabling (for example: elsewhere in the user code), but a proper fifo purge is required to discard the incomplete records and gain the correct sync against the FIFO. These solutions work on my device using 200 hz DMP sample rate + 100Hz compass sample rate (every compass sample is repeated two times in FIFO, gestures enabled and quaternion disabled), but them are totally undocumented and more testing is needed, so, I would like to know if anyone use similar solutions and if there are know issues. Regards.
  1. Load more activity