vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.93k stars 715 forks source link

ADD ESP8266 Examples #104

Closed ecuellar closed 6 years ago

ecuellar commented 6 years ago

Excelent lib. Is there any examples for the ESP8266? or documentation?

Regards

daviidmart commented 6 years ago

All the examples are for the ESP8266

ecuellar commented 6 years ago

thanks for your answer, but for example: I tried the diagnostics example:

// Select your modem: // #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM900 // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590

define TINY_GSM_MODEM_ESP8266

I uncomment the last line, and now when I tried to compile, its tells me that there is no method called"modem.gprsConnect()".. so I open some libraries, and found there is a method called "modem.networkConnect()".. I changed, it compiles, but the example does not run very well, does not connect to the network.

Br4inslug commented 6 years ago

Hey Guys i also think its a great lib. But im running in the same problems like ecuellar with esp8266 the example and the diagnostic runs but i was not able to connect to a network.

Regards

vshymanskyy commented 6 years ago

ESP8266 is experimental, and I actually wouldn't recommend using it. I'm not providing examples, as WiFi modules require different setup, etc. And partially because I don't want to maintain it at the moment.. Maybe when developer community of this project grows a little bit, or at some point later guys ;)

ClemensGruber commented 3 years ago

I'm using TinyGSM on the TTGO T-Call, an ESP32 with SIM800 module. So my question would be can I use the build in WiFi module of the ESP32 with TinyGSM to submit alternatively data via Wifi? So is the ESPxx example meant for an ESP as microcontroller with built in Wifi or is it for any microcontroller with an "external" ESP connected to the microcontroller as modem?

SRGDamia1 commented 3 years ago

@ClemensGruber The ESPxx code in this library is intended only for a microcontroller with an "external" ESP. That external ESP must be running Espressif's "AT" firmware.

ClemensGruber commented 3 years ago

In the meantime I found -- beside the #define TINY_GSM_MODEM_ESP8266 declaration -- the TINY_GSM_USE_WIFI definition e.g. in

https://github.com/vshymanskyy/TinyGSM/blob/4eedb84cd398746d34d04dbf243ee99143b52090/examples/HttpClient/HttpClient.ino#L75-L77

I wonder if this is the same, so also for an ESP with "AT firmware"?

Do I have to specify #define TINY_GSM_MODEM_ESP8266 and in addition set #define TINY_GSM_USE_GPRS false and #define TINY_GSM_USE_WIFI true

SRGDamia1 commented 3 years ago

Those declarations (#define TINY_GSM_USE_GPRS, etc ) in the "allFunctions" and other examples only apply to the examples. They're just there as a short-cut so the same example can be used for lots of different modules with different functionalities by only adjusting the defines at the top. In any other program, you don't need to #define TINY_GSM_USE_xx, just #define TINY_GSM_MODEM_ESP8266.

The espressif modules are wifi only, so attempting any GPRS-esque functions will fail. It shouldn't even compile.

The TINY_GSM_MODEM_ESP8266 is ONLY for a microcontroller with the espressif attached externally and running AT firmware (ie, an Uno talking to a cheap ESP8266 breakout). If you're using the ESP8266 or ES32 as the main brain, you would connect to wifi using the functions from the Arduino core for the espressif and then you would have to connect some other module (ie, a SIM800) and define that for cellular functions.

ClemensGruber commented 3 years ago

Many thanks for the clarification Sara, I've hoped for a convenient software solution with an easy switch to use e.g. HTTP or MQTT with the same lib and switcheing easily from GPRS to WiFi but using the same lib and underlaying concepts on an ESPxx. Ok so it must be implemented twice.