Introduction: LTE Arduino GPS Tracker + IoT Dashboard (Part 1)
Introduction
What's up guys! This Instructable is a follow-up of my first Instructable on using the Botletics LTE/NB-IoT shield for Arduino so if you haven't already, please read it to get a good overview of how to use the shield and what it's all about. In this tutorial I'll focus on IoT data logging, and specifically, GPS and temperature tracking and provide you will all the code and guidance you'll need to hit the road and test it out!
This Instructable is mainly focused on the LTE shield that I personally designed and built, but everything here (including the Github Arduino library) should work on SIMCom's 2G and 3G modules like the SIM800/808/900/5320 as well since it's just an updated version of the Adafruit FONA library. Regardless of hardware the concept is exactly the same and you can do lots of cool stuff with this, including sensor data logging, remote weather monitoring, auto theft karma GPS tracking, etc... so read on!
Step 1: Gather Parts
The list is the same as in my first tutorial and is really simple!
- Arduino Uno, Mega, or Leonardo. Alternatively you can use any other 3.3V or 5V microcontroller but you would have to wire up the pins externally.
- Botletics SIM7000 Shield Kit (comes with the shield, dual LTE/GPS uFL antenna, and stacking female headers). Make sure you go through this tutorial to select an appropriate version!
- Hologram SIM card. The first SIM card (called the "developer" SIM card) is completely free and comes with 1MB of data per month! In the USA you will most likely be on the Verizon network if you use the Hologram SIM card. You can also pick it up alongside the Botletics shield if that's any more convenient.
- 3.7V LiPo battery (1000mAH or greater capacity recommended).
- USB cable to program your Arduino or to power it.
For the GPS tracking test!
- You can use a car USB adapter to power your Arduino while testing the shield on the road.
- Alternatively, you can use a battery pack (7-12V) to power the Arduino via the VIN and GND pins.
Step 2: Physical Assembly
Now that you have all your parts, here's a quick recap of what you need to do to set up your hardware:
- Solder the stacking female headers onto the shield. See this tutorial on how to do that.
- Plug the shield into the Arduino, making sure to line up all the pins so you don't damage them!
- Insert the SIM card as shown in the picture. The metal contacts face downward and make note of the location of the notch in the corner.
- Plug in the LiPo battery to the JST connector on the shield
- Plug in your Arduino to your computer using a USB cable. You might notice that the shield's green power LED doesn't light up. That's perfectly normal because the shield's PWRKEY pin needs to be pulsed low for a little bit in order to turn it on. The example Arduino sketch in the following section will take care of that for you!
- Attach the dual LTE/GPS antenna to the uFL connectors at the right edge of the shield. Note that the wires will criss-cross so don't plug in the wrong ones!
- You're all set for the software!
Step 3: Arduino Setup & Device Testing
Arduino IDE Setup
If you haven't already, please see the "Arduino IDE Setup" and "Arduino Example" steps in the main product Instructable to make sure your board is functioning properly. In those instructions you'll need to download the library on the Github page and open the example code "LTE_Demo". After following those instructions you should have tested the network connection, GPS, and posting data to dweet.io.
IoT Example Sketch
Now that you've tested the core features of your shield, load the "IoT_Example" sketch in Arduino IDE. You can also find it here on Github. Upload this code to your Arduino and open the serial monitor and you should see the Arduino find the SIM7000 module, connect to the cell network, enable GPS and keep trying until it obtains a fix on location, and post the data to dweet.io. This should all run without changing any line of the code, assuming you're using the LTE shield and Hologram SIM card.
By default you will see the following line define the sampling rate (well, actually the delay in between posts).
#define samplingRate 30 // The time in between posts, in seconds
If this line is left uncommented, the Arduino will post data, delay 30s, post data again, repeat, etc. During the 30s delay you can do things like put the Arduino in low-power mode and fancy things like that, but to keep things simple I'll just use the delay() function to pause the operation. If you comment this line the Arduino will post data then go directly to low-power sleep mode indefinitely until you press the reset button on your Arduino. This is useful if you are testing something and don't want to burn your precious free data (although honestly each post uses practically nothing) or maybe you have external circuitry to reset the Arduino (555 timer? RTC interrupt? Accelerometer interrupt? Temperature sensor interrupt? Think outside the box!). Actually in the Burgalert 7000 tutorial I show how you can use a PIR motion detector to wake up the microcontroller.
The next line sets whether the shield will turn off after posting data or remain on. You might opt for the former choice by uncommenting the line if you're only sampling once in a while, but if you have a relatively high sampling rate you will want to leave the line commented so that the shield stays on and doesn't have to re-initialize, re-enable GPRS and GPS, etc. When the shield is left on it's able to post extremely quickly!
//#define turnOffShield // Turn off shield after posting data
Also keep in mind that this example automatically fetches the module-specific and globally-unique IMEI number of the SIM7000 and uses it as the device ID (or "name" if you prefer) to identify the device when it posts data to dweet.io. You can change this if you want, so I'd thought I'd just let you know :)
To check if your data is actually being sent to dweet.io, simply fill in the appropriate info and copy/paste the URL into any browser:
dweet.io/get/latest/dweet/for/{deviceID}
where {deviceID} should be substituted with the IMEI number which is printed out in the serial monitor at the beginning, right after the Arduino finds it. After entering that URL in your browser you should see a JSON response like the following:
{"this":"succeeded","by":"getting","the":"dweets","with":[{"thing":"112233445566778","created":"2017-12-28T23:32:39.803Z","content":{"lat":11.223344,"long":-55.667788,"speed":10,"head":75,"alt":330.7,"temp":21.2,"batt":3630}}]}
Looking at the "content" you should see the latitude, longitude of your location, your speed (in kilometers per hr), direction heading (degrees, with 0 deg being North), altitude (meters), temperature (*C, but feel free to convert in the code), and the supply voltage in milli-Volts (which is VBAT, the voltage of the battery). For more info on the NMEA data string you can take a look at page 149 of the SIM7000 AT command manual.
Once you verify that your setup is successfully sending data to dweet, let's set up the dashboard to view all our data on a nice interface!
Step 4: Freeboard.io Setup
For this tutorial we'll be using freeboard.io, a really cool IoT dashboard that can connect with numerous cloud platforms like PubNub and dweet, as well as other features like JSON and MQTT. As you probably have guessed we'll be also using dweet.io which is used in the example code from the previous section. As an important note, dragging panes in freeboard.io doesn't seem to work in Chrome so use Firebox or Microsoft Edge instead. If you don't, it can be a real "pane" to re-arrange the items on your screen!
Account & Device Setup
- The first thing you'll need to do is create an account by clicking the red "START NOW" button on the freeboard.io home page, enter credentials, and click "Create My Account". You will then get an email notification confirming your new account.
- Now click "Login" at the top right of the home page and after signing in you should see your "freeboards", which are just dashboards that you set up fr your projects. Obviously if the account is new you will see nothing here so just enter a new project name and click "Create New" near the top right. This will then bring you to an empty dashboard where you can set up the interface just how you like it. In freeboard there you can set up various "panes", and each pane can have a single or multiple "widgets" which are things like graphs, maps, gauges, etc. that display your data in some way.
- The first thing we need to do now is to set up the actual source of data, which is your Arduino + LTE shield. To do that, click "ADD" on the top right under "Datasources". Next, select "Dweet.io" and enter any name you want under the "Name" field. However, make sure that under the "Thing Name" field you enter the shield's IMEI number instead of any arbitrary name, because that's what freeboard will use to pull data from dweet.
- After clicking "Save" you should see your device appear under "Datasources" as well as the last time it sent data to the dweet. You can also click the refresh button to check for the latest values, but freeboard will update by itself so you normally shouldn't have to use that button.
Dashboard Setup
Now let's take a look at how to set up the actual bells and whistles that you want to see on your screen!
- To add a pane, click the "ADD PANE" button at the top left and you will see it add a small window on your screen. However, there's nothing here yet because we haven't added any widgets!
- To add a widget click the little "+" button on the pane. This will bring up a dropdown menu with various widget options. Since we're going to be doing some GPS tracking let's pick the "Google Map" widget. You should then see two fields, the latitude and longitude. In order to fill these out properly your device needs to have posted to dweet already. Assuming it has, you should be able to click "+ Datasource", click on the datasource (the "SIM7000 GPS Tracker"), then click on "lat", which is the variable name that the shield uses when posting to dweet. Repeat the procedure for the longitude field and click the slider at the bottom if you want the map to draw lines between data points to mark where you've been.
- Now you should see a small map of your approximate location! To test if the map works, try changing your current GPS lat/long to something slightly different by changing, for example, the first digit after the decimal point of the lat/long values in the dweet URL that was printed in the serial monitor in Arduino IDE when the shield posted data. After tweaking them, copy and paste the URL and execute it in your browser.
dweet.io/dweet/for/112233445566778?lat=11.223344&long=-55.667788&speed=0&head=10&alt=324.8&temp=22.88&batt=3629
- Now switch back to freeboard and you should see that it graphed your tweaked location and drew an orange line between the points! Cool stuff huh? So I think you get the picture that our GPS tracker will send location data to dweet for you to see it on freeboard in real time or after your adventure is over
Extras
Since our little GPS tracker sends not only lat/long data but also altitude, speed, heading, and temperature, let's throw in a few more widgets to make our dashboard more colorful!
- Let's begin by adding a new pane then to add a gauge within the new pane click the "+" button in the pane and select "Gauge". Just like before, use the datasource and select "speed" as the data we're interested in fetching for this gauge. You should then see a nice gauge on your dashboard!
- Repeat this for the altitude and temperature values.
- Now for the heading let's add a "Pointer" instead. This is essentially a compass because it starts off pointing up (North) at 0 degrees and rotates clockwise for positive headings.. Perfecto!
- To change the size of the pane, hover over the pane which contains the map and you should see a little wrench symbol at the top right. Click that and enter a title for the pane and enter "2" under "Columns" to increase the width of the pane.
- To change the locations of the panes simply drag them around! You can also experiment adding a "Sparkline" which is basically just a line graph so you can see not only the latest data but historic data as well.
Have fun and set it all up how you like it because we're ready to go out on a field trip!
Step 5: Testing
To test your setup I would recommend setting the sampling time to a lower value, like 10-20s so that you can capture your journey with higher resolution. I would also leave the "turnOffShield" variable commented out so that the shield doesn't go to sleep. This allows it to post data in quick succession.
After uploading the code to your Arduino, either get a battery pack (7-12V) to power the Arduino or simply plug the Arduino in using a car USB adapter. You will also need a 3.7V LiPo battery plugged into the shield as mentioned earlier; the shield shown in the picture above is an old version and didn't have LiPo battery support but it's now needed on all newer versions.
Next, open up freeboard somewhere so when you return you can see the results! Once you plug in the Arduino you're good to go! Start driving around, get some coffee, return home, and you should see the data plotted on freeboard. If you really want (I don't recommend this while driving...) you can view the freeboard data on your phone in real time as your friend drives the vehicle. Fun stuff!
Step 6: Results
For this test my dad and I went to get some chicken drums at Trader Joe's (omnomnomnom...) and we collected some pretty accurate data. I had the device send data every 10s and the max speed from the trip was about 92khm (around 57mph) which is quite accurate because we kept an eye on the speedometer the whole time. The LTE shield definitely does its job quite well and sends data to the cloud very quickly. So far so good!
However, perhaps the not-so-good news is that the map widget on freeboard isn't as great as I had originally thought. It doesn't allow you to move the location of your mouse and it stays centered on the last location so it's great for things like a car GPS tracker but not if you want to analyze a completed trip with all the data points, especially if it was a long journey.
In this tutorial we learned how to use the LTE shield as a GPS tracker and data logger and how to quickly view the data on freeboard.io. Now use your imagination and apply it in your own project. You can even add on more shields and turn this thing into a low-power solar data logger! (I might actually be planning on doing a tutorial on that in the future!). Because of the limitations of the freeboard map I'm also planning on making a brand new tutorial on how to make your own Android app that fetches the data from dweet and will allow you to graph the location of the tracker on Google Maps with start, pause, and stop features for your trip! Stay tuned!
- If you liked this project, please give it a heart!
- If you have any questions, comments, suggestions on a new tutorial, or tried this project yourself, definitely comment below!
- Follow me here on Instructables, subscribe to my YouTube channel, or follow me on Twitter to stay updated with my latest Arduino projects! I'm a young engineer with a passion for sharing what I've learned, so there will definitely be some more tutorials soon!
- If you want to support what I do in sharing open source hardware and documenting them thoroughly for educational purposes, consider purchasing your own shield on Amazon.com to play with!

Participated in the
Arduino Contest 2017

Participated in the
Remote Control Contest 2017

Participated in the
Epilog Challenge 9
30 Comments
Question 2 years ago
Question 2 years ago
Hello. I'm having trouble running the LTE shield code: "iot_example". I can't connect to the data network. This message appears:
i'm using HTTP_GET and HTTP_POST
i'm using network data "oi"
I am using OI SIM CARD.
apn: gprs.oi.com.br
login: oi
password: oi
before
//fona.setNetworkSettings(F("your APN"), F("your username"), F("your password"));
fona.setNetworkSettings(F("hologram")); // For Hologram SIM card
after
fona.setNetworkSettings(F("gprs.oi.com.br"), F("oi"), F("oi"));
//fona.setNetworkSettings(F("hologram")); // For Hologram SIM card
Question 3 years ago
Hi Tim,
Similar to Michael_SC I don't seem to be getting any data. I've tested the LTE_Demo successfully and have been able to post data and read the temp and GPS correctly. The tracker code just doesn't seem to be working for me. Any thoughts?
Question 3 years ago
Hello Tim,
I am having issues with the LTE. I’m using the same code per instruction and when I go to the serial monitor, I don’t seem to be getting any data. It recycles the same code in the image provide. What am I doing incorrectly ?
3 years ago
I think this won't work anymore, google maps api are now paid version :') .
I have follow this with raspberry pi and SIM7000C (python), map says "google map can't load data correctly", when I google that, it says api key error.
Question 3 years ago
Hi, will this work with the SIM7000C?
Reply 3 years ago
Yes, as long as you have a proper cellular connection.
Question 3 years ago
Hiii
I have a really short questionn? Is there any alternative to the ?Dont have a huge budget... sorryy
Question 3 years ago
Hi!
I have a SIM7000g connected to my Arudino Uno. I've been trying to get the temperature sensor to work, but it does not work. When the Arduino gets to the "tempsensor.wake();" part, the Arduino/shield (not sure which one) completely resets and goes back to the beginning of my Arudino code. No error, no warnings. It creates an infinite loop that can't be stopped unless I unplug the arduino. Any reasons why this might happen? Also, when I tried to run your IoT_Example code, it said it couldn't find the library for the "tempsensor", so I downloaded the "Adafruit_MCP9808" library from this github ("https://github.com/adafruit/Adafruit_MCP9808_Library") and the result is the infinte looping too. Is this the wrong library? Is there a modified version of the adafruit library for the temp sensor just like the modified "Adafruit_FONA" library?
I look forward to hearing back.
Thanks!
Answer 3 years ago
The library for MCP9808 isn't modified. Try commenting out the wake() line for the sensor.
Reply 3 years ago
Thanks for you response! It didn't work. It would freeze and do nothing once it gets to "tempsensor.readTempC();".
Right now I have the following code:
// tempsensor.wake();
float tempC = tempsensor.readTempC();
Serial.print("measure success");
float tempF = tempC * 9.0 / 5.0 + 32;
Serial.print("Temp: "); Serial.print(tempC); Serial.print("*C\t");
Serial.print(tempF); Serial.println("*F");
The "measure success" or the temp never gets printed in the serial monitor.
Question 4 years ago
Do you know how much data each post uses? I'm trying to determine what my monthly data usage would be based on an estimated number of updates per day. Or can you point me in the right direction for how to figure out how much data each post uses? I'm happy to do the leg work but I can't seem to find the right way to calculate this.
Thanks!
Answer 4 years ago
Please see my long answer on the Amazon page labeled "Q: How long could I power this device with a 2500mAH battery, supposing it makes 1 http request per day?"
https://www.amazon.com/ask/questions/asin/B07H3XKNLH/ref=ask_mdp_dpmw_ql_hza?isAnswered=true
Reply 4 years ago
Thanks for your quick response, I really appreciate it!
I didn't see anything in that long post that had to do with Data usage, it was entirely about power consumption. I realize that data usage will vary greatly based on what you are sending but I am specifically looking for how to calculate the data usage per "post" for instance using this exact instructable example (publishing to Dweet.io).
Reply 4 years ago
Sorry I must've read it wrong. I'm not an expert on the networking side of things but this article might help: https://medium.com/hologram-io/hologram-io-data-usage-breakdown-3fc48f7a24c8
Reply 4 years ago
That is perfect, thanks for the help! I can't wait to give this project a try.
Question 4 years ago on Step 6
Will any sim card work or must it be a hologram sim card? Also does Hologram work in Australia?
Reply 4 years ago
Not every SIM card will work. It must be LTE CAT-M or NB-IoT unless all you're aiming for is 2G, in which case the SIM7000E supports it. The Hologram SIM won't work in Australia for CAT-M or NB-IoT as far as I know, but it might be worth asking them on their forums since they keep their network support updated.
4 years ago
Hello, will this work with passive/active patch gps antena? I saw schematic, you made other part of UFL ground, means I assume , it needs to be connected with a passive antenna,
what is the antenna you will recommend for you circuit. BTW thanks a lot for your good work, we are looking for more module from you in futuer.
Reply 4 years ago
Hi, yes, it needs to be a passive GPS antenna. In the next version I might include a solder jumper for testing active GPS antennas.