Esp8266at wont compile

Hi every one.
I have tried for some time now to get the esp8266at to work but it wont compile.
I get a lot of errors. I have tried to figure this out by editing the ThingerESP8266AT.h file and some of the files in the tinyGSM library but i only made it worse.

This is the original errors i got with the library’s freshly installed:

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:67:5: error: ‘TinyGsm’ does not name a type

 TinyGsm serial_;

 ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:68:5: error: ‘TinyGsm’ does not name a type

 TinyGsm::GsmClient client_;

 ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In constructor ‘ThingerESP8266AT::ThingerESP8266AT(const char*, const char*, const char*, Stream&)’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:33:13: error: class ‘ThingerESP8266AT’ does not have any field named ‘serial_’

         serial_(serial),

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:27:0,

             from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerClient.h:413:13: error: ‘Client& ThingerClient::client_’ is private

 Client& client_;

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:13: error: within this context

         client_(serial_),

         ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:13: error: class ‘ThingerESP8266AT’ does not have any field named ‘client_’

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:21: error: ‘serial_’ was not declared in this scope

         client_(serial_),

                 ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:27:0,

             from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerClient.h:413:13: error: ‘Client& ThingerClient::client_’ is private

 Client& client_;

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:37:27: error: within this context

         ThingerClient(client_, user, device, device_credential)

                       ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In member function ‘virtual bool ThingerESP8266AT::network_connected()’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:47:16: error: ‘serial_’ was not declared in this scope

     return serial_.isNetworkConnected();

            ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In member function ‘virtual bool ThingerESP8266AT::connect_network()’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:51:16: error: ‘serial_’ was not declared in this scope

     return serial_.networkConnect(wifi_ssid_, wifi_password_);

            ^

Please help me

I have been using Arduino Uno with sim808 connected to thinger for some time now and i’m super happy about how it works. But I wont to connect some thing at home as well so i hope someone want to help me with this esp8266 issue.

Thanks

Hi,

use this example code:

// Uncomment this for debug
// #define _DEBUG_

// Can be installed from Library Manager or https://github.com/vshymanskyy/TinyGSM
#define TINY_GSM_MODEM_ESP8266
#include <TinyGsmClient.h>
#include <ThingerESP8266AT.h>

#define USERNAME "you_username"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_password"

// Emulate Serial1 on pins 10/11 if HW is not present (use interrupt pins for better performance)
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(10,11); // RX, TX
#endif

ThingerESP8266AT thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);

void setup() {
  // uncomment this for debug over serial
  // Serial.begin(115200);

  /* Notice: initialize serial for ESP8266 at your ESP8266 baud rate
   * You can change the baud rate of ESP8266 sending a command like "AT+UART_DEF=9600,8,1,0,0\r\n"
   * Test with different rates, and use the higher one that works with your setup.
   */
  Serial1.begin(9600);

  thing.add_wifi(SSID, SSID_PASSWORD);

  // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
  pinMode(LED_BUILTIN, OUTPUT);
  thing["led"] << digitalPin(LED_BUILTIN);

  // resource output example (i.e. reading a sensor value)
  thing["millis"] >> outputValue(millis());

  // more details at http://docs.thinger.io/arduino/
}

void loop() {
  thing.handle();
}

We will update the example. Thanks for reporting! :wink:

haha. Its always the small things that makes a big difference :smiley:
#define TINY_GSM_MODEM_ESP8266
#include <TinyGsmClient.h>

Thanks a lot for helping me out. That was very kind of you
Kind regards

1 Like

Hi.

Any idea what this is about?
I have tried to connect it whit my phone as a wifi router, but it did not make any difference.
I have also compared the some libraries that i know will connect(gsm and ethernet), trying to find out what is happening in regards to the address to thinger io and the ports.
I have also tried with secure connection on port 25202 with no success

any idea whats going on here?

[NETWORK] Starting connection…
[NETWORK] Connected!
[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Error while connecting!

Best regards

I’m not sure if what I’m doing is right. But I have an Arduino + ESP8266. I’m trying to compile the ESP8266AT example but I’m getting a bunch of errors. I’m not sure what to do.

So far I’ve tried running AT commands directly to the ESP8266 and via the Arduino Uno and they’re both responding “OK” to my “AT” command.

Here are some of the errors I’m getting

\Documents\Arduino\libraries\thinger\src/ThingerESP8266AT.h:71:24: error: cannot declare field ‘ThingerESP8266AT::client_’ to be of abstract type ‘TinyGsmTCP<TinyGsmESP8266, 5u>::GsmClient’
TinyGsm::GsmClient client_;

\Documents\Arduino\libraries\TinyGSM-master\src/TinyGsmTCP.tpp:69:9: note: because the following virtual functions are pure within ‘TinyGsmTCP<TinyGsmESP8266, 5u>::GsmClient’:
class GsmClient : public Client {

\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/Client.h:30:21: note: virtual int Client::connect(const char*, uint16_t)
virtual int connect(const char *host, uint16_t port) =0;

\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/Client.h:38:22: note: virtual void Client::stop()
virtual void stop() = 0;

\Documents\Arduino\libraries\thinger\src/ThingerESP8266AT.h:40:67: error: no matching function for call to ‘TinyGsmTCP<TinyGsmESP8266, 5u>::GsmClient::GsmClient(TinyGsm&)’
ThingerClient(client_, user, device, device_credential)

I’m using thinger version 2.15.0, TInyGSM version 0.10.9, and my ESP8266 is flashed with v1.1.1.1 AT Firmware.

I solved my own problem by using an older version of thinger.io library together with an old version of the TinyGSM library. What I did was find the version that was used by @glennern at that time and start from there (Good thing there’s GitHub). Then I encountered the same problem as @glennern did. After installing and uninstalling a couple more versions of the two libraries, I ended up with version 2.9.1 of thinger.io library and version 0.3.3 of the TinyGSM library.

Hi, can i know did you use the code provided by @alvarolb ? Did it solve the issue? Cuz I tried and again faced the same error message as below.

23:04:03.076 → [_SOCKET] Connecting to iot.thinger.io:25200
23:04:03.116 → [_SOCKET] Using secure TLS/SSL connection: no
23:04:03.195 → [_SOCKET] Error while connecting!
23:04:08.178 → [NETWORK] Starting connection…
23:04:08.217 → [NETWORK] Connected!
23:04:09.208 → [_SOCKET] Connecting to iot.thinger.io:25200
23:04:09.248 → [_SOCKET] Using secure TLS/SSL connection: no
23:04:11.186 → [_SOCKET] Connected!
23:04:11.186 → [THINGER] Authenticating. User: JinHang Device: espmega
23:04:11.266 → [THINGER] Writing bytes: 39 [FAIL]
23:04:11.306 → [THINGER] Expected:39
23:04:11.346 → [THINGER] Wrote:0
23:04:11.346 → [THINGER] Auth Failed! Check username, device id, or device credentials.
23:04:11.422 → [_SOCKET] Is now closed!

Hi, this error could be solved verifying the device credentials, even deleting and creating it again.

Remember that the user device and password are case sensitive.

Hope this helps.

I tried on multiple occasions - checking the device ID, username and device credentials, all are matched. I even deleted the device and added them again on the Thinger cloud. I’m pretty sure I logged in the correct details, but error like this is still persistent.

I added another device - Nodemcu which connected to Thinger with the same method with how I entered the username, device ID and device credentials. So I think the username, device ID and device credentials I entered are all correct.

Mu current setup is using ESP8266-01s to act as a WiFi shield to Arduino MEGA to connect to Thinger. I am using the latest version of Thinger library as well as latest version of TinyGSM library. The code I’m using is the ones posted above on the second post. AT version of the ESP is 0.22.0.0 while SDK version is 1.0.0. Any advice on how to solve this? This is the only debug message available to me now.

Hi, all fields are case sensitive, so when you registered your username, did you made it with upper and lowercase letters as is shown in the debug?

Yeah, the user ID is the one on the top right corner right? I made sure I typed the correct thing and they work fine on my NodeMCU but not on my MEGA…

I have tried my current MEGA setup to connect to Blynk which works fine as well. So I am quite confused what did I do wrong.

Ok try adding the next line:
#define _DISABLE_TLS_

Before the thinger library is loaded.

Let me know how it goes.

Unfortunately, when I added the line, the same problem persists. This is the error message I received.

13:46:41.314 → [NETWORK] Starting connection…
13:46:41.354 → [NETWORK] Connected!
13:46:42.317 → [_SOCKET] Connecting to iot.thinger.io:25200
13:46:42.357 → [_SOCKET] Using secure TLS/SSL connection: no
13:46:46.312 → [_SOCKET] Connected!
13:46:46.312 → [THINGER] Authenticating. User: *** Device: ***
13:46:46.392 → [THINGER] Writing bytes: 39 [FAIL]
13:46:46.432 → [THINGER] Expected:39
13:46:46.472 → [THINGER] Wrote:0
13:46:46.472 → [THINGER] Auth Failed! Check username, device id, or device credentials.
13:46:46.553 → [_SOCKET] Is now closed!

The same error is displayed regardless of the ESP8266AT example in Arduino IDE or even the sketch that includes #define TINY_GSM_MODEM_ESP8266.

I am still a newbie so I dont really know what happened here, seems like the library is not able to make connection to the cloud. I will try to flash other versions of the AT as mentioned above to see if it helps. So far it is not working as expected.

So I am here to give you guys an update. So I finally got ESP to work as WiFi module for MEGA.

This took me a lot of time, let’s be honest, it don’t worth the effort. There are so many confusing tutorials in the Internet, most of them don’t work fine with my setup. My setup is plainly ESP to work as WiFi module for MEGA. The ESP version I am using is the newer ESP-01s, which does not require 3.3V conversion as the ESP itself has a built-in 3.3V regulator.

Flashing the correct firmware version for the ESP is extremely important. The firmware that came with my ESP was not able to get me connected to Thinger.io.
Here is the link I used to flash the correct firmware for ESP.

I used USB to ESP8266 adaptor to save my time flashing, I guess the setup in the link works as well.The Baud rate of ESP is set to 115200. In serial monitor, select the “Both NL & CR” option to see AT commands.

Which then I followed the thing that @jaum did. Using Thinger 2.9.1 library, Tiny GSM v0.3.3. Then everything works fine. Latest library works as well, but if there is any problem just use 2.9.1 thinger library then.

As for the code to upload to MEGA for it to work with Thinger, the code above given by alvarolb worked fine, even the example sketch is working fine too (Previously it didnt work).