GithubHelp home page GithubHelp logo

Comments (94)

ichai05023 avatar ichai05023 commented on May 17, 2024 2

Hi botletics! My issue is fixed now by finding another hosting site. Again, thank you so much for your work!

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

It should be compatible, although I know HTTPS uses different commands. Did you first enable GPRS before posting? That's critical for the HTTP to work properly. You should also replace the Adafruit library with my version of the library. Follow the wiki in this Github and load the LTE_Demo code and use the "G" command to enable GPRS then use the "2" command to send data to dweet.io.

As a side note, I actually wrote a function for the SIM5320 HTTPS in my fork of the Adafruit FONA library in a different repo. The function is called "postData3G" in the .cpp file if you want to take a look.

Let me know if you get it working!

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Sorry, actually now I recall that the SIM5320 doesn't use the same HTTP commands as the other modules. It uses the "AT+CHTTP____" commands instead. I would have to update my library to get it working.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I have been trying to send AT+CHTTPS___ using the pass through tunnel, this is what I'm getting:

AT+CHTTPSSTART
OK
AT+CHTTPSOPSE="https://dweet.io/dweet/for/dahdo1m?temp=24.6",443

"no response"!

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I have been reading the SIM5320A AT Commands List, the HTTPS commands are quite different, and I feel that I don't fully understand what they are supposed to do.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

I haven't tried pass through tunnel. I'll update my library shortly with an HTTP/HTTPS function for you to try shortly. Will keep you updated. However, I can't actually test it out since I don't have a SIM5320A anymore.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

OK, I just updated the library and the "LTE_Demo" sketch. Just follow these steps:

  • Delete the existing Adafruit FONA library you have in your libraries folder (path is Documents/Arduino/libraries by default)
  • Follow this wiki to get my version of the library installed
  • Open the "LTE_Demo" example sketch but uncomment the "SIMCOM_3G" line instead of the default "SIMCOM_LTE" line at the very top of the code
  • Upload and run the code. You should see the menu appear.
  • Enter the "G" command in your serial monitor to enable 3G
  • Enter the "3" command to send data to dweet.io via HTTP or HTTPS. Check out the function definition in the sketch on how to use the function. By default it sends via HTTPS.

Let me know if it works! I'd love to know since I don't actually have one to test it out.
Thanks

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

Hi Tim,

I tried it today, the code you wrote does send the following AT Command CHTTPSSTART and CHTTPSOPSE. The response for the first is OK, but the response for the second is ERROR, just similar to what I described earlier when I used the pass through tunnel. Are we using proper AT Commands? Do you think that SIM5320A is not suitable for connecting to the internet and sending data? The reason I'm asking is because the AT Commands list for SIM5320A does not show HTTP commands, and the HTTPS commands feel insufficient to send data through the 3G network.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

The SIM5320A definitely works with HTTP and HTTPS, I tried it before. It just uses different commands than the other 2G modules.
Let me ask again:

  • Did you first enable GPRS with the "G" command in the LTE_Demo sketch?
  • Are you even connected to the network? Use "n" to check network registration

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I enabled it by pressing G, or by pressing g then G, the network was available, signal appeared to be OK, and network was registered.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Hmmmm that's strange. I'll investigate this when I get a chance.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

By the way, did you set the right APN for your SIM card? By default I use "hologram" but you need to change it for your specific SIM card if you're not using a Hologram.io SIM card.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I used the APN for AT&T "m2m.com.attz"

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I have an AT&T trial sim card

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Please verify that it's sending the following AT command exactly as the line below:

AT+CHTTPSOPSE="www.dweet.io",443,2

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

If it is and it's failing, then go to the LTE_Demo sketch and search for this line:

if (!fona.postData3G("www.dweet.io", 443, "HTTPS", URL)) // Server, port, connection type, URL

and use good 'ole HTTP instead and see what happens:

if (!fona.postData3G("www.dweet.io", 80, "HTTP", URL)) // Server, port, connection type, URL

Also try getting rid of "www" and see if that works. I'm pretty darn sure this worked with "www" when I tested it on SIM5320A.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

Hi Timothy,

I tried doing this today I kept getting the response: ERROR, whenever it sends the "AT+CHTTPSOPSE" command

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Could you please take a screenshot of the serial monitor output? Thanks!

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

capture

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

I tried changing it to "HTTP" and 80,2 , and removing "www." also, all gave the same response

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Looks like you have some weird characters showing up at the end of the "CHTTPSOPSE" command. That could very well be the problem. Does it do that every time?

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

Only after I changed it

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Doesn't look like you were entering the port 80 correctly. You should be copying/pasting this line instead:

if (!fona.postData3G("www.dweet.io", 80, "HTTP", URL)) // Server, port, connection type, URL

the "2" means HTTPS and is interpreted inside the function, so you shouldn't input that. In this case it will interpret the "HTTP" as "1" and not a "2". Try that and take another screenshot please! Also, keep the "www" because I'm sure that worked with mine before.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

capture

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Ahh OK, must be a library thing then. Will look into that.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

OK, just uploaded a new Adafruit_FONA.cpp file in the repo. Download that and replace the existing one in your Arduino libraries folder (Documents -> Arduino -> libraries -> Adafruit_FONA by default), restart the IDE, and re-upload and see if that fixed the weird characters.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

It worked :)

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Awesome! You were able to post data via HTTPS as well?

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

Hi,
I need your help,
I am trying to sen data my web page using Adafruit 3G FONA SIM5320A

I got the same error. Please see the attached picture.
capture1

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Sorry, currently I don't have a SIM5320A to test personally, but people say the library works with the same AT command sequence.

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

Thank you for your replay.

I downloaded the folder "code" and I followed all the instructions that you posted in your page.
I am not sure if I used the right Adafruit_FONA.CPP because the code cannot recognize the fona.postdata3G function.

any suggestions my project has been suspended.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

You might have an old version of the library. When did you download the code folder?

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

yesterday.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Can you please copy the error message here? It compiles just fine for me.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

And did you uncomment the line

#define SIMCOM_3G // SIM5320A/E

near the top of the code, and comment out all the other lines?

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

I did that

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Can you please copy the error message? You also need to delete any existing Adafruit FONA library inside your Arduino libraries folder (default for Windows is Documents/Arduino/libraries). Most likely you have redundancies and it's using the old library.

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

I used this line instead of the other
if (!fona.postData3G("www.dweet.io", 80, "HTTP", URL)) // Server, port, connection type, URL

C:\Program Files (x86)\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.h:151:101: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

boolean postData(const char *server, uint16_t port, const char *connType, char *URL, char *body = "");

                                                                                                 ^

C:\Program Files (x86)\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp: In member function 'boolean Adafruit_FONA::postData(const char*, const char*, char*, const char*)':

C:\Program Files (x86)\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:1552:51: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (! sendCheckReply(dataBuff, "DOWNLOAD", 10000))

                                               ^

C:\Program Files (x86)\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp: In member function 'boolean Adafruit_FONA::postData(const char*, uint16_t, const char*, char*, char*)':

C:\Program Files (x86)\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:1659:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (! sendCheckReply(auxStr, ">", 10000))

                                      ^

C:\Users\magro\AppData\Local\Temp\ccFiS6UQ.ltrans0.ltrans.o: In function `loop':

ccFiS6UQ.ltrans0.o:(.text+0x1e66): undefined reference to `Adafruit_FONA_3G::postData3G(char const*, unsigned int, char const*, char*)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Please see my previous comment and delete any old Adafruit FONA libraries that you may have installed before installing mine.

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

I did and I will do it again now

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

I got the same error message

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Also, if it doesn't even compile, how did you get it to run the code? You showed it running the LTE_Demo already...

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

When I use if (!fona.postData("www.dweet.io", 80, "HTTP", URL)), it is working but the error as in message below

FONA> G
---> AT+CGATT=1
<--- OK
---> AT+CGSOCKCONT=1,"IP","m2m.com.attz"
<--- OK
---> AT+CIPMODE=1
<--- OK
---> AT+NETOPEN=,,1
<--- ERROR
Failed to turn on
FONA>

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

it works when I use fona.postData() instead of fona.postData3G()

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Please use the updated version of the examples as well, you have an old version. The new LTE_Demo does not have the "postData3G()" function.

https://github.com/botletics/SIM7000-LTE-Shield/blob/master/Code/examples/LTE_Demo/LTE_Demo.ino

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

Should I change the port to 80 or not

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

Same error

FONA> n
---> AT+CREG?
<--- +CREG: 0,1
Network status 1: Registered (home)
FONA> 2
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- ERROR
Failed to complete HTTP GET...
FONA>

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

For the SIM5320 you need to use the "3" command, not "2". You can try port 80 and "HTTP" but I doubt that would make any difference. Sorry, I don't know what's going on with your setup.

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

Do you mean this line
#define SIMCOM_3G // SIM5320A/E

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

In the post above you used the "2" command in the LTE_Demo. You should use "3" instead. But yes, you should also use the SIMCOM_3G define line.

from sim7000-lte-shield.

almagroos avatar almagroos commented on May 17, 2024

when I chose 3 in command I get this error

+STIN: 25
3
---> AT+CHTTPSSTART
<--- ERROR
---> AT+CHTTPSSTART
<--- ERROR
Failed to complete HTTP/HTTPS request...
FONA>

Please is there any error in this line of code

if (!fona.postData("www.aelmagrous.com", 80, "HTTP", "GET /SensorDemo/add_data2.php?dataRow=50 HTTP/1.1")) // Server, port, connection type, URL
Serial.println(F("Failed to complete HTTP/HTTPS request..."));

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

You should include at least the host name, otherwise how does it know where to go?

HTTP/1.1\r\nHost: dweet.io\r\n\r\n

Sorry, Github is not the place to debug other people's code. If it doesn't work with the code I provide I will look into it, but once you change it I really don't have the time.

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

Hi, ive been following your steps but no matter what .cpp or .h i use i get lots of compilation errors...
I am using ESP32 and Sim5320A, this is what i get when trying to compile from your files. My files work fine for HTTP posting but now i want to use HTTPS.


Archiving built core (caching) in: C:\Users\rene6\AppData\Local\Temp\arduino_cache_949788\core\core_espressif_esp32_featheresp32_FlashFreq_80,UploadSpeed_921600,DebugLevel_none_5cb0df2a6ba85453e296ce37c363884e.a
sketch\F7A8X6BI6WOTYGJ.ino.cpp.o:(.literal._Z5setupv+0x48): undefined reference to `Adafruit_FONA::setNetworkSettings(__FlashStringHelper const*, __FlashStringHelper const*, __FlashStringHelper const*)'

sketch\F7A8X6BI6WOTYGJ.ino.cpp.o:(.literal._Z9setupGPRSv+0x1c): undefined reference to `Adafruit_FONA::postData(char const*, unsigned short, char const*, char*, char*)'

sketch\F7A8X6BI6WOTYGJ.ino.cpp.o: In function `setup()':

C:\Users\rene6\Desktop\Rene\TAB\F7A8X6BI6WOTYGJ/F7A8X6BI6WOTYGJ.ino:617: undefined reference to `Adafruit_FONA::setNetworkSettings(__FlashStringHelper const*, __FlashStringHelper const*, __FlashStringHelper const*)'


Thanks

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Please use the .cpp and .h files in this repo as well as the example sketches and you shouldn't have any problems compiling for SIM5320 (3G).

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

okay, there is compatibility issues with the ESP32 board, which i can change code for in the .cpp, however there is still the undefined commands i am getting. Is there a place to see what changes you made to the original fona.cpp file?

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Oh, you're using ESP32? Sorry I haven't explored that much. I'm currently really busy but will try this when I get a chance.

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

Im not sure if the issue is from ESP32 or not (ESP32 is only the microcontroller, HTTPS is from sim5320A), this is what i get in my output logs:

C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:1585:9: error: prototype for 'boolean Adafruit_FONA::postData(const char*, uint16_t, const char*, char*)' does not match any in class 'Adafruit_FONA'

boolean Adafruit_FONA::postData(const char *server, uint16_t port, const char *connType, char *URL) {

     ^

In file included from C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:19:0:

C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.h:151:11: error: candidates are: boolean Adafruit_FONA::postData(const char*, uint16_t, const char*, char*, char*)

boolean postData(const char *server, uint16_t port, const char *connType, char *URL, char *body = "");

       ^

C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:1507:9: error: boolean Adafruit_FONA::postData(const char*, const char*, char*, const char*)

boolean Adafruit_FONA::postData(const char *request_type, const char *URL, char *body, const char *token) {

     ^

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

First of all, could you please provide your full code here so I can debug? If you compile for Arduino Uno, Mega, Leonardo, etc. it should work just fine.

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

Sure, i am trying to use your LTE demo code, the only changes i made are software serial to hardware serial. Here is the changes ive done, the rest is your code:

#include <HardwareSerial.h>
HardwareSerial Serial2(2);
HardwareSerial *fonaSS = &Serial2;

while (!Serial);
// ss.begin(GPSBaud); // begin the GPS serial connection
Serial.begin(115200);
Serial.println(F("Initializing....(May take 3 seconds)"));
//fonaSerial->begin(115200);
Serial2.write("AT+CDIPR=115200"); // Set Baud to 115200
delay(500);
Serial2.begin(115200);
delay(500);
if (! fona.begin(*fonaSS)) {
Serial.println(F("Couldn't find FONA"));
pinMode(FONA_RST, OUTPUT); //set a pin mode on the FONA_RST
int attempt = 0; // a counter to check the number of times the fona has been reset
while (! fona.begin(*fonaSS) && attempt != 5) { //try to reset the FONA 5 times before giving up
Serial.print("Resetting FONA...Attempt");
Serial.println(++attempt);
digitalWrite(FONA_RST, LOW); //set the FONA_RST pin low (Reset the fona)
}
}
digitalWrite(FONA_RST , HIGH); //pull FONA_RST back to high

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

and with the Uno i get this library error:

In file included from C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\includes/platform/FONAPlatStd.h:33:0,

             from C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\includes/platform/FONAPlatform.h:40,

             from C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.h:22,

             from C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\Adafruit_FONA.cpp:19:

C:\Users\rene6\Documents\Arduino\libraries\Adafruit_FONA\includes/platform/Arduino.h:34:31: fatal error: freertos/FreeRTOS.h: No such file or directory

#include "freertos/FreeRTOS.h"

                           ^

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

If you are getting errors while compiling for Arduino Uno then it's something on your end (either package installations, libraries, etc.). Sorry, but I don't have time to dig deeper.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Using the LTE_Demo code I have on Github compiles with "ESP32 Dev Board" with the hardware serial change:

`// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three lines
// and uncomment the HardwareSerial line
//#include <SoftwareSerial.h>
//SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
//// Use the following line for ESP8266
////SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX, false, 256); // TX, RX, inverted logic, buffer size
//
//SoftwareSerial *fonaSerial = &fonaSS;

// Hardware serial is also possible!
//HardwareSerial *fonaSerial = &Serial1;

// For ESP32 hardware serial use these lines instead
#include <HardwareSerial.h>
HardwareSerial fonaSS(1);`

from sim7000-lte-shield.

rene6262 avatar rene6262 commented on May 17, 2024

The issues im getting is calling the PostData command, it says const *char to char is -fpermissive or something in that manor.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

But you said when you try compiling the LTE_Demo sketch for Arduino Uno without making any modifications, you get an error. That means something else is wrong.

from sim7000-lte-shield.

Snowfly- avatar Snowfly- commented on May 17, 2024

Hi...
Has there been significant changes on library regarding support on SIM5320 module.
Cause at this moment there comes compiling error 'class Adafruit_FONA_3G' has no member named 'setNetworkSettings'
Using LTE_DEMO example with correct changes to enable the SIM5320

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

It's still supported but a function name was changed from the default Adafruit function name.

from sim7000-lte-shield.

ELNAHUAL avatar ELNAHUAL commented on May 17, 2024

Hi Botletics,
I hope you can help me I'm desperate trying post data to MySQL database with no success.
I'm using an Arduino Mega with FONA 3G with SIM5320A chip and downloaded your library with examples.
I could succesfully post to dweet.io but now I need to modify the sketch to post to database that is password protected and cant find the solution.
I have modified "IoT _Example" using MQTT protocol changing server, serverport, user and key for the ones of MySQL database but had no luck, I'm having below data in serial monitor:
Network status 1: Registered (home)
Connected to cell network!
---> AT+CBC
<--- +CBC: 0,60,3.780V
battery = 3780 mV
Temp: 23.00C 73.40F
Shutting down the MCP9808...

---> AT+CIPSHUT
<--- ERROR

Failed to connect to TCP/IP!
<--- ERROR
Failed to connect to MQTT broker!
Publishing data to their respective topics!
<--- ERROR
Failed to publish data!
<--- ERROR
Failed to publish data!
<--- ERROR
Failed to publish data!
<--- ERROR
Failed to publish data!
---> AT+CIPCLOSE
<--- ERROR
Failed to close connection!
Shutting down...

With a Wi-Fi device I can connect with server using below line:

if (conn.connect(server_addr, 3380, user, password))

but this doesn't work with FONA.

I would really appreciate your help.
Do you have any ideas?
Thank you in advance

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Sorry I don't use MySQL. If you can set up MQTT on it or an HTTP endpoint then the library should work just fine.

from sim7000-lte-shield.

ELNAHUAL avatar ELNAHUAL commented on May 17, 2024

I've been chasing my tail on this, well I'll keep trying.
Thank you.

from sim7000-lte-shield.

fredericodamian avatar fredericodamian commented on May 17, 2024

Hello botletics! Sorry for reusing this issue and thank you very much for this library.
I'm using ESP32 + SIM5320E with LTE Demo code. The dweet post through command '3' is working well (unless by the second return from server which returns that it failed but it posted). When I try to use command 'W' to post data to a website, even with the httpbin post example (I've already tried others website that worked using curl in my desktop) it doesn't work. The log above represents my test:

G
---> AT+CGATT=1
<--- OK
---> AT+CGSOCKCONT=1,"IP","zap.vivo.com.br"
<--- OK
---> AT+CGAUTH=1,1,"vivo","vivo"
<--- OK
---> AT+CIPMODE=1
<--- OK
---> AT+NETOPEN=,,1
<--- Network opened
FONA> 3
---> AT+CHTTPSSTART
<--- OK
Waiting 1s to ensure connection...
---> AT+CHTTPSOPSE="www.dweet.io",443,2
<--- OK
Waiting 1s to make sure it works...
---> AT+CHTTPSSEND=79
<--- >
---> GET /dweet/for/861311006277858?temp=0.00&batt=3700 HTTP/1.1
Host: dweet.io

<--- OK
---> AT+CHTTPSSEND
<--- OK
<--- +CHTTPSSEND: 0
---> AT+CHTTPSRECV?
<--- +CHTTPSRECV: LEN,0
---> AT+CHTTPSRECV=0
<--- ERROR
---> AT+CHTTPSCLSE
<--- OK
<---
---> AT+CHTTPSSTOP
<--- OK
Failed to complete HTTP/HTTPS request...
FONA> W
NOTE: in beta! Use simple websites to post!
URL to post (e.g. httpbin.org/post):
http://httpbin.org/post
Data to post (e.g. "foo" or "{"simple":"json"}"):
foo


---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- ERROR
Failed!
FONA>

Regards!

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Thanks, I'll look into it when I get a chance.

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

So I looked at it and the "W" function was written by Adafruit and it doesn't support the SIM5320. I would recommend just using the "3" option to post data, and in the meantime I'll edit the LTE_Demo so that "W" doesn't show up as an option when SIM5320 is selected.

from sim7000-lte-shield.

ichai05023 avatar ichai05023 commented on May 17, 2024

Hi botletics! First of all, thank you so much for providing this library. It helped me a lot.
Apologies coz I will ask for help this time.

I am reusing the option '3' on your LTE_Demo.ino which sends an HTTP GET request to a website.
However, the shield cannot successfully send the request. Kindly see results from Serial monitor below:

image

I am also trying to send the exact same GET request thru my browser and it works fine.

Regards!

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

First of all, does the dweet example work? And does the domain only accept HTTPS?

from sim7000-lte-shield.

ichai05023 avatar ichai05023 commented on May 17, 2024

Hello, yes it worked on the dweet example. Seems like the shield is working fine and the fault is on the side of the web hosting. Btw, thank you for the response.

from sim7000-lte-shield.

RogerioTostes avatar RogerioTostes commented on May 17, 2024

OK, acabou de carregar um novo arquivo Adafruit_FONA.cpp no ​​repositório. Faça o download e substitua o existente na sua pasta de bibliotecas do Arduino (Documents -> Arduino -> libraries -> Adafruit_FONA por padrão), reinicie o IDE, faça o upload novamente e veja se isso corrigiu os caracteres estranhos.
Hi, I'm having a similar problem, I'm trying to send data via HTTP over a SIM5320A Shield, I've enabled the network and I've used the Adafruit_FONA.cpp file quoted above with the correction but not obitive. I get this error:
<--- OK
---> AT + CHTTPSSEND
<--- OK
<--- + CHTTPSSEND: 0
---> AT + CHTTPSRECV?
<--- + CHTTPSRECV: LEN, 0
---> AT + CHTTPSRECV = 0
<--- ERROR
---> AT + CHTTPSCLSE
<--- OK
(I.e.
---> AT + CHTTPSSTOP
<--- OK
Failed to complete HTTP / HTTPS request ...

from sim7000-lte-shield.

RogerioTostes avatar RogerioTostes commented on May 17, 2024

Oi botletics! Meu problema foi corrigido agora ao encontrar outro site de hospedagem. Mais uma vez, muito obrigado pelo seu trabalho!

Hello, I'm using web hosting and I'm not able to send the data, which site did you use?

from sim7000-lte-shield.

RogerioTostes avatar RogerioTostes commented on May 17, 2024

Hello everyone I'm in need of help to run the post 3g example. I'm having the following error

image

I hope someone can help me, thanks.

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

Hi botletics!

Do you happen to know a way to modify the code for SIM5320A to send data to things.ubidots.com?

I keep getting (Bad Request) or (Your Browser sent an Invalid Request) trying to upload data. Here's the dweet part of the code that I modified:

` case '3': {
// Post data to website via 3G or 4G LTE
float temperature = analogRead(A0)*1.23; // Change this to suit your needs

    // Voltage in mV, just for testing. Use the read battery function instead for real applications.
    uint16_t battLevel = 3700;

    // Create char buffers for the floating point numbers for sprintf
    // Make sure these buffers are long enough for your request URL
    char URL[500];
    char tempBuff[16];
    char battLevelBuff[16];
  
    // Format the floating point numbers as needed
    dtostrf(temperature, 1, 2, tempBuff); // float_val, min_width, digits_after_decimal, char_buffer
    dtostrf(battLevel, 1, 0, battLevelBuff);

    // Construct the appropriate URL's and body, depending on request type
    // Use IMEI as device ID for this example
    
    // GET request
    sprintf(URL, "POST /api/v1.6/devices/cello1/?token=(MYTOKEN) HTTP/1.1\r\nHost: things.ubidots.com\r\nContent-Type: application/json\r\n\r\ncellotemp=100\r\n");
    
    if (!fona.postData("things.ubidots.com", 443, "HTTPS", URL)) // Server, port, connection type, URL      
      Serial.println(F("Failed to complete HTTP/HTTPS request..."));

    break;
  }

`

Would you please help me adjust the code to post data to ubidots as well as dweet?

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Hey, would you do me a favor and post that on the newly-created Botletics forum since it's less of a Github question? Thanks!

(Sorry, just trying to get more people on there lol)

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

OK

from sim7000-lte-shield.

dahdo1m avatar dahdo1m commented on May 17, 2024

Posted

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

Hi botlectics,

I'm using your sketch for sim5320E in Italy with Iliad network (apn: iliad) but everytime I'm trying to connect with HTTP it's saying "Failed to complete HTTP/HTTPS request...". I'm new with this and I tried to shred your program as per my requirement. Can you check and let me know where the trouble is? Thank you

#include "Adafruit_FONA.h"

#define SIMCOM_3G // SIM5320A/E

// For TinySine SIM5320 shield
#define FONA_PWRKEY 8
#define FONA_RST 9
#define FONA_TX 2 // Microcontroller RX (note: won't work on Mega)
#define FONA_RX 3 // Microcontroller TX

char replybuffer[255];

#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

SoftwareSerial *fonaSerial = &fonaSS;

#if defined(SIMCOM_3G)
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
#endif

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
uint8_t type;
char imei[16] = {0}; // MUST use a 16 character buffer for IMEI!


void setup() {
  //  while (!Serial);

  pinMode(FONA_RST, OUTPUT);
  digitalWrite(FONA_RST, HIGH); // Default state

  pinMode(FONA_PWRKEY, OUTPUT);

  Serial.begin(9600);
  Serial.println(F("FONA basic test"));
  Serial.println(F("Initializing....(May take several seconds)"));

  fonaSS.begin(9600); // Default SIM7000 shield baud rate

  Serial.println(F("Configuring to 9600 baud"));
  fonaSS.println("AT+IPR=9600"); // Set baud rate
  delay(100); // Short pause to let the command run
  fonaSS.begin(9600);
  if (! fona.begin(fonaSS)) {
    Serial.println(F("Couldn't find FONA"));
    while (1); // Don't proceed if it couldn't find the device
  }


  type = fona.type();
  Serial.println(F("FONA is OK"));
  Serial.print(F("Found "));
  switch (type) {
    case SIM5320A:
      Serial.println(F("SIM5320A (American)")); break;
    case SIM5320E:
      Serial.println(F("SIM5320E (European)")); break;

  }

  // Print module IMEI number.
  uint8_t imeiLen = fona.getIMEI(imei);
  if (imeiLen > 0) {
    Serial.print("Module IMEI: "); Serial.println(imei);
  }

  // Set modem to full functionality
  fona.setFunctionality(1); // AT+CFUN=1

  fona.setNetworkSettings(F("iliad")); // For Iliad SIM card

  printMenu();
}


void printMenu(void) {
  Serial.println(F("-------------------------------------"));  

#if !defined(SIMCOM_3G) && !defined(SIMCOM_7500)
  Serial.println(F("[w] Read webpage"));
  Serial.println(F("[W] Post to website"));
#endif
}
  
void loop() {
  Serial.print(F("FONA> "));
  while (! Serial.available() ) {
    if (fona.available()) {
      Serial.write(fona.read());
    }
  }


  char command = Serial.read();
  Serial.println(command);

#if defined(SIMCOM_3G) || defined(SIMCOM_7500)
     // Post data to website via 3G or 4G LTE
        float temperature = analogRead(A0) * 1.23; // Change this to suit your needs

        // Voltage in mV, just for testing. Use the read battery function instead for real applications.
        uint16_t battLevel = 3700;

        // Create char buffers for the floating point numbers for sprintf
        // Make sure these buffers are long enough for your request URL
        char URL[150];
        char tempBuff[16];
        char battLevelBuff[16];

        // Format the floating point numbers as needed
        dtostrf(temperature, 1, 2, tempBuff); // float_val, min_width, digits_after_decimal, char_buffer
        dtostrf(battLevel, 1, 0, battLevelBuff);

        // Construct the appropriate URL's and body, depending on request type
        // Use IMEI as device ID for this example

        // GET request
        sprintf(URL, "GET /dweet/for/%s?temp=%s&batt=%s HTTP/1.1\r\nHost: dweet.io\r\n\r\n", imei, tempBuff, battLevelBuff);

        if (!fona.postData("www.dweet.io", 443, "HTTPS", URL)) // Server, port, connection type, URL
          Serial.println(F("Failed to complete HTTP/HTTPS request..."));
#endif
}


// Power on the module
void powerOn() {
  digitalWrite(FONA_PWRKEY, LOW);
  // See spec sheets for your particular module
#if defined(SIMCOM_2G)
  delay(1050);
#elif defined(SIMCOM_3G)
  delay(180); // For SIM5320
#elif defined(SIMCOM_7000)
  delay(100); // For SIM7000
#elif defined(SIMCOM_7500)
  delay(500); // For SIM7500
#endif

  digitalWrite(FONA_PWRKEY, HIGH);

}

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

The issue is that you are not enabling data. Try the "enableGPRS(true)" command before doing the actual HTTP request.

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

I tried your original one, the problem remains. On "AT+CHTTPACT=?" its showing: Ringing/in progress (outgoing).
And on command 3 its showing:
--> AT+CHTTPSSTART
<--- ERROR
Failed to complete HTTP/HTTPS request...

Can you give me a simplified program for https because I want to use it with blynk. Thank you

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Maybe you're connected to a call somehow? Maybe hang up first. Use the LTE_Demo.ino sketch but with #define SIMCOM_3G uncommented and comment out the default #define SIMCOM_7000 and then use command "G" and then command "3" to post data. Sorry, I'm not in the position to make customized code for people.

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

So I did like this:

#include "Adafruit_FONA.h"

// Define *one* of the following lines:
//#define SIMCOM_2G // SIM800/808/900/908, etc.
#define SIMCOM_3G // SIM5320A/E
//#define SIMCOM_7000 // SIM7000A/C/E/G
//#define SIMCOM_7500 // SIM7500A/E

// For TinySine SIM5320 shield
#define FONA_PWRKEY 8
#define FONA_RST 9
#define FONA_TX 2 // Microcontroller RX (note: won't work on Mega)
#define FONA_RX 3 // Microcontroller TX

// ESP8266 + SIM7000 shield
//#define FONA_PWRKEY 14 // D5 on NodeMCU
//#define FONA_RST 12 // D6 on NodeMCU
//#define FONA_TX 4 // D2 on NodeMCU, microcontroller RX
//#define FONA_RX 5 // D1 on NodeMCU, microcontroller TX

// For SIM7000 shield
//#define FONA_PWRKEY 6
//#define FONA_RST 7
//#define FONA_DTR 8 // Connect with solder jumper
//#define FONA_RI 9 // Need to enable via AT commands
//#define FONA_TX 10 // Microcontroller RX
//#define FONA_RX 11 // Microcontroller TX
//#define T_ALERT 12 // Connect with solder jumper

and changed "fona.setNetworkSettings(F("iliad"))", then I'm getting the following:

FONA> G
---> AT+CGATT=1
<--- OK
---> AT+CGSOCKCONT=1,"IP","iliad"
<--- OK
---> AT+CIPMODE=1
<--- ERROR
Failed to turn on
FONA> 3
---> AT+CHTTPSSTART
<--- ERROR
Failed to complete HTTP/HTTPS request...
FONA>

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Try to hang up with "h" and then do "g" then "G" then "3".

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

This is how it's coming. What could be the problem?

FONA> h
	---> ATH
	<--- OK
Failed
FONA> g
	---> AT+NETCLOSE
	<--- +IP ERROR: Network is already closed
Failed to turn off

ERROR
FONA> G
	---> AT+CGATT=1
	<--- OK
	---> AT+CGSOCKCONT=1,"IP","iliad"
	<--- OK
	---> AT+CIPMODE=1
	<--- OK
	---> AT+NETOPEN=,,1
	<--- Network opened
FONA> 3
	---> AT+CHTTPSSTART
	<--- OK
Waiting 1s to ensure connection...
	---> AT+CHTTPSOPSE="www.dweet.io",443,2
	<--- OK
Waiting 1s to make sure it works...
	---> AT+CHTTPSSEND=81
	<--- >
	---> GET /dweet/for/867057031039730?temp=687.57&batt=3700 HTTP/1.1
Host: dweet.io


	<--- OK
	---> AT+CHTTPSSEND
	<--- OK
	<--- +CHTTPSSEND: 0
	---> AT+CHTTPSRECV?
	<--- +CHTTPS: RECV EVENT
	---> AT+CHTTPSRECV=558
	<--- OK
	<--- 
+CHTTPSRECV: DATA,378
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Content-Length: 213
Date: Mon, 05 Aug 2019 17:47:30 GMT
Connection: keep-alive

{"this":"succeeded","by":"dweeting","the":"dweet","with":{"thing
	---> AT+CHTTPSCLSE
	<--- OK
	<--- 
	---> AT+CHTTPSSTOP
	<--- OK
Failed to complete HTTP/HTTPS request...
FONA> 

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Not sure why it's saying it failed, but that's on the library side. As you can see from the server response, it posted successfully.

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

So should I reinstall everything?

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

No, it's doing what it should be doing correctly. The only reason it's saying "Failed to complete HTTP/HTTPS request..." is because in the library file it's checking for a "+CHTTPSSTOP: 0" response when it sends "AT+CHTTPSSTOP" but it didn't get that response. It might be the firmware you're running or something, I'm not sure. What you could easily do is go into the library file and instead of lines 1929-1930 just write getReply(F("AT+CHTTPSSTOP"));

from sim7000-lte-shield.

Barnik12 avatar Barnik12 commented on May 17, 2024

I'll now do what you suggested but 5 minutes ago I got this. What does "+CHTTPSNOTIFY: PEER CLOSED" means?

FONA> G
	---> AT+CGATT=1
	<--- OK
	---> AT+CGSOCKCONT=1,"IP","iliad"
	<--- OK
	---> AT+CIPMODE=1
	<--- OK
	---> AT+NETOPEN=,,1
	<--- Network opened
FONA> 3
	---> AT+CHTTPSSTART
	<--- OK
Waiting 1s to ensure connection...
	---> AT+CHTTPSOPSE="www.dweet.io",443,2
	<--- OK
Waiting 1s to make sure it works...
	---> AT+CHTTPSSEND=101
	<--- >
	---> GET /dweet/for/T+CGPSOUT=000?temp==%s HTTP/1.1
Host: dweet.io

&batt= HTTP/1.1
Host: dweet.io


	<--- OK
	---> AT+CHTTPSSEND
	<--- OK
	<--- +CHTTPSSEND: 8
Failed to complete HTTP/HTTPS request...
FONA> 
+CHTTPSNOTIFY: PEER CLOSED

from sim7000-lte-shield.

botletics avatar botletics commented on May 17, 2024

Not sure why you're getting that. Looks like this time it didn't work.

from sim7000-lte-shield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.