Connecting to a Server

This will be a short one, since connecting to an HTTP server was surprisingly easy!
After doing everything mentioned in the last 2 posts, I started playing around with some examples, and found some ESP8266 specific ones.

Of particular interest was the example at: File>Examples>ESP8266WiFi>WiFiClient

The comments at the start of this example mention sparkfun.com, which allows users to send small amounts of data and display it either as a list of raw values, or as a chart via analog.io.

The only issues I had getting everything up and running were as follows:

1: The example code has a constant named “streamId” (line 15), which isn’t mentioned on the sparkfun page providing all private keys etc for the stream. Looking at the examples provided in the documentation, it’s clear that this field corresponds to the public key that sparkfun provides.

2: When you create a stream on sparkfun.com, you can choose to set a number of field names. I set mine to “temp” initially. If you choose any field name that isn’t just the word “value”, you will need to change “&value=” to something like “&temp=”.

After doing all this, I was able to see the incremented value posted to my sparkfun page (it’s not very interesting at the moment):

sparkfun1
My super interesting sparkfun page

 

Some things to note when using sparkfun: you can only upload 50MB of data before the earliest values start getting overwritten, and the maximum upload rate is 100 updates every 15 minutes (it’s all explained here).

At the moment I’m waiting on some temperature sensors to arrive, so when they do, I’m going to start trying to get one of those hooked up and post the results to the page!