vshymanskyy / TinyGSM

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

Modified SIM800 to work with SIM7020. #689

Open 1mek opened 1 year ago

1mek commented 1 year ago

[ ] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module

[ ] Bug or problem compiling the library [ ] Bug or issue with library functionality (ie, sending data over TCP/IP) [x] Question or request for help

What are you working with?

Modem: SIM7020G Main processor board: ESP32 TinyGSM version: latest (0.11.5) Code: TinyGsmClientSIM7020m.zip

In arduino-ide include above as local file in sketchfolder then in sketch.

#define TINY_GSM_MODEM_SIM7020
#include "TinyGsmClientSIM7020m.h"

typedef TinyGsmSim7020                   TinyGsm;
typedef TinyGsmSim7020::GsmClientSim7020 TinyGsmClient;

Scenario, steps to reproduce

Ive been modifying Sim800 code to work with the sim7020, so far only tested with mqtt examples and it works fine. But is there any downside using sim7020 with the sim800-compability commands?

capedra commented 1 year ago

I guess this is not the ideal solution. I followed the MQTT Application Note of SIM7020 and developed my own solution completely based on it and on the TinyGSM library of SIM7080, changing lots of parameters there. The only issue that I'm currently facing is that whenever I turn on the device, I always need to disconnect the previous connection with the broker before attempting a new connection, otherwise it won't let me pub/sub anything. In other words, whenever I restart/turn on the module, I have to use CMQDISCON before CMQNEW followed by CMQCON.

erazor83 commented 1 year ago

@capedra can you share your code somewhere?

Thanks a lot!

ameerhazo commented 1 year ago

Hello @1mek, I'm also interested in the work that you've done. Could you please share the mqtt code example that you tested your code with? I would presume that you'd set the gprs flag to false because the 7020 doesn't support it right?

Kind regards, Ameer

1mek commented 1 year ago

Its tested with the included mqtt examples in tinygsm. mqtt over tcpsockets.

Not the sim7020mqtt commands @capedra mentioned.