POSTing from Arduino via XBee Wifi on SoftwareSerial | Arduino | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
POSTing from Arduino via XBee Wifi on SoftwareSerial
No permission to create posts
July 16, 2015
9:51 pm
Avatar
Campbell St
New Member
Members
Forum Posts: 2
Member Since:
July 16, 2015
sp_UserOfflineSmall Offline

Hello everyone.

Like many people I've made a distributed sensor network via XB Series 2 modules, sending back to a central base unit Arduino, and now want to send this data to Thingspeak.

The base station Arduino has an XBee Wifi module running through SoftwareSerial.
The XBee is configured with the appropriate SSID, passphrase, destination ip 184.106.153.149 for thingspeak, port 80, via XCTU.

I can't successfully post the update string suggested on the Data Import/Export tab:

https://api.thingspeak.com/update?key=xxxMY KEYxxx&field1=0

After days and hours of futile searching and different attempts, I haven't found anyone addressing this scenario. I thought this setup would be quite common. I came to believe this would be the easy bit.

I can paste that update string into the address bar of my browser, and the relevant feed updates - but nothing happens when I send the same text through the XBee Wifi.

What is the format for the arduino code?

This is what I've tried:

WiFiSerial.print("https://api.thingspeak.com/update?key=xxxxxxxxxxx&field1=0")
WiFiSerial.print("POST https://api.thingspeak.com/update?key=xxxxxxxxxxx&field1=0")
WiFiSerial.print("GET https://api.thingspeak.com/update?key=xxxxxxxxxxx&field1=0")
WiFiSerial.print("POST /https://api.thingspeak.com/update?key=xxxxxxxxxxx&field1=0")
WiFiSerial.print("GET /https://api.thingspeak.com/update?key=xxxxxxxxxxx&field1=0")

I'm obviously missing something fundamental.

Thanks in advance.

Andy.

July 17, 2015
8:39 am
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

Try using http instead of https. I think the Arduino may have problems with TLS.

lee

July 18, 2015
8:28 am
Avatar
Campbell St
New Member
Members
Forum Posts: 2
Member Since:
July 16, 2015
sp_UserOfflineSmall Offline

Thanks Lee for the prompt attention.

I had already tried that, and have done so again, to no avail.

I also tried the broken down request, vis.

WiFiSerial.print("POST /update HTTP/1.1
");
WiFiSerial.print("Host: api.thingspeak.com
");
WiFiSerial.print("Connection: close
");
WiFiSerial.print("X-THINGSPEAKAPIKEY: xxxxxxxxxxxxxxx
");
WiFiSerial.print("Content-Type: application/x-www-form-urlencoded
");
WiFiSerial.print("Content-Length: ");
WiFiSerial.print(tsData.length());
WiFiSerial.print("

");
WiFiSerial.print(tsData);

Am going through the XB WiFi documentation again, looking for nuggets.

I have the module in AT transparent mode. Perhaps API will be better... Perhaps via SPI rather than serial..... I'll keep trying.

I'm still surprised by the total absence of this as a live topic anywhere. Doesn't anyone else want to get online with a WiFi XBee?

Thanks again.

Andy.

October 14, 2015
1:28 pm
Avatar
Sabeethan
New Member
Members
Forum Posts: 2
Member Since:
October 14, 2015
sp_UserOfflineSmall Offline

Hi Campbell,

Did you succeed in posting to thingspeak via xbee? I have a similar problem. I have tried various combinations of post method but with no success.

http://api.thingspeak.com/update?key=XXXXXXXXXXX&field1=12
This works on my browser but does not work when sent through an xbee. I tried arduino codes and also serial port emulators. I see the data being sent out to be consistent, yet i keep getting the 400 bad request error. I am pretty sure that I am missing something basic here.

Could someone help me out?

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Team_mafia, icXu, emorphistechno, VTVMART, manimozhi, adamhebrew

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457