Im new to Arduino and I'm working on a project. I have multiple sensors, a GPS (NEO-M6 ublox), gyrometer (GY-521), and a BMP085 . All require hook up to SCL and SDA. How can I connect them all to my arduino mega? using a breadboard can i designate a row as SDA and SCL?
There is only one SCL and one SDA line, because it is a ‘bus’. You can connect many devices to that bus.
I’m not sure about your question, but I think you can use a row for SCL and a row for SDA.
An Arduino Mega runs at 5V, and has pull-up resistors for the I2C bus on the board. Therefor the Arduino Mega has a 5V I2C bus.
However, some of your components require a 3.3V I2C bus. I suggest you buy a I2C level shifter.
michinyon, yes I am sure. On the board, 10k for SDA and 10k for SCL.
retrolefty, I have to correct you. Open the *.brd file and see for yourself. I can only find it on my board that I have myself and in the *.brd file, the schematic is not clear about this.
The Arduino Mega 2560 is perhaps the only board that has 10k pull-up resistors on the I2C bus to +5V. It is therefor not compatible with a 3.3V I2C bus.
Beside the 10k onboard, it has the internal pullup resistors as set by the library, like with every board.
Caltoa:
michinyon, yes I am sure. On the board, 10k for SDA and 10k for SCL.
retrolefty, I have to correct you. Open the *.brd file and see for yourself. I can only find it on my board that I have myself and in the *.brd file, the schematic is not clear about this.
The Arduino Mega 2560 is perhaps the only board that has 10k pull-up resistors on the I2C bus to +5V. It is therefor not compatible with a 3.3V I2C bus. Arduino - ArduinoBoardMega2560
Beside the 10k onboard, it has the internal pullup resistors as set by the library, like with every board.
So correct you are, I see them now in the upper right in the schematic, as if hiding out ;).
How inconsistent of Arduino inc. to have the mega 'hardwired' for 5 volt pull-ups while the Uno uses internal software pull-ups (that can be disabled by tweaking the library code).
Scrutinising those photos of the Mega 2560 and Mega 2560 R3, they are not the same. The R3 has two sets of I2C pins and the non-R3 doesn't. My Mega is not an R3. It's apparently an original Mega 2560. I got out my big magnifying glass and cannot find these resistors on my board. They are probably there somewhere, but I can't find them. Is it possible that they got added on the R3 model, when the two extra I2C pins were also added ?
This could be behind some of the issues I have experienced with I2C.
Is it possible that they got added on the R3 model, when the two extra I2C pins were also added ?
Most likely. I don't own a mega2560, but an older mega1280 I do own has neither the pull-ups or the extra shield pins.
This could be behind some of the issues I have experienced with I2C.
Hard to say. I would use one of the several I2C 'scanner sketches' and try and work with one I2C device at a time. Once all three report for duty one at a time, only then wire all three devices to the SDA/SCL pins and run the scanner again and see if it then picks all three device addresses responding.