PDA

View Full Version : Here is how I use an ESP8266 with PushingBox and ThingSpeak services



MichelJasmin
- 18th July 2015, 22:26
Hi group!


Here is how I use an ESP8266 with PBP. In the attached example I show you how to use PushingBox and ThingSpeak services. I'm sorry it's not a full working project.
This example suppose you know how to use Darrel's DT_INTS-18.

I'm using a PIC18F25K22 @64MHz. A clock that fast may not be required, it's yours to test it out! You must use a PIC18 because a big receiving buffer is required. It's a matter of memory banks.
There a lot of hserout2 for debugging purposes. There is no handling of any HTTP response, sorry!


Watch out: The ESP8266 works @3V. You need a level shifter on the RX & reset pins of the ESP, a resistor divider is enough. The TX of the ESP can drive the RX on the PIC without level shifting.


This is how to push data to ThingSpeak (here 3 fields with values 5, 255 & 300):



GET /update?key={my_API_key}&field1=5&field2=255&field3=300&headers=false HTTP/1.1{CrLf}Host: api.thingspeak.com{CrLf}Connection: close{CrLf}Accept: */*{CrLf}{CrLf}


Replace {CrLf} by CrLf ( 13, 10 )
Replace {my_API_key} with your API key
The keyword "headers=false" will remove extra headers from response.
The keyword "Connection: close" will close the connection automatically.
See ThingSpeak doc for more. Note: ThingSpeak is limitted to one call every 15 seconds max.


PushingBox is nice to push to several services (email, Twitter) in a single call. Note: strings must be URL encoded. Here is an online tool: http://meyerweb.com/eric/tools/dencoder/
For my lawn mower project (http://hackaday.com/2015/06/10/worlds-first-internet-connected-lawnmower/) I'm using an external I2C EEPROM to store my URL encoded tweets. The data is URL encoded and dumped using VB.NET:



Dim UrlEncoded As String = System.Web.HttpUtility.UrlEncode(MyString)
Debug.WriteLine(UrlEncoded)




Without Darrel's work a LOT of projects wouldn't exists. Thank you and RIP Darrel...


7927
7928

MichelJasmin
- 19th July 2015, 04:38
I forgot to mention: this code works with AT firmware v0.22 (http://bbs.espressif.com/viewtopic.php?f=5&t=286) & up.


AT_v0.22 is the highest you can flash on your module if it has only 512kB. Don't worry, there is something you can do (http://www.picbasic.co.uk/forum/showthread.php?t=20180&p=133695#post133695).