Notifications
Clear all

Pico to Pico Communication via I2C

4 Posts
3 Users
5 Likes
545 Views
THRandell
(@thrandell)
Brain Donor
Joined: 3 years ago
Posts: 217
Topic starter  

I thought that I would pass on some of the research that I’ve done on setting up two Pico MCUs to communicate with each other via I2C.  

My use case is that I want to create a Pico based robot sensor that can communicate its findings with another Pico that will be controlling the behavior of the robot.

First off I found that the Pico C/ C++ SDK only has example code to set up a Pico as a master node and that the team that maintains the SDK would get around to adding a I2C slave node implementation as time permitted.  Ouch.  With a little digging I found the generous contribution of Valentin Milea on GitHub.   His example code runs both the master and the slave nodes on a single Pico.  After I got that running and reviewed all his code, I wired up two Picos, split his code into the bit that runs that master node and the bit that runs the slave node and I’m off to the races…  I can post the programs if anyone wants to see it.

 

Here are some useful links for anyone interested.

https://github.com/vmilea/pico_i2c_slave

https://www.analog.com/en/technical-articles/i2c-primer-what-is-i2c-part-1.html

 

Tom

To err is human.
To really foul up, use a computer.


   
Quote
Topic Tags
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6489
 

@thrandell  Great information Tom, thanks.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1111
 

If its just 2 pico communicating with each other and alternative that may be worth considering is just to use simple serial UART comms.  Search for 'Hello from Northumberland' on this forum for an example, but it was a python example so may not be of interest to many.


   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 3 years ago
Posts: 217
Topic starter  

To err is human.
To really foul up, use a computer.


   
rommudoh and Lee G reacted
ReplyQuote