Five parts are connected using i2c protocol !!!

Hi, I want to build a project that it needs two boards of Arduino UNO, one nodemcu for wifi connection, ds3231 for time and an LCD to display, I want to connect all this part using the i2c protocol and the three board will be set as master, for that I want to know if there is any problem in that and also if the circuit is correct or I need add a pull up resistor?

Fugetaboutit. Multiple cpu’s is a really, really bad idea.

Mega + esp8266-01 for the WiFi. Add the two I2C slaves. Done.

WattsThat:
Fugetaboutit. Multiple cpu’s is a really, really bad idea.

Mega + esp8266-01 for the WiFi. Add the two I2C slaves. Done.

My project will be a coffee maker, I want to put the nodemcu to receive commands from the phone and one the board of Arduino uno for directly command and LCD control and the last Arduino UNO for the preparation control (Motors, hot water pumps, ..) . The communication will not be arbitrary.

One Uno can easily handle the LCD, motors, pumps. Probably easiest to get a motor driver shield is the motors and pumps take a higher voltage

blh64:
One Uno can easily handle the LCD, motors, pumps. Probably easiest to get a motor driver shield is the motors and pumps take a higher voltage

Of course, Sir I will use a driver shield :slight_smile: , I can't use just one arduino uno because i will use more the 20 pins, I want to use the i2c protocol to separate roles between cards, one to control what we see (LCD, Leds, directly command...) and the other is for parts inside the machine (4 stepper motors and 2 DC motors...) . I think the code will be complicated if I use all that in one board, this project have the same idea https://www.instructables.com/id/Home-Automation-Using-Arduino-With-Wifi-Bluetooth-/

what do you think, Sir, is better to use two Arduino UNO with i2c protocol or an Arduino Mega?

If you need more pins, look at a port expander. Putting multiple CPUs in the mix will make it much harder to debug.

Also, even if your Uno code is long, you should still be able to structure it in a way that it's easy to comprehend and test.

So is better to use an Arduino Mega, I want just to know please if I use the protocol i2c it will work normally and if the circuit is correct or I need to add a pull up resistor?

You can only have one master on an I2C bus!. Yes you MUST use the pullup resistors. And you only need an UNO not a mega!

Mark

holmes4:
You can only have one master on an I2C bus!. Yes you MUST use the pullup resistors. And you only need an UNO not a mega!

Mark

1 - Sir, we can use multiple master on an i2c bus , like here,there are two master board

2 - If I add a pullup resistor, Is it has an effect on the ds3231 card because it has also an internal pullup resistors?
3 - Of course I will use just the Arduino UNO board, but if I want to remove the i2c connection I will use just one Arduino Mega

The NodeMCU can do everything for you.

There are really few cases where a multi-processor setup makes sense. This is not one of them. Get rid of the Arduinos; keep the NodeMCU; get a port extender or two (the MCP23017 has 16 GPIO, and a single I2C bus can handle 8 of those - plenty of pins) and start building.

As you have a WiFi connection you can also ditch the RTC and just grab the current time over NTP. More accurate than an RTC.

I'm going this circuit is much better than two Arduino UNO


, as you see, I added an HC05 because the wifi connection is not guaranteed for that used the ds3231 to get time, I can not use the MCP23017 because I have never worked with it and I would like to use this project as a final year project :slight_smile: and I have no time to test it.
Thanks

Using an MCP23017 is really much easier than an Arduino Mega.

For starters you don't need to do any real programming. After you declared the object (there are some good libraries out there, a.o. Adafruit has one) as say mcp you just use commands like this:

mcp.digitalRead(pinNr);
mcp.digitalWrite(pinNr);
mcp.enablePullup(pinNr, true);

Almost as if you're reading the pins directly. Really much easier than trying to communicate between two microcontrollers, and writing and maintaining two sketches.

aymannox:
1 - Sir, we can use multiple master on an i2c bus , like here,there are two master board

If you say so. Just let us know how they did it and how well you get it to work.

Or how about an ESP32? Could be the superior choice as you're throwing Bluetooth in the mix.

Lots of pins (30-something I recall), built-in Bluetooth (so no need for the HC-05) and built-in RTC (not sure on how the power backup works in that case).

Do note that the HC-05 is a quite old device, it doesn't work with iPhones, for example. Use the HC-02, HC-08 or HC-42 if you need to connect to an iPhone. Or an ESP32, or other Bluetooth adapter. There are many.

adwsystems:
If you say so. Just let us know how they did it and how well you get it to work.

I have heard about this before. It's supposedly possible, don't know if it's part of the specs, though. The trick going to be to keep the masters waiting for each other or you have collision.

wvmarle:
Or how about an ESP32? Could be the superior choice as you're throwing Bluetooth in the mix.

Lots of pins (30-something I recall), built-in Bluetooth (so no need for the HC-05) and built-in RTC (not sure on how the power backup works in that case).

Do note that the HC-05 is a quite old device, it doesn't work with iPhones, for example. Use the HC-02, HC-08 or HC-42 if you need to connect to an iPhone. Or an ESP32, or other Bluetooth adapter. There are many.

Unfortunately, I can't replace it now :(, because I need to buy it from ebay and wait 15 days to receive it and like I have told this is a final year project so I haven't time.

adwsystems:
If you say so. Just let us know how they did it and how well you get it to work.

I have seen a lot of examples in internet like this : michael.bouvy.net/blog/en/2013/05/25/arduino-multi-master-to-master-i2c/

aymannox:
I have seen a lot of examples in internet like this : michael.bouvy.net/blog/en/2013/05/25/arduino-multi-master-to-master-i2c/

I see two masters (sort of). What I actually see are two arduinos independently transmitting via TX lines point-to-point. There is no multi-drop and no slaves. Let's see what you come up with for your project. As I cannot see how to adapt that example to include even a single slave.

If I add a pullup resistor in the last circuit, Is it has an effect on the ds3231 ,because it has also an internal pullup resistors?