Can I use two ESP8266 on one Arduino Uno+Xbee S2C to sending sensor data to Thingspeak | ESP8266 Wi-Fi Module | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Can I use two ESP8266 on one Arduino Uno+Xbee S2C to sending sensor data to Thingspeak
Avatar
valenciaa
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
December 8, 2017 - 9:51 am
sp_Permalink sp_Print sp_EditHistory

hi all,

I use 4 XBee for temperature monitoring using cluster tree. Two XBee+Arduino as end devices so they send temperature data (I use LM35) to another XBee+Arduino as router, and then the router send the receive data from two end devices to the last XBee+Arduino as coordinator (2 end devices -> 1 router -> 1 coordinator). So, can I use two ESP8266 for sending the temperature data on one coordinator to separate them as Field1 and Field2? Or there is another way to show them to Thingspeak?

So far, I can show the data to Thingspeak from 1 end device although the data is not correct but it can connect to Thingspeak (1 end device -> 1 router -> 1 coordinator).

I'm new to this and not really good in english so sorry if i made some mistakes. Thankyou so much Laugh

the Arduino code:

//for end device 1
int temp;
int tempPin = 0;

void setup()
{
Serial.begin(115200);
}

void loop()
{
temp = analogRead(tempPin);
temp = (temp * 0.48820125);
Serial.print(temp);
delay(3000);
}

--------------------------------------------------------------------

//for router

int incomingByte=0;

void setup() {
Serial.begin(115200);
}

void loop() {
while(Serial.available()>0){
incomingByte = Serial.read();
Serial.print(incomingByte);
}
}

--------------------------------------------------------------------

//for server

#include <SoftwareSerial.h>
#include <stdlib.h>
int incomingByte = 0;
String apiKey = "X4QOYQUT5ZN1OZ58";
SoftwareSerial ser(10,11);

void setup() {
Serial.begin(115200);
ser.begin(115200);
}

void loop() {
while (Serial.available() > 0) {
incomingByte = Serial.read();
char buf[16];
String strtemp = dtostrf(incomingByte,5,1,buf);
Serial.print(strtemp);

String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += "184.106.153.149"; // api.thingspeak.com
cmd += "\",80";
ser.println(cmd);

if(ser.find("Error")){
Serial.println("AT+CIPSTART error");
return;
}

String getStr = "GET /update?api_key=";
getStr += apiKey;
getStr += "&field1=";
getStr += String(strtemp);
getStr += "

";

cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
ser.println(cmd);

if(ser.find(">")){
ser.print(getStr);
}
else{
ser.println("AT+CIPCLOSE");
Serial.println("AT+CIPCLOSE");
}

}
}

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

dannymm1

KamorkasOr

GRV2903

Jusikaclaiz

Raymondpoers

ScottDus

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee