Electrical – How to make communication between microcontrollers

arduinocommunicationmicrocontrollerstm32

I want to make a project where it is necessary to communicate between several microcontrollers in the fastest way possible.

For that matter I have 10 micro-controllers whose names will be 1 … 10:

I want 1 to receive a number as input (input from user), and send it to 2.
2 will receive the number and will add 10 to it, and send the results to 3.
And so each will add a number and send the results to the next micro-controller until it reaches 10.

10 will output the final output (the output should be the number 1 received as input + all the numbers that the other processors in the chain added).

I am looking to buy STM32F103C8 (blue pill) because they look both cheaper and also stronger (and they looked more supported) than Arduino (although I am open to suggestions for other micro-controllers including claims in favor of Arduino).

Now my question is how I connect the micro-controllers I have selected (or the suggested micro controllers) to each other in the fastest and most efficient way.

I'm not looking for suggestions like: add an Ethernet/Bluetooth module and communicate with it between the micro-controllers.

I'm looking for an explanation of how to connect them using a serial or I2C connection or something like that (and I would be happy if you could add a detailed guide on how exactly to do it, which legs to attach to etc., since I'm still relatively new at working with micro-controllers)

Thank you.

Best Answer

The best way depends on exactly how much data do this microcontrollers have to communicate among them, the distances the signals have to travel, the place where this communication will take place, the amount of pins/wires you're willing to use to wire everything up, the cost of the system as regards your programming time and the hardware cost. For instance CAN bus allows for communication in noisy/industrial/automotive environments but is hard to implement and can't transfer data as fast as usb 3.0 does.

If I were you, and didn't have any stringent requirements for protocol implementation, I would consider the points I mentioned and end up with the easiest option as long as community support and hardware is concerned. Search for an easy to follow and comprehensive tutorial of a protocol readily available on the boards you're considering. Each protocol has it's pros and cons so it's not as if you would be better off learning how to implement one in particular.

As regards selecting one microcontroller, you seem to be looking for a readily assembled board. There's a huge selection to chose from, and many times the right board selection boils down to other capabilities than just having a communication protocol hardware built-in. The blue-pill board you're mentioning seems to be kind of the Arduino Due "equivalent" in terms of specs, check which board suits your needs best.