I'm using a Edison + arduino breakout board and a gy87 10dof imu and for the past 3 days I'm trying to make it work.
First I tested the gy87 in a real arduino and it worked flawlessly, then I tried on the Edison. The interesting thing was that no matter how I tried, it worked on the arduino and doesn't worked on the edison. The gy87 has a level shifter so I can apply 5v to the VCC pin or 3.3v to the "3.3v" pin.
Arduino 5v to VCC pin (detects)
Arduino 3.3v to VCC pin (detects)
Arduino 3.3v to 3.3v VCC pin (detects)
Edison 5v to VCC pin (doesnt detect)
Edison 3.3v to VCC pin (doesnt detect)
Edison 3.3v to 3.3v VCC pin (doesnt detect)
But I knew the i2c was working on edison because I could find the arduino if I set it up as an slave i2c.
After researching I tried to set the jumper J9 to position 2-3 so that the ioref goes to 3.3v. And then:
Edison 3.3v to VCC pin (doesnt detect)
Edison 3.3v to 3.3v pin (detects)
But although I can access the sensors, my communication using edison is kind of unstable, I keep having some reads with zero values (no zero values using arduino). And to access the magnetometer (HMC5883L), I have to set the ACC/Gyro (MPU6050) to bypass the i2c comming from the magnetometer. But every time I try to activate the bypass I cant read neither from the magnetometer nor the ACC/Gyro (once again, works flawlessly on arduino).
I'm thinking maybe the problem with the zero values and the magnetometer is that the edison isnt able to provide enough power to gy87. I tried to power the gy87 with the arduino's 3.3v pin and connect the SCL and SDA to Edison (and sharing the ground between the three devices), but when I do the edison can no longer detect gy87 (I dont know why). I dont have a external 3.3v power supply to try.
Or maybe the i2c is just unstable and I'm running into the multiple i2c slaves problem (http://electronics.stackexchange.com/questions/135078/multiple-i2c-slaves-on-intel-edison-i2c-6-bus http://electronics.stackexchange.com/questions/135078/multiple-i2c-slaves-on-intel-edison-i2c-6-bus).
I'm so frustated and disapointed with the Edison + arduino breakout board..
Why every way I try to connect the sensor to the arduino it works and almost every way I try to connect with the Edison doesnt work?
Why when I use 5.0v in the level shifter (VCC pin) in the gy87 the edison cant detect the device?
Why even when I can detect the gy87 the communication is not working properly?
Why is a lot of people having i2c problems with the arduino breakout board?
Is the arduino breakout board poorly made or designed?
Why is it so unreliable?
I dont think this is a wiring problem because the same wiring scheme works with the arduino, and I'm being able communicate with the sensors using the edison. Also I dont think it is a code problem since, once again, it works with arduino, and the code its just basic i2c to get the raw data from the sensors.
Do you guys have any idea of anything I might be doing wrong? Or anything that might help?
I have the latest edison version (159.devkit), the latest mraa version (0.9.5) and the latest upm version (0.5.1).
Thank you very much for the information regarding the tests you have done with the shield, the Edison and the Arduino.
I'm really sorry for the behavior you are having with your configuration, I understand that you feel frustrated and we want to help you with this, identify the problem and find a solution for you.
I would like to know which code and libraries you are using for this. Could you post a link to them?
You said that the problem with the zero values could be that the power provided by the Edison is not enough for the gy87. Have you tested these lines? At the moment you connect everything, is there a drop-down in the current or voltage in the power input of the gy87?
Have you tried to check the SDA and SCL signals in order to identify the problem? With this we could identify if it is a problem with noise, frequency, data or other.
Have you tried with pull-up resistors?
Regarding your questions.
1. The Arduino Board and the Edison + Arduino Expansion Board are different boards with different processors, they have the same pin-out distribution but they work differently, both of them have different ICs and components that cause this.
2. Have you tested the pins? Is the pin actually providing 5V? Could you tell us the position of the J8 and J9 headers?
3. This could be a problem with the libraries, frequency used or another, please let us know the error message or the data you are receiving. Also, let us know about the code and libraries you are using.
4. There are some problems that have been reported in the past and in every new release we solve some of the issues, we appreciate the patience regarding this matter. We continue working on solving different problems and in improving the experience in using the board.
There have been some reports regarding problems with I2C, the problem you have could be related but it may not, so I suggest you to check the SDA and SCL signals in order to identify the real problem we are having with the gy87 and the board.
Hello CMata_Intel, thank you for the answers.
I'm using the code posted from DiegoV_Intel in this topic to detect the I2C devices.
I'm using this code to read the raw data from the MPU6050 inside the GY87.
I'm using the codes in the following site to use the arduino as an I2C slave device to connect to the Edison as an I2C master device.
https://www.arduino.cc/en/Tutorial/MasterWriter Arduino - MasterWriter
I tested providing power to the GY87 by an external power supply and the result was the same as before. So the power is not the problem here.
I have tested the SDA and SCL pins in a osciloscope for a variety of configurations and I'm going to post it in another reply.
The GY87 board already have pull up resistors. But I tried to add an external pull up resistor and the gy87 became undetectable (even in the configuration when it was detectable without the resistor).
I have tested the pins and they do provide 5v and 3.3v. The position of the AREF J8 pin was always set to default (position 1-2). The position of the IOREF J9 pin was set to 1-2 position 5v and to 2-3 position 3.3v. Only in 2-3 position the edison was able to detect the gy87.
CMata_Intel, as I said before, I did some experimentation with the SDA and SCL pins in a osciloscope for a variety of configurations.
The images are in a pdf file attached in this reply. Please take a look.
What I found was that comparing the waves using arduino and edison was:
1) The waves using Arduino and gy87 are more "square" than the waves using Edison and gy87. Using Edison when the wave reaches the top value it is already time to go down. (photos 1,2,3)
2) I think this should be the main problem. In Edison, the bottom value in the SCL and SDA is 1.2v above ground level using 5v IO and 0.56v above ground level when using 3.3v IO. When I set the bypass in the MPU6050 to true, the bottom level goes to 1.76v above ground level using 3.3v IO. When using arduino the bottom level is really close to the ground level. (can be seen in all the photos)
3) To be able to detect I have to put the edison IOREF as 3.3v and power the gy87 using the 3.3v pin. If I use the VCC pin to power the gy87 it becomes undetectable. But I couldn't find any meaningful difference in the waves. (photos 6, 7, 8 and 9)
4) When reading data from the sensor, the SDA pin has some drop voltage below bottom level. And some "impulse" like waves. This could be the reason for having some zero values in the readings. (photos 10, 11 and 15)
5) When I increase the voltage in the external dc power supply from 3.3v to 3.7v the amount of zero values in the readings decreases a lot. But the overall wave shape doesn't change very much. Maybe there is some slight changes in the top level voltage and bottom level voltage (photos 10, 11 and 15). (photo 15 is the one with 3.7v input voltage).
6) When I connect the arduino to the edison using arduino as an i2c slave and edison as i2c master, the wave's shape is the worse of all, but the bottom level voltage is not that far from the ground level. In this case the edison is able to detect the arduino and communicate just fine, without anything like a zero value. (photos 19 and 20)
7) Using arduino only with the gy87 provides the best wave shape of all with the best bottom level. So the communication is always good. (photos 1, 2, 16, 17 and 18)
Do you have any tips to give based on the osciloscope images? Is there a way to try to force the bottom level to go closer to ground level?
Joao Gutemberg Farias Filho
Thank you very much for the detailed PDF with all your results and also for your very complete response.
I have been doing some tests with the code you mentioned (I don't have the GY87) but I ran some tests to see the SDA and SCL signals and I have some questions and some responses for you.
Which Arduino IDE version are you using to upload the I2CScanDevices.ino? The reply from Diego was on 4/16/2015, since that day there have been several new releases for the Arduino IDE, this could include new library versions that may affect the results. According to the day of the reply, Diego could be using the IDE 1.6.0.
If the GY87 has already pull up resistors is normal that it became undetectable when you connected the external resistors. So, you don't need to add external pull up resistors (externally).
The problem with 5V could be a problem in the current required for the GY87, the voltage can be 5V but if the board is not able to provide the required current for the shield, the shield will never return an Acknowledge signal, or it can be inconsistent due to this restriction. You can try by measuring the current on both configurations (Arduino and Edison).
There are some known issues regarding the frequencies on the I2C interface, the behavior of the wave that goes down at the moment it reaches the maximum value can be related with it.
Also, the libraries for the MPU6050 code were made for the Arduino Board and not for Edison, so there could be some conflicts while using the library.
Some suggestions on how to avoid the offset of 1.2V or 1.76V can be using an Operational Amplifier configuration that ensures the correct range.
You can also start trying to use C code or another language different than Arduino. For this, you will need to use the MRAA library, and there are some examples that may help your debug your code.
http://iotdk.intel.com/docs/master/mraa/ mraa: Main Page
https://github.com/intel-iot-devkit/mraa/tree/master/examples mraa/examples at master · intel-iot-devkit/mraa · GitHub
We could also check if by not using the Arduino libraries we could avoid the offset.
Please let me know if you want to use another language like python or C for this so I could help you with it. Using these languages and the MRAA library it is easier to try with different frequencies and we could send simple packages of data to check if the behavior is the same.
Thank you for your answer.
My arduino IDE version is 1.6.5 but I always get the same results with the arduino I2CScanDevices.ino and using i2cdetect through ssh. So I dont think the arduino IDE version would be the problem.
I also tried to power the GY87 with an external power supply of both 5v and 3.3v and got the same results.
I tried the I2C with the standard frequency (100khz) and the fast frequency (400khz). The result was pretty much the same.
Also I used the upm's library to connect and get data from the GY87, programming in C/C++. It had the same behavior as using arduino IDE.
Recently I tried to add one pulldown resistor of 1 kohm to SDA and one to SCL, and it did the trick (unfortunately one problem remained).
For the first time I was able to communicate with the GY87 and get the data from the MPU6050 in a "stable" way. I could easily detect the MPU6050 and read the data without having zero values.
When I looked at the oscilloscope I was really surprised to see that with the resistors and supplying 5v in VCC of GY87 my SCL and SDA were operating between 2.3 V and 600 mV. So even if it was far from perfect (I should be operating between 5v and 0v), it was working flawlessly. (photo 1)
The problem was that when I turned on the i2c bypass in the MPU6050 so that I could connect with the magnetometer (HMC5883L) the lower voltage went to 1.5 V and the SDA and SCL were operating between 2.3 V and 1.5 V. At this range I couldn't even detect the sensors. (photo 2)
With the bypass on I added another 1 kohm resistor in parallel to the ones that were already at place. So the total resistance dropped to 500 ohms. By doing this I was operating between 1.8 V and 1.05 V and I could detect and read data from the MPU6050. (photo 3)
But the magnetometer remained undetectable. So I added a third 1 kohm resistor in parallel, and the total resistance dropped to 333ohms. By doing this my SCL and SDA were operating between 1.62 V and 800 mV. In this configuration I was able to detect and read data from the magnetometer but not the MPU6050. (photo 4)
So I have three configurations:
1) I2C BYPASS OFF, 1 kohm pulldown, MPU6050
2) I2C BYPASS ON, 500 ohm pulldown, MPU6050
3) I2C BYPASS ON, 333 ohm pulldown, HMC5883L
In my application I would need to use the three configurations. I need to use (1) so I can detect the MPU6050 and turn the i2c bypass on (using 500 ohm pulldown and 333 ohm pulldown with i2c bypass off I can't detect the sensors). I will need to use (2) to read data from the MPU6050 and (3) to read data from the HMC5883L.
I could switch between the configurations using transistors as switch. But is there a better way to do this?
Is there another way to force the lower level to go near ground without using external pulldown resistors?
How would it be done with an operational amplifier? I have very little knowledge about it.
Is there any configuration in the intel arduino board that would achieve similar results as external pulldown resistor?
I'm using the pin setup described in the section 11.6 of the Edison Arduino Board Hardware Guide to setup the I2C. Also I've tried to change the "current_pullmode" and "current_pullstrength" in /sys/kernel/debug/gpio_debug/gpio27/ and /sys/kernel/debug/gpio_debug/gpio28/ but it changed very little the response. Is there any pullup resistor I can disable besides the ones described in the I2C setup in the hardware guide?
I also tried to use an external AREF by changing the J8 pin to position 2-3 and applying an external voltage to AREF. I wasn't able to distinguish any difference in the detection by varying the voltage from 0 V all the way to 3.3 V.
P.S.: Since it worked (partially) for me, I think using and external pulldown resistor can solve a lot of peoples problems with i2c detection and zero readings.
João Gutemberg Farias Filho.
I wanted to know which Arduino IDE version you were using because of the libraries included in the software, the latest version is the 1.6.8 this one may or may not have improvements in their libraries, if you want to know the differences between these versions I suggest you to contact Arduino for this.
http://www.arduino.cc/en/Main/ContactUs Arduino - ContactUs
Switching the configurations you need by using transistors is a very good approach; I encourage you to do this. If you try a 100% software approach I think it will be more difficult to start getting the data without errors.
With Operational Amplifiers you can try the Offset Null configuration, you can search this in the Internet and you will find a lot of examples, and ICs. But, if you are able to have better results with the external resistors, I suggest using the resistors because they are passive components and you will avoid to include more power in your configuration.
The only resistors you can disable and that have been tested are indicated in the Hardware Guide.