user61939: I am planning to build a network with five Arduino Mega devices, each of which will collect data using multiple sensors. Each Arduino will periodically transmit the sensor data to a gateway Raspberry Pi using XBees. As it is the first time I am working with Arduino and Raspberry Pi, I need help with the following:

Which protocol to use to transmit data from Arduinos to the Raspberry Pi? Do I have to write code for both Arduino and Raspberry Pi or are there existing solutions that I can use for this purpose? 
Does MQTT, Node-RED or Node.js have any role in the above? 

Thank you for your advice!
A.

user61939: 

Which protocol to use to transmit data from Arduinos to the Raspberry Pi? Do I have to write code for both Arduino and Raspberry Pi or are there existing solutions which I can use for this purpose? 
Does MQTT, Node-RED or Node.js have any role in the above? 


I have searched, explored, read and found that MQTT can be used to send and receive data from Arduinos to RaspberryPi as in [1] and [2]. So, no need to design and develop a new protocol.
MQTT libraries, such as PubSubClient [3] are available for Arduino. So Arduino code can use these libraries and no need to write much code either. 
Simple and straight!
A.
[1] https://funprojects.blog/2018/03/04/arduino-talking-mqtt-to-node-red/
[2] https://iotdesignpro.com/projects/interface-arduino-with-node-red-to-send-sensor-data-on-webpage
[3] https://www.arduinolibraries.info/libraries/pub-sub-client

61939: <p>I am planning to build a network with five Arduino Mega devices, each of which will collect data using multiple sensors. Each Arduino will periodically transmit the sensor data to a gateway Raspberry Pi using XBees. As it is the first time I am working with Arduino and Raspberry Pi, I need help with the following:</p>

<ol>
<li><p>Which protocol to use to transmit data from Arduinos to the Raspberry Pi? Do I have to write code for both Arduino and Raspberry Pi or are there existing solutions that I can use for this purpose? </p></li>
<li><p>Does MQTT, Node-RED or Node.js have any role in the above? </p></li>
</ol>

<p>Thank you for your advice!</p>

<p>A.</p>
 61939: <blockquote>
  <ol>
  <li><p>Which protocol to use to transmit data from Arduinos to the Raspberry Pi? Do I have to write code for both Arduino and Raspberry Pi or are there existing solutions which I can use for this purpose? </p></li>
  <li><p>Does MQTT, Node-RED or Node.js have any role in the above? </p></li>
  </ol>
</blockquote>

<p>I have searched, explored, read and found that MQTT can be used to send and receive data from Arduinos to RaspberryPi as in [1] and [2]. So, no need to design and develop a new protocol.</p>

<p>MQTT libraries, such as PubSubClient [3] are available for Arduino. So Arduino code can use these libraries and no need to write much code either. </p>

<p>Simple and straight!</p>

<p>A.</p>

<p>[1] <a href="https://funprojects.blog/2018/03/04/arduino-talking-mqtt-to-node-red/" rel="nofollow noreferrer">https://funprojects.blog/2018/03/04/arduino-talking-mqtt-to-node-red/</a></p>

<p>[2] <a href="https://iotdesignpro.com/projects/interface-arduino-with-node-red-to-send-sensor-data-on-webpage" rel="nofollow noreferrer">https://iotdesignpro.com/projects/interface-arduino-with-node-red-to-send-sensor-data-on-webpage</a></p>

<p>[3] <a href="https://www.arduinolibraries.info/libraries/pub-sub-client" rel="nofollow noreferrer">https://www.arduinolibraries.info/libraries/pub-sub-client</a></p>
