1

In my situation, I have a map divided into multiple parts, each part could have about 20 to 100 Arduinos that they should send information from time to time to the master. How could I do this?

Second problem. How could I use the other Arduinos to send the info from Arduino that are so far from the Master?

Example in part 1: Arduino X is 500 meters far away from the master. How could use the other to send the information?

Can I do this with NodeMcu or such equipment with built-in WiFi?

1
  • esp8266 arduino boards package supports WiFi mesh
    – Juraj
    Commented Mar 16, 2019 at 5:19

3 Answers 3

1

I think you should start with using Wifi modules and you use an esp-01 too instead of NodeMCU. Once you are familiar with esp-01's, you will find them as good as NodeMCU. Esp-01's only lack multiple pins when compared to NodeMCU.

And for communication between arduino and esp-01, use serial ports- 0 and 1.

Here is example code- For Master Arduino

int temp;
int hum;

void setup(){
 Serial.begin(115200);
 delay(2000);
}
void loop() {

 temp = random(0,100);
 hum = random(100,200); 
 Serial.print(temp);
 Serial.println('t');
 delay(2000);
 Serial.print(hum);
 Serial.println('h');
 delay(2000);
 Serial.flush();
}

For Slave Esp or any other slave arduino -

String inString = "";    // string to hold input

float temp = 0,hum = 0;

boolean newtemp=false, newhum=false;

void setup() {
  Serial.begin(115200);
  Serial.println("ESP 8266 - 01 Module is ready to receive codes from Master Arduino");
 }

void loop() {
  // Read serial input:
  while (Serial.available() > 0) {
    int inChar = Serial.read();

    if (inChar != '\n') { 

      if (inChar == 't')
      newtemp = true;

      if (inChar == 'h')
      newhum = true;

      inString += (char)inChar;
    }
    else {
      Serial.print("Input string: ");
      Serial.println(inString);
      if ( newtemp == true ) {
      temp = inString.toFloat();
      Serial.print("Received Temperature:");
      Serial.println(temp);   
      newtemp = false;
      }
      if ( newhum == true ) {
      hum = inString.toFloat();
      Serial.print("Received Humidity:");
      Serial.println(hum);
      newhum = false;   
      }  
      inString = "";
    }
  }
}

Pin connections -

Master Arduino TX -- Slave board RX

1

This is a classical application for LoRa technology, not WiFi. Designing a LoRa mesh is no simple task, though.

Check this post, or this other post

0

You could use low radio frequency modules to get to the 500m. For example there are the so called xbee modules (XBee Pro 60mW PCB Antenna - Series 1). You can find cheaper ones, but from my experience they are a bit harder to understand and not reliable.

You can make a TCP-like connection, where before data is send, the "slave" asks the "master" whether he can catch data or not. If not, he'll just keep asking after a delay has passed till he gets through. Even though TCP is mostly used in WiFi 2.4G, you could still apply it to your project

If you want to use WiFi than you can make a connection between the "slave" and "master" by having some middle man chips in between that pass on the data, but you would need the middle man chips to be constantly powered on (or use a RTC to time the "wake time").

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.