Can't Open Connection to Exosite


#1

Hi, guys

I am currently using Arduino Uno and Arduino Wifi shield to connect to my portal.

However, after using the same given code as called ‘Wifireadwritestring’, my device seems ok with connecting to the internet, but shows Can’t Open Connection to Exosite in the end.

Could anyone please give me some help with this?

This is coding I am using (sorry for the inconvenience of reading):

//*****************************************************************************
//
// wifi_read_write_string - A Simple read/write to the Exosite Cloud API
//                          for the Arduino WiFi shield using the
//                          String library
//
// Copyright (c) 2013 Exosite LLC.  All rights reserved.
// 
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions are met:

//  * Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright 
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of Exosite LLC nor the names of its contributors may
//    be used to endorse or promote products derived from this software 
//    without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
//*****************************************************************************

include EEPROM.h
include SPI.h
nclude WiFi.h
include Exosite.h

/*==============================================================================
* Configuration Variables
*
* Change these variables to your own settings.
*=============================================================================*/
String cikData = "**********************************";  // <-- Fill in your CIK here! (https://portals.exosite.com -> Add Device)
char ssid[] = "testwifi";                                             // <-- Fill in your network SSID (name)
char pass[] = "1234567890";                                             // <-- Fill in your network password

// Use these variables to customize what datasources are read and written to.
String readString = "command&uptime";
String writeString = "uptime=";
String returnString;

/*==============================================================================
* End of Configuration Variables
*=============================================================================*/

int status = WL_IDLE_STATUS;
class WiFiClient client;
Exosite exosite(cikData, &client);

/*==============================================================================
* setup
*
* Arduino setup function.
*=============================================================================*/
void setup(){  
  Serial.begin(9600);
  Serial.println("Boot");
  
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  } 
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
    status = WiFi.begin(ssid, pass);
  }
  Serial.println("Connected to Access Point");

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

/*==============================================================================
* loop 
*
* Arduino loop function.
*=============================================================================*/
void loop(){
  //Write to "uptime" and read from "uptime" and "command" datasources.
  if ( exosite.writeRead(writeString+String(millis()), readString, returnString)){
    Serial.println("OK");
    Serial.println(returnString);
  }else{
    Serial.println("Error");
  }

  delay(500);
}

include libraries are written in the correct way in the coding page.

Please have a check on this and give me some helps, really in a rush.

Thank you very much


#2

That message means that the Arduino is unable to open a TCP socket to Exosite’s servers.

I would suggest trying one of Arduino’s included WiFI shield examples as they are a lot simpler to debug and the error messages that they produce should be more googleable.

If those work but the Exosite example still doesn’t work, I’d suggest going into the Exosite library and turning on some of the debugging output to try to see what is going on. If you can’t what it is trying to tell you, you can post a full serial log here and I can attempt to help you debug it.


#3

Hi, thanks for replying me.

I’ve tried to use the Arduino WIFI shield official example code to connect to the internet by wifi with using the wifi shield, it worked.

For the Exosite library and debugging output, do you mean by using some examples in the library to test them out? See what comes out by running them?

I’ve tried to run the Exosite example wifi provision, the log is as follow:

Boot
Attempting to connect to SSID: testwifi
Connected to Access Point
MAC Address: 78:C4:0E:02:5A:D9
IP Address: 192.168.23.2
Connecting to Exosite (Provision)…Error: Can’t Open Connection to Exosite.
Connecting to Exosite…No Connection…Error: Can’t Open Connection to Exosite.
Error Communicating with Exosite
Error
Connecting to Exosite (Provision)…Error: Can’t Open Connection to Exosite.
Connecting to Exosite…No Connection…Error: Can’t Open Connection to Exosite.
Error Communicating with Exosite
Error
Connecting to Exosite (Provision)…Error: Can’t Open Connection to Exosite.
Connecting to Exosite…No Connection…Error: Can’t Open Connection to Exosite.
Error Communicating with Exosite
Error

and keeps going on.

Do you have any idea what should I do?

Thank you.


#4

Sorry I should have been clearer. If you go into the source of the library you’ll find some parameters that will turn on some extra debug messages in the Exosite.h file. Un-comment the line that says #define EXOSITEDEBUG 1 to show more info about what is going wrong.

See: https://github.com/exosite-garage/arduino_exosite_library/blob/27170b441c916ec40e09f516619788073e1ee203/Exosite.h#L35-L38

I don’t know how helpful that will actually be because the error message that you are seeing is a result of the client->connect() function which doesn’t actually let you get any info about why something failed.

Can you get to http://m2.exosite.com/timestamp from a computer on the same network?


#5

Thanks for your reply.

Yes, I can get to the website, and it shows: 1429197483


#6

Then, after un-comment the line that says #define EXOSITEDEBUG 1 in Exosite.h, I ran the code WifiProvision again, and this is what I got from the log:

Boot
Attempting to connect to SSID: testwifi
Attempting to connect to SSID: testwifi
Connected to Access Point
MAC Address: 78:C4:0E:02:5A:D9
IP Address: 192.168.23.2
Connecting to Exosite (Provision)…Error: Can’t Open Connection to Exosite.
End of Provision
Connecting to Exosite…No Connection…Error: Can’t Open Connection to Exosite.
End Char ReadWrite
Error Communicating with Exosite
Error

Seems the same as what I got last time, or did I do something wrong?


#7

Not sure what to tell you. As far as I know there isn’t any way to get debugging info out of the WiFi client libraries. The only things that you can do are “try to connect” and check “did it work?”. And the library is already doing both.

You might just try leaving it run for awhile to see if it fixes itself. I’ve seen that happen from time to time with the Arduino networking stuff.


#8

@MNMN posted some more info over at http://forum.arduino.cc/index.php?topic=316651 and it seems like his problem is that his network uses a captive portal to enable Internet Access and thus only works with web browsers.


#9

Sorry, what do you mean by captive portal, and how to fix it?


#10

It’s basically what I said over in your Arduino thread. I’m pretty sure that your network requires you to login (or at least accept some terms or something) before it will let you access the Internet. The way this is done is through a web browser, but an Arduino doesn’t have a web browser, so the only way that you’re reasonably going to get on the Internet on that network with an Arduino is to have your IT department add your Arduino to a whitelist explicitly.


#11

Yes! Exactly, I need to log in to use the internet as I am using uni’s wifi. I thought I can get rid of that by using Arduino, but seems cannot.

I think I’ll go to IT service place to try to find some helps.

Thanks!!