Why do these modules refuse to work together? - Page 1
Forum section: electronics / beginners

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 26, 2024, 03:32:32 pm
content: so when i connected the modules (bmp180, mpu6050, hmc5883l, ssd1327 oled) one by one, the modules worked fine. But when i connected the modules together, the oled glitched. i connected Scl and Sda of the modules together (no power) the display doesn't turn on and the ide says display not initialised. i connected the mpu6050 and hmc5883l together with power, it works fine and when i connected the mpu6050, hmc5883l, ssd1327 oled , the display glitches! (without bmp180) whats happening here? is the scl and sda are glitching? (when i connected all of them together, i uploaded the code only for display and it glitches out!) what the hell is happening now?

author: microbug
author_rank: Frequent Contributor
timestamp: March 26, 2024, 04:20:58 pm
content: Each module probably has its own I2C pull-up resistors. With all the modules connected, the pull-up resistors are in parallel and the effective pull-up resistance is much lower (so more current goes through the switching transistors). When the pull-up resistance is too low, the OLED driver IC can't pull SDA or SCL low.First, measure the pull-up resistance with all modules connected (the resistance between SDA and VCC, and the resistance between SCL and VCC). If it's less than 1kOhm, remove the pull-up resistors from one of your modules and try again. Keep going until the pull-up resistance is >1kOhm.

author: selcuk
author_rank: Frequent Contributor
timestamp: March 26, 2024, 07:09:59 pm
content: Since the drivers of the I2C bus only pull down, and the resistors pull up, the impedances of the logic levels are different. When you drive the clock line to ground strongly, it causes glitches on the data line via capacitive coupling while data is at high level through the resistor. You didn't mention but if you make I2C connections with cables, I recommend you to separate clock and data. For example, you may connect (twist) clock and ground together and data and vcc together. If you use a twisted pair cable and twist I2C clock and data together, that causes issues even with slow data rates.

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 04:08:03 am
content: ok..., when i take a look on these modules i saw a 10k pull up resistors. But it can't be seen on the ssd1327 display (as you can see in the image). I searched up for the schematics and saw a 4pin generic version and it has a 10k pullup! (see image 2) so is it possible to add a 10k pullup on the scl and sda of the display?. Also im using 2x mcp23017 16bit gpio expander and should i add a 10k pullup for that also?

author: LM21
author_rank: Regular Contributor
timestamp: March 27, 2024, 05:27:24 am
content: You need only one pull-up resistor. No need to to ADD a resistor. If the problem is what others here suspect, your total resistance is too low. Adding resistors makes it worse.How long is the total length of your SDA or SCL wires. I2C bus has a limit there.

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 05:40:07 am
content: its like 5/4 cm each. so what should i want to do?

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 07:15:16 am
content: should i follow this schematic?

author: LM21
author_rank: Regular Contributor
timestamp: March 27, 2024, 07:30:32 am
content: If you want to. But like others have said, I2C bus must have pull resistance, not too high or too low. You can measure resistance with a DVM. Or you can search for all pull-up resistors (components) and check them.

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 12:09:45 pm
content: ok so just need to connect 10k resistors on the input of the display? also im using mcp23017 ic for expanding gpio. do i need a 10k pullup for that too?

author: nfmax
author_rank: Super Contributor
timestamp: March 27, 2024, 02:07:27 pm
content: Maybe two of the modules are set to the same I2C address? That would explain why they are OK singly but fail in 'interesting' ways when they are all on the same bus.

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 04:04:37 pm
content: But I only uploaded the program for display and not for rest of the modules while connected every modules in i2c bus. Still the static is seen

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 04:05:33 pm
content: Adding resistor as pull up didn't help either

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 27, 2024, 05:41:31 pm
content: Maybe I'll use display as spi mode through mcp23017 expander but it's very difficult to program

author: Rishles69@
author_rank: Regular Contributor
timestamp: March 28, 2024, 06:38:03 am
content: These are the connected modules and addressesBmp180 pressure sensor > 0x77 (this address is fixed and can't be changed. On my first build, I didn't used this sensor and gave the screen glitch with only mpu6050 and hmc5883l)Mpu6050 > 0x68 and 0x69 (this address are not related with oled and gave the glitch)Hmc5883l magnetometer > 0x1E (after many searching this address is also fixed too and not related w/oled)Ssd1327 oled > 0x3c and 0x3d (the display only worked in 0x3d and if I set it to 0x3c it doesn't turn on even only the module is connected)So I want to say that when I first tried single modules it works fine. In my first attempt, I connected both gyro sensors and not bmp180, the screen glitchesthe address aren't same tho?. And in my second attempt I connected only hmc5883l and oled same thing happened. Also when I connected the mpu6050 same thing happened. Why and how. The display doesn't even recognize when set to 0x3c. This makes me mad too much as I spend 7000rs on it. The display works fine

author: Rishles69@
author_rank: Regular Contributor
timestamp: April 02, 2024, 07:44:13 am
content: Now i fixed the problem.i first turned my oled module to spi and since there is lees number of pins available, i used an esp32 wroom. So problem solved.

author: tooki
author_rank: Super Contributor
timestamp: April 02, 2024, 07:15:26 pm
content: Quote from: selcuk on March 26, 2024, 07:09:59 pmGreat info.FYI, the official i2C specification from Philips/NXP has recommended signal line configurations for PCB traces and cable. I can dig it up if anyone is interested.

author: tooki
author_rank: Super Contributor
timestamp: April 02, 2024, 07:24:04 pm
content: Quote from: Rishles69@ on April 02, 2024, 07:44:13 amThat’s certainly a functional workaround. But it’d be great for you to figure out why it didn’t work on a single i2C bus. The official i2C specification document has recommendations on bus design that might provide insight. I can dig it up for you if desired.Another workaround is to use a second i2C bus. ESP32 supports a second hardware i2C bus, and on any MCU, it’s also possible to bit-bang extra i2C buses if you need more than the MCU provides.

author: selcuk
author_rank: Frequent Contributor
timestamp: April 02, 2024, 08:51:14 pm
content: I think you are referring to the attached document. Section 16.3 Wiring pattern of the bus lines.https://www.i2c-bus.org/fileadmin/ftp/i2c_bus_specification_1995.pdf

author: tooki
author_rank: Super Contributor
timestamp: April 03, 2024, 05:24:06 pm
content: Quote from: selcuk on April 02, 2024, 08:51:14 pmYep, that's precisely the section I was thinking of!

author: xvr
author_rank: Frequent Contributor
timestamp: April 03, 2024, 05:30:37 pm
content: Quote from: Rishles69@ on March 27, 2024, 04:05:33 pmYou shouldnot add, butremoveextra pull-up resistors. Each [or almost] module you mentioned (bmp180, mpu6050, hmc5883l, ssd1327 oled) already include pull-up resistors. I2C bus do not expect such number of pullups (all of them running in parallel). You should find theminsidemodules and remove all, except one.