I2C pull up Resistor with Arduino

Hey.

I hope everyone will be great. I'm kind of new into this field. I'm trying to communicate 10 slave devices with my Arduino Mega 2560. All devices are connected serially, like from Arduino I'm providing SCL, SDA and GND wires to Slave 1. Then wires from Slave 1 goes to Slave 2 and so on. Total length is around 1.5 meter.

It works when i connect either 1 or 2 slaves but when 1 add up more, none of them responds. I guess i need to add up pull-up resistors. What should be the value of pullup resistor and where should i connect them?

Thank You.

1 Like

Hello
take a view here:

Thanks Paul.

I saw that file but I didn't get to know that on what locations do i need to add these?

What are the devices? Do you have links to them? Are there pullups integrated there? If so, it may be that the parallel of these pullups is too much, so the total resistance is too low.
At 1.5m, it might be necessary to add a repeater as described in the linked pdf.
And do the devices all have different I2C addresses?

1 Like

Hey MicroBahner.

Thank you for getting in touch. I've made custom boards and I'm using Atmega 328P on them. Yes, each device has a separate address. It works perfectly when only one or two devices are connected but stops working as i start adding up other devices. I haven't attached any pull-up right now. Do i need to add pull-up resistor after every device?

And i don't have any repeater right now. What if i buy? Do i need pull-ups with repeater too?

You need one pullup resistor per I2C section. A repeater separates the bus into several sections. This is what the picture of @paulpaulsen in #4 from the pdf shows.
Of course you can install several pullups per section as long es the resulting resistance doesn't get too low.

Hello
and keep in mind does some hardware has pre-installed pullup resistors onbord.

@rehopubguc1, you are looking at your project, but we have no clue what you have.

Can you make a photo ?

Maybe you use flat ribbon cable with SDA next to SCL (very bad).
Maybe you connect 3.3V sensors to a 5V I2C bus (bad).
Maybe you use modules instead of the bare sensors, and each module has pullup resistors.
We really have to know everything.

[ADDED] Are all the Slaves the custom ATmega328P boards and nothing else ? Can you show a schematic of those custom boards ? So we can look for decoupling capacitors.

Hey Koepel.

Yes, I'm using ribbon cables and SDA and SCL are next to each other. How is this orientation bad? Do they have some influence on one another?
Circuit-Design-v1.2.3 (2).pdf (19.6 KB)
This is my board's design.

Yes, that is really bad.
See my wiki: How to make a reliable I2C bus. I mention a document "UM10204" there, read page 60 :open_book:

With SDA and SCL next to each other in a flat ribbon cable then about 20 cm distance is possible.
When doing everything right, then more than 6 meters is possible (but I would not recommend it).

I see three decoupling capacitors. Are they 100nF ? Or is there also a larger one ?

Do not connect AREF to VCC.

Capacitors C5 and C6 next to the crystal should be 22pF instead of 0.1µF.
Someone on this forum had to select even lower values for a better clock signal.

There is no external pullup resistor for the /RESET pin ?

The ATmega328P has more than one GND pin. All GND pins should be connected to ground.

@rehopubguc1, your topic has been moved to a more suitable location on the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.