Multiple sensors, relay steering with two serial connected Arduino's

Hi Guys...

I have this project where there are some devices in my home which I want to monitor with sensors.
The readout of those sensors will be used to steer certain valves by using relay boards.
The steering is not an issue.
What is my difficulty, is that the sensors and relay boards are located at two locations at my home, about 15 meters apart.

So my intentions are to have a main Arduino Uno for the main control.
That Arduino should be connected to an Arduino Mega (because of the number of analogue ports for temperature- and maybe pressure-readings).
The communication needs to be serial.
The data, collected by both Arduino's are stored in the Uno.
The state of the relay ports connected to the Mega need to be stored/latched in that Mega.

So the status of the sensors connected to the Mega is send every x seconds, serially to the Uno and stored there.
The Uno will make decisions, based on those stored values and send back the correct port settings to the Mega.

I can manage those settings.
But sending values between those Arduino's is beyond my knowledge.
I have found a video on how to setup that line of communication, but I haven't got the time to dive into that, along with debugging etc. due to other occupations.

Is there someone who can help me out by creating the setup between the two Arduino's so I can build that project from there?
Of course I will pay for that.

If I'm not allowed to ask this questions, I apologize.
Also if this is the wrong section I apologize. It was hard to find the right section to start from.

Kind regards
FTMZ

As you are willing to pay for this your topic has been moved to a more appropriate category of the forum

1 Like

Serial comms is the easy part, you need to establish a protocol for sending and receiving values into variables to then get the “code” you have written to do something with those values. Also how are you transmitting the serial, are these devices actually wired to each other ? Are you using any sort of radio communications between them ?

I can help you with all of these if you like. DM me and we can chat.

Cheers Pete.

Over longer distances, it's advisable to use RS485 or RS422. Using RS485 has the advantage that you only need one serial connection on the Uno.

With RS485, I would let the Uno poll the Megas.

Take a look at CAN (Controlled Area Network), it is a very robust multi master system with a lot of error checking etc built into its hardware and protocol. You can add nodes at any time without changing the existing nodes. You can run the bus several thousand feet without problems. Nice part the controler chips take care of all the priorities etc so no software for you.

Thanks for the reply so far, guys.

I was very much intrigued by this video which seems to be doing what I had in mind.
#106 RS485 Serial Data Transmission - on wires (no radio waves) (youtube.com)

Like Sterretje mentioned, it is using the RS485 protocol, which is very robust. (mijn dank daarvoor)

Everything controlled by the Uno.
I'm likely having trouble getting my head around the communications.
It has to send every x seconds the status of the relays to the Mega, and receive the stored (and previously measured) values of the sensors.
If that retrieved data can be placed in a memory position of the Uno, I can pick those values to use for further purposes, which in return decide which relays should be On or Off.
That status needs to be send back by the Uno to the Mega.
(Maybe to be stored in case of a missed data signal to be adjusted later, but eventually setting that relay port.)

If I had the time I would learn how to set up that communication but I have a lot going on lately with work, educational study and family.
So if one can help my with that part of the project, I would be grateful. :slight_smile:

@zwieblum

Wrong topic? Looks like you replied to alizbeth

Argh! How did that end up here???

I don't know, but the alizbeth account is permanently suspended for posting spam

Guys, I received some mails concerning my budget for this code.
It was done already and ready for testing.:heart:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.