Skip to content

Shield Demo

Timothy Woo edited this page Jul 8, 2018 · 6 revisions

Go back to File -> Examples -> Adafruit FONA Library but choose the "LTE_Demo" example sketch. Again, make sure the pin definitions are correct. Upload this sketch and open the serial monitor! It should communicate with the LTE module, print out the IMEI number and print a big list of options for you to test. By default the serial monitor baud rate should be set to 115200 and you will need to choose "Both NL and CR" (newline and carriage return) in order to send the commands properly (especially things like phone calling, etc. where you need to enter other info into the serial monitor after selecting a menu option). At the top of the serial monitor simply enter the letter of the function you want to test and press enter (or click "Send" at the top right of the serial monitor).

Set the APN

At the end of the setup() function you will see a line like "fona.setGPRSNetworkSettings(F("hologram"));" which sets the Access Point Name (APN). You will need this line to access the web! However, keep in mind that you must first run the command "G" (see two sections ahead) in order for the APN to actually get set. The APN is specific to your SIM card and carrier and you should check its documentation. Usually you don't need a username and password, but again, that depends on your carrier and SIM card.

Note on Baud Rate

By default the SIM7500 runs at 115200 baud but this is too fast for software serial to reliably operate on and characters might randomly appear as square boxes or other odd symbols (for example, an "A" could show as "@"). In order to fix this I've added baud rate setup in the setup() function of the example sketches that starts at 115200 (default baud) then configures the module to 4800 baud. When the sketch first starts it should look like this:

Please note that the first time you upload the Arduino sketch to your board, you might see the "---> AT" commands scrolling seemingly indefinitely. This is because the module hasn't yet turned on (it takes about 15s for the SIM7500 to power up) and all you need to do is wait for the module to power up (the green LED), then press the Arduino's reset button and it should find the module right away. And that's it! You should then see the IMEI number and then following that will be a giant list of command options to try out!

Note that if you are using hardware serial (like if you are externally wiring the SIM7500 board to another board) you most likely won't have to deal with the baud rate reset issue since you can simply use the default 115200. However, it's good just to be aware of this!

Trying out Commands!

  • Type "n" and press enter to check the network registration. You should see "Registered (home)" on most SIM cards, or "Registered (roaming)" if you're using the Hologram SIM. If not, check if your antenna is attached properly! You may also need to run the "G" command (described below) first in order to set the APN. (Note: Some SIM cards require auto APN settings and you can configure this with the command "AT+CAPNMODE=0" and leave the Arduino line commented out)

  • Check the network signal strength by entering "i". You should get an RSSI value; the higher this value the better! Mine was 31, which indicates the best signal strength bracket! If you are not connected to a network you will get 99.

  • Now that you're connected, let's see some more details about the connection by using the "1" command. The following example shows that we are currently connected to LTE on band 2. Check the command "AT+CPSI" in the AT command manual for more info on the other values listed there. The second command ("AT+COPS?") gives you the current mode and carrier name. Since I'm using a Hologram SIM card in the United States it shows "AT&T Hologram" and the number 7 after it also indicates that it's traditional LTE.

  • You can also check the module's supply voltage with the "b" command:

  • To enable GPRS (2G data connection), enter "G" to enable GPRS. This also sets the APN and is crucial for getting your device connected to the web! If you see "ERROR" try turning GPRS off by using "g" then try again. For 4G data you shouldn't need this, and you can proceed with testing the next command.

  • Now let's test sending dummy data to dweet.io, a free cloud API by entering "3" in the serial monitor. You should see it run through some AT commands and receive the server response with 200 success code.

  • Now it's time to test the GPS! Enable power to the GPS using "O" (upper-case "oh", not "zero")

  • Enter "L" to query the location data. Note that you might have to wait a little bit before it will get a fix on the location and you may get a empty values (nothing) separate by commas like in the image below. You can keep entering "L" until it shows you some data!

  • Once it gives you data, copy and paste it into Microsoft Word or a text editor so that it's easier to read. You will see that the first two numbers are the latitude and longitude and the next two numbers are the date and time. Right after the time value is the altitude at your location. To verify that the GPS location is indeed accurate, go to this online tool and search your current location. It should give you the lat/long and altitude. However, you will notice that the lat and long values from the module are in decimal format formatted differently than the values from the website. To convert one to the other, simply use [this lat/long decimal convertion tool]. For example, if you received "3310.123456,N,08400.345678,W" from the module, type in the following numbers into the boxes:

Notice that the latitude is positive if you see "N" (North), because all latitude values North of the Equator are positive, and likewise if you see "E" (East) for the longitude it should be positive, which means "W" will be negative (everything West of the Prime Meridian).

  • If you don't need GPS you can turn it off with "o" (lower case!). This saves about 30mA so for low-power applications this is something you should definitely do!

Pretty cool huh?

IoT Example: GPS Tracking!

Now that you have verified that your module is working as expected, let's have some more fun with a practical example of how we can use the LTE shield to send data to the cloud! First open the "IoT_Example" sketch. This example sends GPS location and bearing data as well as temperature and supply voltage to a free cloud API called dweet.io or alternatively, to a free IoT dashboard service called ThingsBoard.io. Upload the sketch and watch the serial monitor in amazement as the LTE shield works its magic!

Check out the following Instructables I made on how to turn your shield into a GPS tracker!