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
483 stars 215 forks source link

DFRobot SIM7000 with botletics library GPRS and GPS wont work #293

Open danielkp1234 opened 2 years ago

danielkp1234 commented 2 years ago

Hello. Firstly I know that this library isn't supposed to be used with the DFRobot sim7000 but I have been recommended by multiple people to use this library since apparently, the DFRobot library won't work and is unstable.

I have been trying to make a GPS tracker using a DFRobot sim7000 to try and send longitude and latitude to an MQTT server using a 3g/4g connection but I can’t seem to get it working with either library.

I read a guide and came up with this code for submitting longitude and latitude to an MQTT server using cellular. https://pastebin.com/pj1eaDzP

This is the output of the Serial Monitor image

and this is the code that causes the errors. I have also tried commenting out the EnableGPS code to see if GPRS would work but that doesn’t work either. image

wilba84 commented 2 years ago

Ive been playing with this all day. The issue you are having is connecting the arduino and sim7000 via serial. You cannot use hardware serial as the arduino uno only has a single hardware serial port, which is already linked to the onboard usb converter for debugging.

For the last 6 hours ive been trying to use software serial but the the sim7000 now doesnt work at all, my sim7600 doesnt work with soft serial, but does with hw serial.

If possible, get your hands on a mega and use hw serial

Mark-Wills commented 2 years ago

It might be that the SIM7000 wakes up with a default baud rate higher than the software serial port can support.

Often, you can autobaud the serial port. Have you tried sending multiple AT commands (just AT on its own) until you get an OK response. When you get an OK back, the modem has understood your AT command at the lower baud rate. Once you have set the baud rate, you can fix the baud rate (so you don't need auto baud any more) with AT+IPR command.

This is documented in section 3 of this document: https://simcom.ee/documents/SIM7000x/SIM7000%20Series%20UART%20Application%20Note_V1.00.pdf

(note: https is not working for the site above, so I will paste section 3 in below):

3 Synchronize baud rate SIM7000 supports auto baud rate, but the rate only supported on 9600, 19200, 38400, 57600, 115200. If users need to change to other baud rate, it needs to switch as AT command AT+IPR. Auto baud rating allows SIM7000 module to automatically detect the baud rate based on the host device. Host device must synchronize the baud rate with SIM7000 module first before communication. Host must send “AT” string to synchronize the module, if module matches the baud rate it will respond with response: “OK”, if no response is reported, host must send the synchronize string again until the response is received. The function is supported in “AT+IPR”. When “AT+IPR” is set to 0,auto baud is activated. If TA sends “AT+IPR=0” command to the modem, then module will be saved as auto baud mode.

Are you using a Botletics board, or are you communicating with a SIM7000 module by some other means? If you are not using a Botletics board then you will need level conversion. The SIM7000 UART interface accepts 1.8V maximum (see above document, section 2.2). If you try to run it with 5V (e.g. directly from an Arduino) then you will damage the SIM7000. You need level shifters, at least on the TX line from the Arduino to the RX line of the SIM7000. A 10K and a 5.6K resistor will do this also, as follows:

TX LINE FROM ARDUINO--->---10K---#---5.6K--->---GND

Connect the SIM7000 RX line where the # is shown, and you should get 1.8V. This is not relevant if you're using the Botletics board as it should do the level shifting for you.

Regards

Mark

On Wed, Apr 20, 2022 at 8:15 AM wilba84 @.***> wrote:

Ive been playing with this all day. The issue you are having is connecting the arduino and sim7000 via serial. You cannot use hardware serial as the arduino uno only has a single hardware serial port, which is already linked to the onboard usb converter for debugging.

For the last 6 hours ive been trying to use software serial but the the sim7000 now doesnt work at all, my sim7600 doesnt work with soft serial, but does with hw serial.

If possible, get your hands on a mega and use hw serial

— Reply to this email directly, view it on GitHub https://github.com/botletics/SIM7000-LTE-Shield/issues/293#issuecomment-1103551385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAGDCW25ECIBYCUGRCDTE3VF6VJ7ANCNFSM5TZWE6PQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

danielkp1234 commented 2 years ago

Ive been playing with this all day. The issue you are having is connecting the arduino and sim7000 via serial. You cannot use hardware serial as the arduino uno only has a single hardware serial port, which is already linked to the onboard usb converter for debugging.

For the last 6 hours ive been trying to use software serial but the the sim7000 now doesnt work at all, my sim7600 doesnt work with soft serial, but does with hw serial.

If possible, get your hands on a mega and use hw serial

Do you get GPS and cellular connection working with mega board?

@Mark-Wills I didn't really understand very much of what you wrote sorry but i am using a DFRobot SIM7000 shield stacked on top of an Arduino UNO

I tested everything with AT Command Tester (https://m2msupport.net/m2msupport/download-at-command-tester/) and both cellular connection was working and I could get an IP and GPS also works so the problem is library-related. If this library isn't going to work for me how would I go about debugging and finding out why the attacthService function in the DFRobot library doesn't work since the GPS features in the DFRobot library works

Here is DFRobot SIM7000 library with the only change being made is changing the APN from cmnet to internet in attacthService void https://gist.github.com/danielkp1234/ab2ea90e5b47bd3070b7c0707d06bb61

wilba84 commented 2 years ago

I have had cellular and gps working on the sim7000. Unfortunately My module died yesterday or I would send you some screenshots

danielkp1234 commented 2 years ago

I have had cellular and gps working on the sim7000. Unfortunately My module died yesterday or I would send you some screenshots

Damn thats sucks. Do you know how i could start debugging the DFRobot SIM7000 libary since it kinda works its only the celluar part of the libary that has some kind of error since the same AT commands work when ran using AT command tester

wilba84 commented 2 years ago

The screenshot you sent above for the serial monitor, the sim7000 isnt actually replying, its a false flag, hence being detected as sim7500. Are you plugging the usb directly into the sim7000 to use the AT Command tester?

danielkp1234 commented 2 years ago

The screenshot you sent above for the serial monitor, the sim7000 isnt actually replying, its a false flag, hence being detected as sim7500. Are you plugging the usb directly into the sim7000 to use the AT Command tester?

Yes, i am

wilba84 commented 2 years ago

You need to establish a serial connection from UNO>SIM7000, either with software serial or hw serial. From memory if you put a blank sketch on the arduino and move the serial switch to 0/1, you should be able to plug usb into the arduino, open serial monitor and send AT commands

danielkp1234 commented 2 years ago

Well, if this wont work imma just going to try to find the issue in the attacthService function in the DFRobot libaray its properly some simple thing that is wrong. I just dont know how to debug it

DevinCarpenter commented 1 year ago

@danielkp1234 any update on your issue?