Hello, all .
i am using 3 arduino, 2 slave and 1 master, i want to send data from slave to master using serial software. and I want to combine the data (sensor data) from the two slaves to the master and it will be sent to the serial monitor. by using a string to find out which data is from slave 1 and slave 2. does anyone know the program?
I doubt there is a specific program that does exactly what you want to do, its more likely to be a case of you adapting known techniques to your requirements, some ideas here;
that master could simply send string with sub-strings from each uno separate by a comma. the receiver separates the sub-strings at the commas and processes them
of course the information could be sent in a binary packet of information with fixed format, a separate field for information from each uno
or the master could forward information from each uno in a unique packet with an identified field indication from which uno the data is from
I am not sure why you are using the terms "Master" and "Slave". These terms are usually applied to the control mechanism of a system. In a M/s system, the Master (or primary device) sends control commands or correction to the slaves (or secondary device). In a M/s system, the Master would command one slave to Tx and record the response, then command the next, and so on. A M/s system could handle two slaves attached to the same Rx pin, because it would have the mechanism to not only distinguish which is speaking, but also to silence any or all slaves.
The system you are describing is multi-point to point communication, or aggregating. In an aggregating system, it must poll muntiple channels and have a method to buffer and aggregate messages into a single thread.
This code, you must write ultimately, or commission someone to write it for you.
i think he is.
i built a system with multiple arduino's that communicated with a PC. the slave arduinos communicated with the master arduino and the master arduino communicated with the PC.
the system can run w/o the PC
yes the communication between arduinos and PC was different
My tutorial on Arduino to Arduino/PC
has circuit diagrams and code examples for Arduino to Arduino using Software Serial.
The message format is simply a line of text.
@gcjr suggestion of a substring header comma data is a good one.
My tutorial uses SafeStrings so you have an extensive range of text manipulation and parsing methods available to handle the data at each end.
Not sure how well running two Software Serial connections on the Receiver at the same time will go. So suggest you chain the Unos,
Sender 1 (Serial) -> Sender 2 (Software Serial)
Sender 2 combines messages and (using Serial) -> Receiver (using Software Serial)
At Sender 2 you don't need to actually change/combine the messages you can just send alternately Sender 1 msg and Sender 2 msg to the Receiver and use a header say 1, or 2, so the Receiver can identify which is which
One of the advantages of my code is that send/receive are synchronized so it works well with Software Serial. Also if messages < 60 chars, it is very tolerant of long delays in the sender or receiver. Longer messages are not a problem if your loop code is fast enough the prevent the RX buffer overflowing or if you add extra buffering (see Arduino Serial I/O for the Real World )
Which Arduinos?
atmega2560
why do I want to combine two data from 2 Arduino because I want an Arduino that receives data to send to the hmi monitor
Hence the suggestion to combine the data in the second arduino before sending to final Arduino for sending
Hello,
what hardware do you use for ISO-Layer 1.
Thank you. I have great advice from you
what is iso-layer 1
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.