Comments (15)
I assume the code isn't working as is, the protocols looks similar, you might have gotten lucky. If you hook the USB port on the Wemos up to a serial emulator you should get some diagnostics out.
from ispindel.
Thanks for the speedy reply. I did hook it up too a serial monitor but the only thing it told me was that the accelerometer was not detected, didn't seem like super useful info.
From what I've read (not that I'm an expert or anything) it seems like the MPU9250 & MPU6500 use the same library. However the MPU9250 (https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU9250) version of the MPU6050 library currently used is about 4 years old and has all different commands in it so it just comes up with a heap of errors when I try and build new firmware in Platform.IO
from ispindel.
After some hours of reading and having an epiphany I've managed too get the standard code using the library for the MPU6050 working by commenting out line 68 in file MPU6050.cpp and replacing it with "true". I believe the error is occurring because the device ID of the MPU6500 is not 0x38. After looking at the datasheet it should be 0x70, but that doesn't work either. Any ideas??
bool MPU6050::testConnection() {
// return getDeviceID() == 0x38;
return true;
}
from ispindel.
Mind share the datasheet?
MPU6050 lib will not work if ID is 0x70. Function GetDeviceID() reads 6 bits (which is enough for 6050 id == 0x34 b110100, but not enough for 6500 id == 0x70 b1110000.
Simply put, it must read 7 bits to get id == 0x70.
from ispindel.
In Datasheet says:
As I see in Schematics, by default, AD0 is connected low, so ID is b1101000 wich is 0x68
from ispindel.
As I see in Schematics, by default, AD0 is connected low, so ID is b1101000 wich is 0x68
This schematics is for 9250, not 6500 ?? @stefschin
And for 9150/9250 ids are 0x68 and 0x71 I believe.
from ispindel.
It's the only schematic I found as MPU 6500
https://www.smart-prototyping.com/MPU6500-6DOF-Sensor-Breakout-Board
I think it's same circuit for both ICs.
And in datasheet has same ID as MPU 6500
MPU9150 is a MPU6050 with integrated AK8975 magnetometer
MPU9250 is a MPU6500 with integrated AK8963 magnetometer
Somebody can try with 0x68 or 0x69?
from ispindel.
I have tried "getDeviceID()" with both 0x68 & 0x69 and both give back an error
from ispindel.
I have tried "getDeviceID()" with both 0x68 & 0x69 and both give back an error
How many bits you was reading?
from ispindel.
I have tried "getDeviceID()" with both 0x68 & 0x69 and both give back an error
How many bits you was reading?
I'm sorry. I don't know how to test that :(
from ispindel.
I have tried "getDeviceID()" with both 0x68 & 0x69 and both give back an error
How many bits you was reading?
I'm sorry. I don't know how to test that :(
As I said function getDeviceID() from the MPU6050 lib reads only 6 bits.
You need to read 7 bits to get any values grater than 0x3f as device ID
from ispindel.
Sorry for delay but I was on a trip. I think we have made some mistakes about the code.
What I was talking about is Slave Address, but thinking that they are not the same for both devices. But reading datasheet both are the same: 0x68 for AD0 pin low and 0x69 for AD0 pin high. So nothing to worry until here.
You can see it on driver code: MPU6050.h line 60
#define MPU6050_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for InvenSense evaluation board
#define MPU6050_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC)
#define MPU6050_DEFAULT_ADDRESS MPU6050_ADDRESS_AD0_LOW
and has the purpose to communicate with different devices on same I2C bus.
In other side to check if device is correctly connected, you can read Register 117, WHO_AM_I, that returns the contents of the upper 6 bits of the MPU-60X0’s 7-bit I2C address, in this case 0x34.
As you can see on MPU6050.cpp line 68
bool MPU6050_Base::testConnection() {
return getDeviceID() == 0x34;
}
This function reads ID on this way:
uint8_t MPU6050_Base::getDeviceID() {
I2Cdev::readBits(devAddr, MPU6050_RA_WHO_AM_I, MPU6050_WHO_AM_I_BIT, MPU6050_WHO_AM_I_LENGTH, buffer, I2Cdev::readTimeout, wireObj);
return buffer[0];
}
Now, for MPU-6500, it has same register 117, WHO_AM_I but is different:
As we can see it's 0x70 and has 8 bit instead of 6 returned before.
Anyway surely there are other differences between this two ICs that can make a bad communication or sensor readings. Normally I would search for other driver that's specific for MPU-6500 and compatible with the driver that uses iSpindel code. Or edit MPU-6050 driver to make it work with MPU-6500...
I can do it with more time but unfortunately both devices are not recommended for new designs, new Motion Sensor that I see for Arduino is LSM6DS3 but I didn't check for Arduino Library.
Hope it helps, cheers
from ispindel.
Hey guys. Thanks for all your help / advise. I went and did some reading of the things you've been discussing and came to the following conclusions:
- MPU6500 works using the MPU6050 library on the ISpindel as the command used are the same on both chips
- .getDeviceID return 56 on the MPU6500
So I have altered iSpindel.cpp file, line 970 bool con = accelgyro.testConnection();
has been replaced with
bool con = false;
if (accelgyro.getDeviceID()==56)
{
con = true;
}
if (accelgyro.getDeviceID()==0x38)
{
con = true;
}
This makes both MPU6050 & MPU6500 chip work perfectly. Is this something that could be uploaded into the main branch?
from ispindel.
2\. getDeviceID return 56 on the MPU6500
FYI 56 dec is 0x70 and thats what they said in the datasheet
from ispindel.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from ispindel.
Related Issues (20)
- Blynk 2.0 Changed the way to connect HOT 2
- InfluxDB Authentication - Token HOT 6
- iSpindel HOT 2
- Doc link do not exist: https://www.ispindel.de/docs/tools/TestServer/Readme.md HOT 4
- Is it possible to reduce the accuracy of "battery" and keep 2-3 digits after the decimal point? HOT 10
- Wemos V4 HOT 10
- Proposition: Have a project able to route the messages HOT 3
- Discussion: What about using a ispindel github org (e.g.: https://github.com/ispindel, ...) ? HOT 5
- Issue with Ubidots API HOT 3
- Create new release :tada: HOT 3
- Firmware 7.2.0 identifies itself as 7.1.4 HOT 2
- History of tilt entity in HA not shown as line graph HOT 5
- Same issue as Issue #571 - Issue with Ubidots API HOT 2
- HTTP404 when clicking "Delete WiFi configuration and reboot" /r HOT 7
- Wrong tilt value HOT 4
- Holder for the PCB card in the container HOT 15
- Changes in ArduinoJson broke Sender.cpp HOT 1
- MQTT topic to force iSpindel in configuration (AP) mode? HOT 6
- Exception (28) on plain modules HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ispindel.