Notifications
Clear all

I2C connectivity and data transfer

3 Posts
2 Users
0 Likes
2,961 Views
ZukaZuka
(@cawr2975)
Member
Joined: 4 years ago
Posts: 2
Topic starter  

I have been having issues with reading simple i2c addresses between a bunch of Arduino Nanos. I have about 12 of them on a large breadboard, all sharing the same power supply. They are all hooked up via A4 and A5 for i2c, and I have some 10k pullups from 5v to both sda and scl. I have all but one Arduino set as slaves with different addresses, and one as a master running a scan for devices. For some reason, when I hook up more than 4 devices, it stops communicating with device no 1 and never regains contact even when I unplug all the other devices. All the wires are pretty short so I wouldn't assume it is a capacitance issue. Maybe a power issue? I have a logic analyzer ordered, and I will see what that tells me about my levels. I am trying to get my hands on a scope as well to see if the parasitic capacitance is an issue. I wouldn't imagine it would be an issue with the power dropping, but I could be wrong I suppose. I am using USB power through a single Arduino, so idk, maybe that is the issue. 


   
Quote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

Just some thoughts to ponder,...

Posted by: @cawr2975

All the wires are pretty short so I wouldn't assume it is a capacitance issue.

It could still be a capacitance issue due to the breadboard itself.  Breadboards are notorious for adding capacitance to large circuits.  Especially if you are using one large breadboard for everything.

Posted by: @cawr2975

I am trying to get my hands on a scope as well to see if the parasitic capacitance is an issue

The DSO-138 Oscilloscope is a really nice scope for the price:

You can also buy it with an acrylic case for about twice the money:

Posted by: @cawr2975

I am using USB power through a single Arduino, so idk, maybe that is the issue. 

Yes, this too could be a problem.  You could simply be driving more devices than a single Arduino can handle.  So using an external power supply would be well worth trying.  Just make sure that power supply has enough power too.

It could be a combination of both power issues and capacitance issues.  There may be other issues too that I a unaware of. 

Posted by: @cawr2975

I have some 10k pullups from 5v to both sda and scl.

I've heard of issues with pullups as well.   Especially when using more than one set.   There are ways to use extra pull-ups closer to  each device but you need to take into consideration the total pull up resistance over all lines.    This is an issue I have only read about.  I have experience with any of the problems you've mentioned because I haven't personally connected up more than one 12c device at a time yet.

It could also be possible that you may need to use booster/buffers on the I2C lines as well.  Not because of long runs but because of having so many devices on the line.

These have all just been thoughts to ponder.   And it appears you have already considered all of these potential problems  yourself.  Get the scope.  It's cheap, and will give you a quick visual of what's going on.  Of course if you have the cash you can always buy a better one for sure.  But the DSO-138 is pretty nice if you don't want to invest a lot of money in a scope.  I have one and it's definitely nice to have around.  I've been able to see behaviors in my circuits that I could never see without a scope.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
ZukaZuka
(@cawr2975)
Member
Joined: 4 years ago
Posts: 2
Topic starter  

@robo-pi

Thanks for the advice! It turns out my capacitance was ok for now, and it was (most likely) a power issue. I think the usb cable essentially had enough current to turn all the arduinos on, but not enough for much else. Lines were dropping voltage and screwing with the signals from the clock lines (probably dropping them low for a few ms). I have a single arduino plugged into the usb on my computer, but everything else is hooked into a 9V 650 mA wall-wart. I know I have a wall-wart laying around with something like 13v at 2 amps, so that might be good to use when I hook more stuff into it, but for now it is working. I also have a 1uF decoupling capacitor (which I still don't understand the use for exactly, because I'm super new to all of this). 

I think I am probably going to buy that scope as well. It seems like a fun project, and I actually have access to a laser cutter and an array of 3D printers, so I'll probably make the case myself. 

I'd imagine I will have issues later on as well, since this is just a preliminary test of a hot-swappable game board, but for now I can at least get everything to talk to each other.

Later on, I am going to try to get each Arduino to control a 3x3 array of NeoPixels (WS2812b), so that will be yet another "fun" task to undertake with the current and voltage issues. I have been running the loop, looking at all the addresses, and where I previously only got a maximum of 4, I now get 11. The fun part is, I am going to try to run a total of 25 at once, so that will be some interesting troubleshooting. I think I am going to make a pcb for the power to limit the capacitance, and maybe look into some kind of shielding for the pcb as well, but that is another topic for more research. 

Nothing quite like picking up new technology and deciding to use it for a senior design project. Dunning-Kruger is cruel. 

 

Thanks again for the response!


   
ReplyQuote