Hello, I've just started with electronics and I got my own PCB to work, everything is working except my i2c bus. I've had a struggle finding out why. When I throw a i2c scanner on it, it says that it didn't find any devices which is strange, because I have a BMP280 and a MPU6050 connected. Both don't work.
I think the reason why they don't work is because it's only using 1V. This is a to low of a voltage for i2c which I've read and it should be 3.3v or 5v. Keep in mind that I'm new to this stuff and I don't know how to increase my voltage of the communication.
I've yet only tried searching on the internet and running the following code in my setup function for the i2c scanner code.
Can you show a schematic ?
Do you use a Arduino board on your PCB ? Which board ? A Teensy 3.1 / 3.2 ?
Do you use BMP280 and MPU-6050 modules ? Can you give links to every module that you use (preferably a link to where you bought it).
When you connect a 3.3V sensor to a 5V Arduino board, then there is a voltage mismatch on the I2C bus. The Teensy 3.1 / 3.2 is a 3.3V board, so then it is no problem.
The I2C bus also needs pullup resistors. Perhaps you have accidentally added strong pulldown resistors.
By the way, Arduino has the pins "SDA" and "SCL" already defined for you.
I2C bus at pin A4 and A5 (SDA = A4 = 18, SCL = A5 = 19). No onboard pullup resistors, no onboard I2C devices.
The Adafruit BMP280 module is okay, you can power it with 3.3V and 5V, and 5V power to VIN is a little better
The MPU-6050 module can also be powered with 3.3V and 5V, and 5V power to VCC is a little better. On the photo there are SMD components of "222". Those are 2k2 pullup resistors on the I2C bus to 3.3V. I assume there is a 4k7 pulldown on the AD0 pin.
Your total pullup is:
I don't know the internal pullup resistor for a digital pin. I'm using 50k in the calculation.
50k // 2k2 // 10k // 10k = 1482 Ω
The sink current for SDA and SCL = 2.2mA
It should be less than 3mA, so it is okay.
Conclusion: I can't find a problem. It could be a shortcut in the PCB. That shortcut is about 650Ω or one of the modules is broken or not powered.
@Koepel diligently checked which pullups are already there on your modules. Combined, they account for around 1.5k of resistance, which is more than strong enough for I2C pullups.
I think you need to go with his previous suggestion to start removing I2C modules from your board one by one until you find the culprit. Some desolder wire (copper braid) and flux will be your friends. I cannot guarantee you'll be able to cleanly take them off your PCB. Next time don't solder everything on there all at once, but first bread board test your setup, then design your PCB, and when it arrives/when you've manufactured it, solder on components one by one, checking all the time if everything works as anticipated.
I've just checked my voltages for the BMP280. It has a 4.5V comming in, SDA has a 3.54V connection, and the SCL has around a 0.75V connection, strange. This is the first slave connected to the teensy master.
I've also checked my voltage for the MPU6050. It has a 4.5V comming in, SDA has a 0.75V connection just as the SCL trace.