Sorry! It was posted before finished and i realized after creating a new topic... :
Follow at Best protocol intercom and layout for double nano board controller? - Networking, Protocols, and Devices - Arduino Forum
Hi there! I am developing a project for counting energy and wáter consuption in a scout camp, acting parallelly as a pump controller. I have these devices to connect to two identical arduino nanos:
- Water level sensor (2 analog)
- Flowmeter (1 interrupt, 1 digital)
- 2 Switches (2 digital)
- 1 encoder (2 interrupt, 1 digital)
- RealTime clock (I2C)
- 1 Relay (1 digital)
- LED display (I2C)
- Micro SD Card (SPI)
- Serial UART via USB to Smartphone console for debugging
- Interconnection between both nanos to send data
The functionality I want is the following:
As a controller, the system has to detect water level and enable/disable pump (relay) accordingly (already working on single nano), based in some noise reduction parameters saved on either EEPROM or SD.
The switches are to enable manual mode (overwrite water level and force on/off pump (already working on single nano)
I want to receive debugging info over USB (already working on single nano) from either arduinos
The LED screen is to display status, consumption and configure menu to change the parameters. The navigation is controlled by the encoder
I want any of the nanos to log water consumption to the sd card (preferrably as csv, in order to import data to Excel), every 5 minutes or so. Then, in one of them i have to plug the flowmeter.
As the display library is very heavy (on storage and also SRAM), I cannot handle everything with a single arduino (moreover, I have 3 interrupts to handle, with just 2 available on each nano). Therefore, I have to distribute all the peripherals between 2 arduinos, so I need a way to interconnect both to share data received from one to the other having SD/LED or whatever.
The only thing I have to share are bits, bytes and integers (I changed measurement units in order not to have floats).
Thus, I have two questions:
a) Which is the best interface I could use between the nanos?
If UART serial, then I would install another switch to bypass debug to USB. If I2C, which one should be the master? The one with the RT clock? Should't it be difficult to handle besides LED, SD and RTC connected to the same bus?
b) Which would be the best layout for all the peripherals?