0

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:

  1. 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?

  2. Does MQTT, Node-RED or Node.js have any role in the above?

Thank you for your advice!

A.

7
  • this looks like a repeat of your previous question ..arduino.stackexchange.com/questions/71291/…
    – jsotola
    Commented Jan 4, 2020 at 19:47
  • @jsotola Yes, but I tried to be more focused this time. I hope I have been successful.
    – Adnan Ali
    Commented Jan 4, 2020 at 19:50
  • I have not bought the equipment yet. Before doing this, I would like to know the technologies involved and level of depth I would need to go into this. I think it should be straight forward for people who have experience with Arduino and Raspberry Pi to come with some good advice. Thank you for the edit.
    – Adnan Ali
    Commented Jan 4, 2020 at 19:59
  • MQTT messages are usually set over internet connections. RaspberryPi boards have this type of interface. Most Arduinos need to have extra hardware. An MQTT broker can receive and send out messages. If you want to do something with the messages between the sender and receiver NodeRED is a good choice. You will likely want to run the MQTT broker (probably mosquitto) and NodeRED on the RaspberryPi. Let me know if this is what you are looking for and I'll flesh out the particulars and post an answer to your question.
    – st2000
    Commented Jan 4, 2020 at 22:13
  • BTW, I don't know different your original post is, but consider making a question better before resorting to making another post. The point of most if not all of the stackexchange web sites are to have a bunch of good searchable questions.
    – st2000
    Commented Jan 4, 2020 at 22:17

1 Answer 1

1
  1. 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?

  2. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.