A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By ProAce
#34438 Hey guys,

I'm hoping you can help me figure out how to make this project work. The idea is that we build a sensor glove which helds five bend sensors, an arduino nano and an ESP8266-01. On the other end we have an InMoov 3D Hand, five servo's, another arduino nano and another ESP8266-01. The set-up works flawless and the only problem we get is with the ESP's sending data to one another. We now do it on the way described in the code below:

Sender:
Code: Select all#include <SoftwareSerial.h>

#define DEBUG true
int bendsensor1 = A0;
int bendsensor2 = A1;
int val1=0;
int val2=0;
SoftwareSerial esp8266(2, 3);

void setup()
{
  Serial.begin(9600);
  esp8266.begin(115200);
  sendData("AT+RST\r\n", 2000, DEBUG);
  sendData("AT+CIOBAUD=9600\r\n", 2000, DEBUG);
  esp8266.begin(9600);
  sendData("AT+CWMODE=3\r\n", 2000, DEBUG);
  sendData("AT+CWJAP=\"test\",\"test\"\r\n", 2000, DEBUG);
  delay(15000);
  sendData("AT+CIPSTART=\"TCP\",\"192.168.10.10\",80\r\n", 2000, DEBUG);
}

void loop()
  val1=analogRead(bendsensor1);
  val2=analogRead(bendsensor2);

  sendData("AT+CIPSEND=3\r\n", 100, DEBUG);
  Serial.println(val1);
 
  sendData("AT+CIPSEND=1\r\n", 100, DEBUG);
  Serial.println(val2);
}


And the serial output would look like:
Code: Select allAT+CWMODE=3


OK
AT+CWJAP="test","test"

WIFI DISCONNECT
WIFI CONNECTED
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP

AT+CIPSTART="TCP","192.168.10.10",80


ERROR
CLOSED
AT+CIPSEND=3

link is not valid

ERROR
724
AT+CIPSEND=1

link is not valid

ERROR
0


Receiver:
Code: Select all#include <SoftwareSerial.h>

#define DEBUG true

SoftwareSerial esp8266(2, 3);

void setup()
{
  Serial.begin(9600);
  esp8266.begin(115200);
  sendData("AT+RST\r\n", 2000, DEBUG);
  sendData("AT+CIOBAUD=9600\r\n", 2000, DEBUG);
  esp8266.begin(9600);
  sendData("AT+CWMODE=3\r\n", 50, DEBUG);
  sendData("AT+CWSAP=\"test\",\"test\",1,0\r\n", 50, DEBUG);
  sendData("AT+CIPAP=\"192.168.10.10\"\r\n", 50, DEBUG);
  sendData("AT+CIPMUX=1\r\n", 50, DEBUG);
  sendData("AT+CIPSERVER=1,80\r\n", 50, DEBUG);
  sendData("AT+CIFSR\r\n", 50, DEBUG);
  sendData("+IPD", 50, DEBUG);
}

void loop()
{
}


And the serial output would look like:
Code: Select allAT+CWMODE=3


OK
AT+CWSAP="test","test",1,0


OK
AT+CIPAP="192.168.10.10"


OK
AT+CIPMUX=1


OK
AT+CIPSERVER=1,80


OK
AT+CIFSR

+CIFSR:APIP,"192.168.10.10"
+CIFSR:APMAC,bé&#8226;é¢Ò2Ñ:74:dc"
+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:f4:74:dc"

OK
+IPD


Does anyone see what the problem could be? Or does anyone know if there is another way to send this data? And how fast can I make this sending?