Hi I am currently working on a data acquisition project where I have to get analog inputs (sensor values) and then show it on a screen via another program. But that is not the problem. I am already able to do that. However now I have to be able to read from 2 or x amount of arduino boards. The idea is for 1 arduino to be the main processor where it handles all the inputs from other arduino boards. I have searched online and i have found out I2C to be able to do this, but what i would like to know is whether there is better ways to do it?
I am using arduino UNO for now. The boards will just be side by side.
I2C can be very simple, if one unit can be regarded as the master and slaves send information or otherwise react only in answer to a request from the master.
I use this where I have an ATMEGA328P controlling a LED display, handling multiplexing, scrolling, dimming etc. as a slave to a clock application running on an ESP8266 which has only a few pins available, so it can't handle the display itself.
Grumpy_Mike:
Then why use two? There is seldom any point in using more than one Arduino in any project.
The idea is that I would like 1 Arduino board to be able to support up to X amount of inputs for this case, X amount of solar panels and wind turbine values to be displayed for future use. An example would be say 100 of each. Yes, I know that would take a lot of input ports but for now, will be working on say just a max of 3 boards just for working on.
Either way, thank you guys. Will work on using I2C.
Grumpy_Mike:
The point is that if you just want more I/O all you need is some port expander chips NOT another Arduino.
That is an option.
However I can see a lot of merit in having one master and multiple slave Arduinos with each slave having an identical program. It would make it very easy to extend the system at a small extra hardware cost.
If you go the port expander route, ensure that the port expander is suitable for your purpose, because not all give one to one replacements for arduino pins. For example, the popular PCF 8574 can only act as a low side driver so can't drive a common cathode LED display which, of course, an arduino can.
The biggest advantage of an port expander like the MCP23017 is that you can monitor up to 16 pins for a change without having to read them simply by looking at the interrupt pin.
I would hardly call the PCF 8574 popular it has limitations like you said, but it also has half the amount of I/O for three times the price. It is a very old chip design.
I cannot find anything wrong with a multi-controller approach and distributed processing. Every controller can be considered a port expander, with additional processing capabilities.
Well that is your problem not mine. There is a difference. The whole system performance is much less as a result.
And I2C is a multi-master bus, so that every node can send data whenever it requires attention, without being asked to do so.
And cope with bus conflicts? The system is greatly complicated. Have you tried using a multimaster I2C bus system. The throughput is severely restricted.
Anyway, I still stand by my opinion that using multiple Arduinos in most cases is a mistake, and this is one of them.