Introduction: Using the Arachnio With

Sparkfun has produced a lovely tool for cloud storage of data streams, It's a great fit for the Arachnio, since it only requires a TCP connection and a GET request to log a data record. The data can then be retrieved from website for later analysis. This is a core function for any kind of sensor network you might want to build with the Arachnio and the Arachnode board.

This Instructable shows you how to do it, and it's really pretty easy. I'll be showcasing some of my development testing to show off a real application.

In this case, I'd like to explore the up-time performance of the ESP8266 with standard AT command firmware and the decoupling capacitor arrangement. There's been a number of complaints on-line about the stability of the ESP8266 but little in the way of hard data.

The current baseline Arachnio uses the same decoupling capacitor arrangement as the typical modules -- a single 10 uF capacitor. This is likely inadequate, as explained in this tutorial from Analog Devices. The next generation will have an improved setup with a 1 uF and a pair of 100 nF caps joining the 10 uF one.

I'll be using the older 0.9.5 firmware for initial testing, then I will be moving over to the 1.0.1 firmware to get a comparison along that axis as well.

For this testing, I installed the Arachnio into an ArachnoProto to protect the pins and remove confounding factors.

Step 1: Tools, Materials, and Software

Here's what I used for this test

Step 2: Setting Up Your Stream

The first step is to set up your data stream you want to upload to. Sparkfun has made this super easy -- here are the steps:

  1. Go to
  2. Enter a title
  3. Describe what you are doing
  4. Choose whether to make the stream visible on the public stream list or hidden
  5. Enter field names -- one per piece of data, and they should be descripttive.
  6. Give the stream an alias suitable for inclusion in a URL. Otherwise, you will have to use the public key in the URL.
  7. Tag the stream (optional)
  8. Enter a location (optional)
  9. Hit Save

You'll then be taken to the new stream page. It will show you everything you need to interact with your new stream. Of particular note are the private and delete keys (blacked out in the attached image). These let you write to, manage, or destroy the stream, and therefore must be kept private. The page gives you the option to download the keys as a json file or have them emailed to you.

Near the bottom, the page will have example URLs that can be used to write to your stream. I've blacked the private key out of the example, but when you create your own, you can copy and paste it into your browser's URL window and then check the stream to see the data you just posted has appeared.

Step 3: Arachnio Code

Here's the code to run on the Arachnio. Obviously, you will need to enter your own SSID, password, public, and private keys.

#include "ESP8266.h"
// replace with your WiFi connection info
#define WLAN_SSID "xxxx"
#define WLAN_PASS "yyyy"
ESP8266 wifi(Serial1);
void setup() {
  // put your setup code here, to run once:
  while (!Serial);      
  Serial.println("I live!");
void loop() {
  static long startTime = millis();
  char getBuffer[256] = {'\0'};
  // check to see if the ESP8266 is still alive
  if (wifi.kick()) {
    wifi.createTCP("", 80);
    long thisTime = millis();
    sprintf(getBuffer, "GET /input/[public key]?private_key=[private key]&baselineespup=%lu&baseline32u4up=%lu\r\nHost:\r\n\r\n",
      (thisTime - startTime)/1000, thisTime/1000);
    Serial.print("Starting send at "); Serial.println(millis());
    wifi.send((const uint8_t *)getBuffer, strlen(getBuffer));
    Serial.print("Ending send at "); Serial.println(millis());
  } else {
       Serial.println("ESP8266 died; restarting\n");
    startTime = millis();

The setup() function calls the restartESP() function to start up the ESP -- we'll cover that later. The code gets on with checking if the ESP is alive. The kick() function gives us a quick check whether the ESP is still responding or not. If it is, we open up a TCP connection, assemble the request.

The get request is a pretty standard thing; expanding the escaped newlines, it looks like this:

GET /input/[public key]?private_key=[private key]&baselineespup=%lu&baseline32u4up=%lu

The two values are the difference between the current system time (seconds since it started) and the system time the last time the ESP was started.

After sending the GET request, we just close the connection. Waiting for and processing the response isn't necessary, so we ignore it and kill the connection.

If the call to kick() returns false, we wait for 30 seconds then restart the ESP by calling restart() then restartESP() and reset the start time.

void restartESP (void) {
  Serial.print("FW Version:");
  if (wifi.setOprToStation()) {
Serial.print("to station ok\r\n"); } else { Serial.print("to station err\r\n"); } if (wifi.joinAP(WLAN_SSID, WLAN_PASS)) { Serial.print("Join AP success\r\n"); Serial.print("IP:"); Serial.println( wifi.getLocalIP().c_str()); } else { Serial.print("Join AP failure\r\n"); } if (wifi.disableMUX()) { Serial.print("single ok\r\n"); } else { Serial.print("single err\r\n"); } Serial.print("setup end\r\n"); }

Most of the stuff here is just diagnostics to make it easier to figure out what's going on when we have it plugged into a host computer. The key parts are where it sets itself to station mode, joins the access point it's told to, and disables the mux. We only need one connection at a time, so disabling the mux removes unnecessary complication.

You can see my ongoing results for the baseline here. I expect to have an updated one up and running tomorrow. Note that this code, as written, must be attached to a USB host. Therefore, the test code my be interrupted from time to time.