Multi device planning

Hey there -

Using 4 to 5 arduino devices in this project, which is sort of up in the air - been evaluating different boards and protyping different circuits that they'd manage, web server REST calls, 12V circuits they'll integrate with, sensors they tap into and finally - communications between them. IMO the latter has been the biggest challenge in my testing. Time suck.

My need is to have one master device that handles the logic, routes the communications down to the slaves with directives for them to follow, and makes server calls for data insights that the servers have compiled for them to disseminate to the slaves.

Each of the slaves have different functions that they manage with their sensors. So I need to establish unique identities for each of the arduino devices, chiefly so that the master knows what address to send data to respectively. The slaves will need to know their role once they're plugged into the bus, given an address and UUID, and then retain it.

I2C has been the assumed backbone for the communications. Tests have been with 3 devices and the results are spotty, sometimes slaves don't respond, but ATM I'm assuming that's on me to figure out, not the devices. Unless there are some known gotchas that I don't know of yet. The data I'll pass back and forth is probably about 150 bytes, I can masage that as needbe. If it was JSON I would be thrilled, but don't see that's the most prudent choice.

I have an RTC device, a couple displays (would love to stick with I2C, but one might be a feather backpack which is SPI), a couple I2C temp sensors, 3 other sensors which are just RTD on digital ports. Is this the start of address hell?

This master will make HTTP posts, process the response to actions and then disseminate themto the slaves. The slaves will report back with current results - anywhere from every 5 seconds, to every 10 - 20 if that's going to work better. Processing that much on the other end will be a big enough challenge.

I'm primarily worried about the bandwidth with 3 devices chatting almost constantly. Have looked at Sofware serial as an option, maybe some other mechanism for a communications channel / protocol exsits I don't know about?

I can either store the identity and some profile data they'll have associated with their identity, in EEPROM of each device and the master with a lookup table of sorts. OR I can use an SD device to store that data, and all data, I picked up an adalogger this weekend to play with. Should I stick with EEPROM and not go down a rabbit hole with the SD?

So basically I'm wondering if you have thoughts about the approach to I2C, EEPROM and anything else that comes to your bigger brains. Any holes you can poke in my logic / approach would be awesome!

ESP-NOW. I have not tried it yet: https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/.
There is a catch, the Wifi might work together with ESP-NOW when they use the same channel, but it might not work together.

For new users, the maximum length for the I2C bus is 50cm.

When running SoftwareSerial on a AVR board (Arduino Uno/Mega/Nano/Leonardo) then the SoftwareSerial takes over the Arduino and there is not much else that you can do.

The EEPROM is very handy to store an identifier in. A microSD card can be used for storing a lot of data or logs that needs to be read on a computer.

When there is a conflict on the I2C bus, then there are solutions.

What is a RTD on a digital port ? Do you mean Adafruit RTD modules with SPI interface ?

When using the Adafruit Feather, then you are stuck with Adafruit for support. They often have there own bootloader. The official Arduino boards will be supported for many years.

Koepel:
For new users, the maximum length for the I2C bus is 50cm.

I would expect to get a lot more than that. This MegaPoints YouTube video shows it working over 100m of cable. The MegaPoints boards are using Atmega microprocessors.

robschaap:
Using 4 to 5 arduino devices in this project,

It would be a big help if you can explain the need for multiple devices and the specific roles that they will play.

And it would be a good idea to provide examples of the messages that need to be transmitted between them and how often they need to be transmitted. IMHO you must design that part of your system before anything else.

...R

Koepel:
ESP-NOW. I have not tried it yet: Getting Started with ESP-NOW (ESP32 with Arduino IDE) | Random Nerd Tutorials.
There is a catch, the Wifi might work together with ESP-NOW when they use the same channel, but it might not work together.

This looks like what I had thought of at first, something like a series of HTTP posts back and forth between devices, but I'd be limited to IOT capable boards and I was worried about speed. This on other hand appears to be great, but tied to ESP32?

Koepel:
When running SoftwareSerial on a AVR board (Arduino Uno/Mega/Nano/Leonardo) then the SoftwareSerial takes over the Arduino and there is not much else that you can do.

Takes over?

Koepel:
The EEPROM is very handy to store an identifier in. A microSD card can be used for storing a lot of data or logs that needs to be read on a computer.

K, will keep pursuing EEPROM / counting bytes till it proves to be inadequate. Probably will be fine.

Koepel:
When there is a conflict on the I2C bus, then there are solutions.

I played with I2C address scanner this AM that seems to be super helpful conflict wise, so comfortable that I can eliminate that sort of challenge. But I can't find out if that address I assign a board manually in a sketch will "stick" once power's recycled. I say you're at "0x38" will it stay there till I tell it otherwise months later? And also, the speed concerns.. is that warranted? I can tweak the packages being spent however I want at this point in planning. It'll just be baked into the limitations of the application up front ("sorry I can only update every 10 seconds").

Koepel:
What is a RTD on a digital port ? Do you mean Adafruit RTD modules with SPI interface ?

DHT11 sensors, forgot we moved away from the film thermistors (RTD's).

Koepel:
When using the Adafruit Feather, then you are stuck with Adafruit for support. They often have there own bootloader. The official Arduino boards will be supported for many years.

Isn't that better than staring at some Elegoo or Waveshare device that's a copy of it?

Robin2:
I would expect to get a lot more than that. This MegaPoints YouTube video shows it working over 100m of cable. The MegaPoints boards are using Atmega microprocessors.
It would be a big help if you can explain the need for multiple devices and the specific roles that they will play.

And it would be a good idea to provide examples of the messages that need to be transmitted between them and how often they need to be transmitted. IMHO you must design that part of your system before anything else.

...R

Yeah, that was my thinking too. Not doing anything else till I can get 5 devices and a webserver chirping together in harmony with some data package that's larger than I need it to be, fipping power on and off, server sending exceptions back to them, etc. And THEN I connect the 12V circuit for smoke and fireworks (kidding).

Ideal message (just for clarity):

master says: "hey slave at 0x30, give me an update, pronto!"

slave says:

{"zone": 1,
{
"speed": 52000,
"temp: 28.5,
}
}

master says:

{"action":
{
"floor": 25,
"ceiling": 29,
"duty": 50
}
}

Realistically I figured they'd look more like this, unfortunately:

1:5200,28.5
action: 25,29,50

Which will be a ton of fun to debug.

Koepel:
ESP-NOW. I have not tried it yet: Getting Started with ESP-NOW (ESP32 with Arduino IDE) | Random Nerd Tutorials.
There is a catch, the Wifi might work together with ESP-NOW when they use the same channel, but it might not work together.

Thanks for the link, going to pick up a couple of these since they're cheap as hell - won't cry if I fry them. I will give it a go, see if I can connect with my Feather ESP8266 which I have a nice LCD for.

robschaap:
Realistically I figured they'd look more like this, unfortunately:

1:5200,28.5
action: 25,29,50

Which will be a ton of fun to debug.

That does seem realistic, but I don't see why there would be a debugging problem. But don't send "action" just send 'A' and I think you will make things easier for yourself if you only use one delimiter - perhaps the comma.

However you have not said why there needs to be multiple Arduinos or how often those messages need to be transmitted.

By the way, ESP-NOW probably could be used to send HTTP messages but that is not essential. It is just a simple system to send data from one ESP to another. I considered using ESP-NOW as an alternative to using nRF24L01+ transceivers.

...R

Why multiple devices?

I can't go into it too far without violating NDA's - but it's related to the modularity of the product. Each one is a distinct unit that has autonomous control over itself, plug it in and it governs itself - to some degree since there is supposed to be a master unit which will give guidance, shared learnings from other modules basically so they can adjust their behavior. Something akin to "hey, I know that by default you think you should be at 50% capacity right now, but given what we've learned now, you should be at 60% instead. So make that your new baseline." This is sort of how a smart home operates I assume (I don't have one.) They'll be in different locations, maybe feet apart from each other with a shared cable that would provide power (and communications back and forth). Ideally, no USB connections at all, don't want software occupying CPU cycles or relying on the user to do anything. Wifi connection would be the exception, in essence, it'd operate in the background much as a Nest thermostat would. "Hey, I need power and your SSID / WEP. Great, now bugger off. If you want to adjust the temperature, ok, I'll let you do that, and you can watch what I'm doing with my current schedule and temperatures from your phone or browser, but I'm telling you - let me handle it".

Behind the scenes there is a some heavy data ML churning to monitor, and adjust curves.

This isn't under development yet, this is planning, proof of concept, prototyping the different technical aspects in a white box to understand what the challenges are going to be and how to shift the plan accordingly.

Surprisingly, integrating 5v or 3v boards in Arduino circuits with disparate 12v circuits, handling PWM and analog signals hasn't been a challenge at all. Like a day or 2 to white box. The challenge so far has been getting multiple Arduinos to behave together on I2C. I'm going to look at the ESP NOW option though dealing with cheap, drop-shipped from China devices with Youtube experts spooks me. There are Adafruit ESP8266 boards so we could conceivably use them I suppose.

robschaap:
Why multiple devices?

I can't go into it too far without violating NDA's -

That suggests strongly to me that you are looking for free advice so you can enhance your profit from a commercial product at our expense.

If so, that does not seem fair.

...R

To be clear, I've seen many of your posts, and I appreciate your time.

Saying I have an NDA - is my roundabout way of saying I don't want to divulge what my idea is specifically because I'm personally connected to it for two years. I don't want it to be ridiculed by experts here (nor do I selfishly want see parts of my idea for sale one day). I'm a software engineer/consultant who has post-pandemic time. For now, this project is an obsession/hobby and I'm trying to enlist other friends to get into as well. One person I did involve is a lawyer by trade, hence the "NDA".

If I've offended you, I don't know how, but I'm sorry. I work freelance so I've gotten my share of "hey - can you tell me how to do ..... (for free)" (and it sucks). I think asking about I2C viability under high load is a general question, not intellectual property - and I elaborated only when you asked again.

Since I've joined the forum 2 days ago, I've tried to contribute what I can to other posters and would like to continue to do so.

Robin2:
By the way, ESP-NOW probably could be used to send HTTP messages but that is not essential. It is just a simple system to send data from one ESP to another. I considered using ESP-NOW as an alternative to using nRF24L01+ transceivers.

thanks for sharing this, what you said about the documentation being "confusing" is spot on, this is a great starter.

robschaap:
Saying I have an NDA - is my roundabout way of saying I don't want to divulge what my idea is specifically because I'm personally connected to it for two years. I don't want it to be ridiculed by experts here (nor do I selfishly want see parts of my idea for sale one day).

I'm certainly not offended. Why not make it an Open Source project?

...R