News:

;) This forum is the property of Proton software developers

Main Menu

ESP8266-01 pushing data to google sheets

Started by jpeeters19, Apr 10, 2021, 01:08 PM

Previous topic - Next topic

jpeeters19

Has anyone tried to push data to a google sheet with an ESP8266-01? I can't get it working. Now I read on multiple arduino sites that they have a similar problem which has to do with google executing a redirect when you try to send data to: script.google.com. With Arduino they have written a httpRedirect library for that, but I don't know how I can easily translate this to Proton to get it working. See below the code I have, which by the way works and gives no errors as far as I can tell. What do I have to do to be able to send data directly without a 3th party solution?
Any help would be appreciated

    SerOut ESP8266_RX, 84, ["AT", 13, 10]
    SerOut ESP8266_RX, 84, ["AT+CWMODE=1", 13, 10]
    'OK
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait("OK")]
    SerOut ESP8266_RX, 84, ["AT+CWJAP=",34,"SSID",34,",",34,"PASSWORD",34, 13, 10]
    'WIFI CONNECTED
    'WIFI GOT IP
    'OK
    SerIn ESP8266_TX, 84, 8000, FAIL_ESP, [Wait("OK")]
    SerOut ESP8266_RX, 84, ["AT+CIPMUX=0", 13, 10]
    'OK
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait("OK")]
    SerOut ESP8266_RX, 84, ["AT+CIPSTART=",34,"TCP",34,",",34,"script.google.com",34,",443", 13, 10]
    'CONNECTED
    'OK
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait("OK")]
    DataString = "GET /macros/s/YourUniqueStringFromGoogle/exec?Temperatuur=20.3&Luchtvochtigheid=45"
    StringLenght = Len(DataString)
    TempString = "AT+CIPSEND=" + Str$(Dec StringLenght)
    SerOut ESP8266_RX, 84, [TempString, 13, 10]
    'OK
    '>
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait(">")]
    SerOut ESP8266_RX, 84, ["GET /macros/s/YourUniqueStringFromGoogle/exec?Temperatuur=20.3&Luchtvochtigheid=45"]
    'Recv xx bytes
    'SEND OK
    '+IPD,1:5CLOSED
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait("CLOSED")]
    SerOut ESP8266_RX, 84, ["AT+CIPCLOSE", 13, 10]
    SerIn ESP8266_TX, 84, 3000, FAIL_ESP, [Wait("CLOSE")]
Return

FAIL_ESP:
Return

jpeeters19

nobody worked with google sheets/esp8266?  ???

RayEllam

#2
Hi,
I did a google and there is a pretty detailed tutorial using an ESP-12 and running NODEMCU (maybe an ESP-01 will not have enough memory?)

https://www.electronics-lab.com/project/iot-log-sensor-data-google-sheet-using-nodemcu/

The ESP module running NODEMCU supports LCD's and a bunch of sensors so maybe its stand alone device without a PIC? If you intend to use a pic and send data to the ESP then use the NODEMCU serial library as well.

Ray


jpeeters19

Unfortunately i can't change the complete hardware design anymore. Its all build and installed allready onsite.

So back to my situation, i first have to find out how to send a simple GET request (with a ESP8266-01) to a SSL site (google) ignoring the certificates. After that i can focus on the google redirect issue
 

RayEllam

#4
I had a similar problem and from memory you cannot use https on an ESP via AT commands with the standard firmware. There are extended firmwares around that will allow you to do this. Have a read of this link.

https://www.e-tinkers.com/2020/04/a-better-way-to-use-esp-01-as-wifi-shield/

So at minimum you would need to reflash the firmware and start from there. One thing to note is the ESP01 has very limited flash size and this could be a limiting factor.

jpeeters19

thanks! that sounds interesting and worth a try

RayEllam

For future projects use an ESP12 and flash it with ESPEasy. You can then use the ESP as stand alone OR with a host MCU talking via serial. Iv done quite a few IOT projects with this set up and it all works well together and ESPEasy is free and very well supported with an active forum.