Tuesday 6 June 2017

Two way communication (WiFi) between Arduino Uno WiFi and Rapsberry Pi

I'm trying to connect an Arduino Uno WiFi to my router. This works if I connect with it and go to the web panel. If I try to connect via code I get a status 4, which means the connection failed.

// attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

Though I'm not connected via code (but on the web panel) it still works to do a rest call. Calling the API takes about 10 to 15 seconds which is too long for the application I'm developing.

The problem is that I need two-way communication over a distance that Bluetooth doesn't work. So I want two-way communication over WiFi. It should be reliable and quick (>=10seconds). My first thought was socket communication from the Arduino to the Raspberry Pi (node.js) but I haven't found any helpfull info about this.

What would be my best option, socket communication or something else and how can I implement it with the Arduino Uno WiFi and a Raspberry Pi (node.js)?

Thanks in advance



via Gillis Werrebrouck

No comments:

Post a Comment