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!

Advertisements

1 thought on “Connecting to a Server”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s