botletics / SIM7000-LTE-Shield

Botletics SIM7000 LTE CAT-M1/NB-IoT Shield for Arduino
https://www.botletics.com/products/sim7000-shield
GNU General Public License v3.0
477 stars 215 forks source link

Failed to enable GPRS #52

Closed ammarqs closed 5 years ago

ammarqs commented 5 years ago

My previous issue was resolved. I was missing a library. After uploading the IoT_example code, and changing the APN to match our providers APN, the system is trying to enable GPRS but fails. Keep so retrying. image

botletics commented 5 years ago

Just test them first and make sure it connects. You can send AT commands using the LTE_Demo sketch using the "S" command with "Both NL & CR" enabled in serial monitor. Read more about that here. The AT+CGDCONT command is already done in the "setNetworkSettings()" function but you need to specify the APN in line 208. There's no way of knowing which network you want to connect with (2G, LTE CAT-M with AT&T, or Verizon, etc) so it's not already automated in the sketch.

ammarqs commented 5 years ago

Already doing that: image

botletics commented 5 years ago

Yea but what about the other commands? That's just the AT+CGDCONT command.

ammarqs commented 5 years ago

Yes got it. Trying to create Serial TUBE. wont do it... lets give it some time i guess.

botletics commented 5 years ago

You need to type the commands in the serial monitor. It doesn't do it automatically.

botletics commented 5 years ago

The serial tube feature allows you to send AT commands to the module without running another piece of code separately. It's just a handy feature.

ammarqs commented 5 years ago

Timothy, I got the communication to work..thats good news. Now i have been having problems trying to send long AT commands. The serial port only prints a part of the message and garbages everything else. image

I tried doing the AT+HTTPPARA="CID",1 But it only prints that much. And this is not the only one, but has been going on. any fixes?

botletics commented 5 years ago

Not sure what's going on there; you shouldn't have that problem and I don't have that problem.

ammarqs commented 5 years ago

cant fix it.. any advise?

botletics commented 5 years ago

Sorry I am very busy right now. I will try and investigate the issue. In the meantime just sent AT commands via USB.

botletics commented 5 years ago

OK actually I found the issue. Just change

Serial.begin(115200);

to

Serial.begin(9600);

and open your serial monitor at 9600.

ammarqs commented 5 years ago

Timothy, I received an update for the library today, and after doing that, the old files got deleted?

botletics commented 5 years ago

I'm not sure what you mean. I did not delete anything, I just updated them.

ammarqs commented 5 years ago

actually there are multiple FONA libraries overlapping. After the update, the FONA library went back to the old version. So i had to redo the process again of including the LTE library.

botletics commented 5 years ago

Please delete any other libraries and only use the one on this Github page.

ammarqs commented 5 years ago

hey timothy, Quick question here. once we turn on the system fresh and connect the battery pack, what is the best command to check if the system is connected to the network before turning on gprs and assigning APN.?i checked that the at_creg? wont work here, because there is no setting assigned yet.

ammarqs commented 5 years ago

in other words, the command to check that the sim7000 is ready to accept setting parameters.

botletics commented 5 years ago

I'm not sure what your question is. If you want to check if the module is powered on and ready to receive AT commands, just send "AT" until it responds. This is exactly what the LTE_Demo initialization code already does.

ammarqs commented 5 years ago

No not that. Ok so here is the situation, when i freshly power on the circuit, meaning, connecting the lithium battery and powering up the controller with 5VDC, i have an system initialization function which sends commands immediately to the modem to set the parameters. BUT, the modem takes time to start up, and takes time for the "Done" light to come on. So the AT commands send back an error. So my question is, how would be know that the modem is ready to receive system configuration commands? It will receive the AT command anytime, but wont receive the APNs and other configuration unless its given a little time to startup. So thats what i am looking for, a command that will keep checking if the modem is ready to receive configuration messages.

botletics commented 5 years ago

I think you meant the "PWR" LED, not the "DONE" LED. The "DONE" LED is for LiPo battery charging status, and the "PWR" LED shows the SIM7000's power status.

There are two things you could do:

  1. Send AT commands until you receive a response, like I said earlier. I'm not sure why you are saying this is not an option...
  2. Include a delay(4000) before sending AT commands to make sure the module is on

Think about it, if you can't send commands to the modem (because it's not on yet), how are you going to have a magic "command that will keep checking if the modem is ready to receive configuration messages"?

ammarqs commented 5 years ago

ok never mind, i think i am not explaining it right. Lol. Thank you anyway. :)

ammarqs commented 5 years ago

image so this is what happens when i power on the unit fresh. i get error. but after a while, say 1-2 min, i reset the controller, and everything works fine.

botletics commented 5 years ago

Probably because you tried using AT+CGATT=1 before even checking if you were connected to a network. So all you have to do is loop AT+CGREG? until you see it's connected, then proceed to AT+CGATT=1. All this is already done in the IoT_Example sketch.

ammarqs commented 5 years ago

Ok thanks. Right, but the only issue while using the IoT_Example sketch is that i cannot configure it to configure for AT&T network. I am using the code you gave me above the other day to do that. That is why i am trying to write my own script for that.

botletics commented 5 years ago

If you use the latest version of the library you will see that the IoT_Example sketch has a commented out block of code:

/*
// Other examples of some things you can set:
fona.setPreferredMode(38); // Use LTE only, not 2G
fona.setPreferredLTEMode(1); // Use LTE CAT-M only, not NB-IoT
fona.setOperatingBand("CAT-M", 12); // AT&T uses band 12
//  fona.setOperatingBand("CAT-M", 13); // Verizon uses band 13
fona.enableNetworkTimeSync(true);

fona.enableSleepMode(true);
fona.set_eDRX(1, 4, "0010");
fona.enablePSM(true);
// Set the network status LED blinking pattern while connected to a network (see AT+SLEDS command)
fona.setNetLED(true, 2, 64, 3000); // on/off, mode, timer_on, timer_off
fona.setNetLED(false); // Disable network status LED
*/

If all you want to do is configure for AT&T then just uncomment these lines:

fona.setPreferredMode(38); // Use LTE only, not 2G
fona.setPreferredLTEMode(1); // Use LTE CAT-M only, not NB-IoT
fona.setOperatingBand("CAT-M", 12); // AT&T uses band 12
botletics commented 5 years ago

That is also explained in this wiki page

ammarqs commented 5 years ago

This is excellent. Thank you for including these items. Do you, somewhere on your wiki page, summarize all the functions available to use? all the fona.functions and some brief info to quickly read about it and implement it?

botletics commented 5 years ago

No I don't, but now that you mention it, that reminds me I need to create such a page. :)

ammarqs commented 5 years ago

image Taking a long time for me to figure out why, may be you can help.

botletics commented 5 years ago

Are you using the Botletics SIM7000 shield or some other hardware?

By the way, I'm frantically typing away to document every single function available in the library on this wiki page. Ugh, taking foreeevver.

ammarqs commented 5 years ago

I am using your hardware. The SIM7000G. both antennas connected. cant figure out whats going on. The page is doing good. This is some amazing commitment.

botletics commented 5 years ago

Make sure the antenna wires are criss-crossed. They are labeled "GPS" and "LTE" on both the antenna and the board.

ammarqs commented 5 years ago

Yup.. thats how its been from the beginning. criss-crossed.

botletics commented 5 years ago

Are you sitting inside a metal/concrete building? What happens if you go near a window?

ammarqs commented 5 years ago

Concrete. Windows next to me. gates open. Nothing changes.

ammarqs commented 5 years ago

Wait.. worked.. just now. didnt change anything..

botletics commented 5 years ago

(continues typing function descriptions...)

ammarqs commented 5 years ago

Hey, Would this adafruit module work with the image transfer tutorial you have? https://www.adafruit.com/product/358 I will be using the same camera, along with this screen and the sd card slot at the back to store images. My main agenda is taking good quality pictures and storing it in the sd card. The screen is a good option to display other information. Or do you recommend something else?

botletics commented 5 years ago

Unfortunately I don't have time to finish the FTP image transfer tutorial so you may have to completely figure it out on your own. Also, there are some issues with being able to send huge amounts of data via FTP which would involve integrating the SD card functions inside the library and all sorts of bothersome stuff.

But yes, if you wanted to store data onto an SD card and show it on a TFT then that product would work fine.

ammarqs commented 5 years ago

Right, i am not looking for any network related things here. The only purpose for the camera system would be to take pics and store it in the sd card. No transfer stuff. May be i will be implementing a bluetooth module. so one end of the system takes the pictures and sends it over bluetooth to a near by hidden system with the sd card installed. I am also considering: https://www.adafruit.com/product/802 This has built in push buttons and joystick for config as well.. the only issue i see with this is making it as a marketing product. the screen and buttons dont have enough height to mount on an enclosure.

botletics commented 5 years ago

Sorry, not trying to sound mean but I'm not here to give consultations about everyone's projects. But yea looks like those modules could work fine.

ammarqs commented 5 years ago

Hey Timothy, I noticed something, the IoT example program freezes here sometimes. image what do you think?

ammarqs commented 5 years ago

and again: image

It runs for some time and then hangs on after displaying the battery voltage.

botletics commented 5 years ago

That probably means your I2C isn't connected. The code will hang if the temperature sensor is not connected.

ammarqs commented 5 years ago

Hey, SO quick question. Would the price on the product be same if we buy a bulk quantity? Our project is taking a good turn here, so i am hoping we can order in quantity to sample it out to our customers. Let me know.

botletics commented 5 years ago

Hi, bulk pricing is already set on Amazon.com and right now there's a 10% off promo until Dec 12th.

ammarqs commented 5 years ago

Is there an update coming out soon? just so that once we start marketing this, and it discontinues, that would be weird.

botletics commented 5 years ago

The only "update" is the next version will have a solder jumper to use an active GPS antenna instead of passive, and the SIM7000A will be a single, combined version (no A-A and A-V versions). However, the only difference is firmware. The SIM7000G modules will also have CE and FCC certification.

ammarqs commented 5 years ago

So technically nothing will change on our side. We buy it, install it and program it and its done. That is good.

botletics commented 5 years ago

Correct.