I2C questions

been getting back into a project that I wanted to do for a while and it requires I2C.

that's why I put it on the back burner, at the time I was new to Arduino and coding.

I still am but I've gotten better than I was and I feel like I'm ready to get back into this project.

I've tried to look up tutorials on youTube but a huge majority of them are from India or something.

its hard for me to listen and get into what they are saying.

so my questions are....

Can anybody post a good English tutorial for I2C with Arduino?

Why does it use analog in? (A4 and A5) is what I've seen.

Can a proMini be set up to use it the same way an uno does?

I'm just a squirrel tryin to get educated.... Thank you

It doesn't use those pins as analog pins. Many pins on the board have more than one function and A4 and A5 in addition to being digital IO and analog inputs are also where the I2C bus lives. Those are just the pins they decided to put it on.

Do you know if the Pro Mini operates the same way.

I looked it up under the products tab and it was listed in the chart as ( I2C 1 )

does the 1 mean there is only one port? it seems like it would need two for SDA and SCL

or does it mean it can only support one I2C device? which from my understanding somebody can put as many I2C devises as they want as long as the address/device code is different.

Do you know if the Pro Mini operates the same way.

Yes exactly the same way, because it is the same processor.

The I2C bus can support 127 devices. You need two Arduino pins one for SDA and the other for SCL, these two must be the specific pins specified because they are attached to hardware inside the processor that no other pins are attached to.

It means it only has one I2C bus. That is one SDA and SCL pair. And you can put as many devices on it as you want so long as they all have different addresses.

so... one 'pair' = the whole I2C bus.
"as many as you like " provided

  • you do not like more than 127
  • each has a separate address

some devices have hard coded addresses the BME280 has only 2 possible so the I2C bus can only use 125 other devices plus the 2 of those devices.

a lot of boards only offer a choice of 8 addresses by means of jumpers so you need to do your homework of what you want and what is possible.

my suggestion is to google the device name, with arduino and then see if there is sample code. maybe add I2C to the search.

if you want specific help, please post any code you have, and links to data sheets of boards or parts you are using.

I would be using a pro mini 3.3v with two amg8833 Panasonic grid eye sensors

looking to use 3 to 5 pins on the pro mini as digitalWrite.

I have no code for this project yet. ( I’m just trying to get my ducks in a row )

The data sheet is in the attachments…

Grid-EYE SPECIFICATIONS(Reference).pdf (410 KB)

Why have you got two threads running?

yeah sorry. they are kind of separate though. one was for wiring for the grid eye. the other was more I2C based...

they do involve the same project and same sensor... my bad.

as far as finding sample code as recommended, this is a link to multiple, I don't know which one would be best to use for my project.

here is the link

Ok, I’ve been doing some research on i2c subject.

a lot of things I’ve seen say it needs a pull up resistor for SCL and SDA to VCC.

does the Arduino automatically use internal one when set up for i2c or do I need to install them?

if I need to install them, what is a good value? I imagine 1k or 2k should be sufficient?

4K7 is my starting value.

ok. any particular reason to why 4K7? kind of a strange number? do you use that for everything like LEDs and NPNs or just i2c?

not trying to be a smart @$$ just trying to learn

any particular reason to why 4K7? kind of a strange number?

With 5V it gives about 1mA of current. Which is the specification of the bus drivers.

It does appear to be a strange value, doesn't it?
But it's a common, standard E12 value.

Grumpy_Mike:
With 5V it gives about 1mA of current. Which is the specification of the bus drivers.

I will be using 3.3v for this project...

See reply #10

Datasheet tells me that these sensors can be set to two addresses.
1101000 when AD_select is connected to ground, and 1101001 when connected to VDD.

I2C pull up strength needed depends on wire length (wire capacitance).
There might already be a (4k7 or 10k) pull up resistor on the breakout board. That value should be ok for 30cm.
Leo..

LandonW:
I will be using 3.3v for this project…

In which case use a 3K3 pull up. That gives you 1mA.

Wawa:
There might already be a (4k7 or 10k) pull up resistor on the breakout board. That value should be ok for 30cm.
Leo..

I will check the board to find out, my understanding is that only one resistor for SCL and one resistor for SDA
for the entire bus.

will it effect any thing if there is more than one?

like I said earlier, I'm using two amg8833 sensors

I2C specs say 1-10k for pull-up. 4k7 is indeed common and will work just fine in most situations.

If you're using breakout boards for i2c sensors there's a good chance that there are 10k pull-up resistors on those boards already, check the schematics. Add three of those boards and you end up at an effective 3k3 pull-up and there's no need for you to add extra resistors.