Introduction: LTE NB-IoT Shield for Arduino

Picture of LTE NB-IoT Shield for Arduino

Overview

The LTE/NB-IoT shield uses SIMCOM's SIM7000-series cellular modules, which are low-power 4G LTE/NB-IoT modules that support the new LTE CAT-M and NB-IoT technology and also have integrated GNSS (GPS, GLONASS and BeiDou/Compass, Galileo, QZSS standards) for location tracking. There are multiple SIM7000-series modules that cater to different regions around the world, and luckily SIMCOM has made it really easy to identify: SIM7000A (American), SIM7000E (European), and SIM7000C (Chinese). Currently NB-IoT is supported in many countries around the world but unfortunately not in the US, although it's scheduled to be launched by major providers by 2018 and we can still use the LTE CAT-M functionalities!

To use the LTE Shield, simply plug the shield into an Arduino, insert a compatible SIM card, attach the LTE/GNSS antenna, and you're good to go!

UPDATE: The shield no longer needs a LiPo battery to operate! More news on the lastest version later!


Introduction

With the emergence of low-power IoT devices with cellular connectivity and the phase-out of 2G (with only T-mobile supporting 2G/GSM until 202), everything is moving toward LTE and this has left many people scrambling to find better solutions. However, this has also left many hobbyists facepalming with legacy 2G technology like the SIM800-series modules from SIMCOM. Although these 2G and 3G modules are a great starting point, it's time to move forward and SIMCOM recently announced their new SIM7000A LTE CAT-M module at a developer's conference. How exciting! :)

The amazing part of all of this is that SIMCOM made it extremely easy to migrate from their 2G and 3G modules to this new module! The SIM7000-series use many of the same AT commands which minimizes the software development by miles! Also, Adafruit already has a wonderful FONA library on Github that can be used to introduce this new SIM7000 into the party!

What is LTE CAT-M?

LTE CAT-M1 is considered the second-generation LTE technology and is lower-power and more suitable for IoT devices. NarrowBand IoT (NB-IoT) or "CAT-M2" technology is a Low-Power Wide Area Network (LPWAN) technology specifically designed for low-power IoT devices. It is a relatively new technology that is, unfortunately, not yet available in the US, although companies are working on testing and building the infrastructure. For IoT devices using radio technology (RF) there are several things to keep in mind: Power consumptionBandwidthRangePacket size (send lots of dataCostEach of these have tradeoffs (and I won't really explain them all); for example, large bandwidth allows devices to send lots of data (like your phone, which can stream YouTube!) but this also means it's very power-hungry. Increasing the range (the "area" of the network) also increase power consumption. In the case of NB-IoT, cutting down the bandwidth means that you won't be able to send much data, but for IoT devices shooting morsels of data to the cloud this is perfect! Hence, "narrow"-band technology, ideal for low-power devices with little amounts of data but still with long range (wide area)!

The LTE/NB-IoT Shield for Arduino

The LTE shield that I've designed uses the SIM7000-series to enable users to have extremely low-power LTE CAT-M technology and GNSS at the tip of their fingers! The shield also sports a high-accuracy MCP9808 I2C temperature sensor, great for at least measuring something and sending it via LTE! Currently I am using the SIM7000A because I am in the US, but unfortunately we poor souls don't have NB-IoT here yet. However, for those in other places of the world it's as easy as swapping out the SIM7000A with other versions like the SIM7000E and SIM7000C modules.


Since I'm a huge fan of open-source (as you can see from my Reflowduino project) I've made this project completely open-source as well, with special thanks to Adafruit for their FONA library! (And if they'd allow it, I'd call this the "FONA LTE" but I'm not making that official due to copyright purposes lol). You can view all the schematics, EAGLE PCB files, Arduino code, and detailed wiki on the LTE shield Github page!

Step 1: Gather Parts

Picture of Gather Parts

Below is a list of all the parts you will need:

  • Arduino or Arduino-compatible board - The Arduino Uno is the most common choice for this! If you want to use the LTE shield as really a "shield" you should use an Arduino board with the Arduino form factor. Stating the obvious, you will also need a programming cable to upload Arduino sketches to the board!
  • LTE/NB-IoT shield - The shield comes with a dual LTE/GPS uFL antenna and stacking female headers! Note that currently it's out of stock on my website but if you want one please comment or email me at botletics@gmail.com so that I can get the units out to you as soon as I get the next version out!
  • LTE SIM Card - You will need a SIM card that supports 4G LTE. To test it out I used the AT&T Trial SIM (called the "Trio") and it works great! It comes with 300MB of data (more than enough for small projects that only send data to the cloud once in a while), and 300 text messages! Note that it does not support voice, but for most IoT projects this is perfectly fine. Also note that these SIM cards (called "AT&T Control Center SIMs") can only send and receive SMS messages through the "AT&T Control Center" or through various SMS APIs available. So basically instead of texting your phone you would have to text "53340003".

UPDATE: The shield no longer requires a LiPo battery!

Step 2: Assemble the Shield

Picture of Assemble the Shield

In order to use the shield you will need to solder headers onto it unless you don't plan on using this board as a "shield" and more of a standalone module instead, which is also perfectly OK! An example of doing this is using an Arduino Micro as the controller and wiring it up to the LTE module separately.

The most common choice for using the board as an Arduino shield are stacking female headers, which are included with the LTE shield. After soldering the headers, go ahead and place the shield on top of the Arduino board (unless you're using it as a standalone board) and you're ready for the next step!

Note: For tips on how to solder the pins you can visit this page of the Github wiki.

Step 3: Shield Pinouts

Picture of Shield Pinouts

The LTE/NB-IoT shield simply uses the Arduino's pinout but connects certain pins for specific purposes. These pins can be summarized below:

  • EN - This pin controls the voltage regulator on/off when pulled high/low by an Arduino pin. This pin isn't normally connected on the Arduino so you will have to wire it up separately with a jumper wire. You can also cut the "EN" trace next to the pin to disable the pull-up resistor on the EN pin to minimize parasitic current (about 33uA) through the resistor when the EN pin is pulled low. However, if you cut the trace the SIM7000 won't turn on until the Arduino sets the EN pin high.
  • D3 - Connected to the SIM7000's PWRKEY pin
  • D4 - UART Data Terminal Ready (DTR) pin. This can be used to wake the module from sleep when using the "AT+CSCLK" command
  • D5 - Ring Indicator (RI) pin
  • D6 - UART Transmit (TX) pin of the SIM7000 (this means you should connect the Arduino's TX to this!)
  • D7 - UART Receive (RX) pin of the SIM7000 (connect to Arduino's TX pin)
  • D8 - SIM7000's Reset pin (only use this in case of emergency reset!)
  • D12 - Good 'ole D12 on the Arduino, BUT you can connect it to the ALERT interrupt pin of the temperature sensor by soldering a jumper
  • SDA/SCL - The temperature sensor is connected to the shield via I2C

If you are using the board as a standalone module and not as a "shield" you will need to connect the necessary pins AND the 5V and GND pins. Below is a list of the bare minimum requirements for using the SIM7000 module:

  • GND (the logic needs a reference!)
  • 5V (the SIM7000 runs on 3.6V so you should supply at least 4V or so to be safe, but less than 6V!)
  • D6 / SIM7000 TX (TX and RX are for sending AT commands and receiving replies!)
  • D7 / SIM7000 RX
  • SDA/SCL (if you want to use the temperature sensor)

For detailed information about the shield pinouts and what each pin does, visit this Github wiki page.

Step 4: Powering the Shield

Picture of Powering the Shield

UPDATE: You no longer need a LiPo to power the shield!

To power the shield you will need to plug in the LiPo battery into the JST connector. At first you might be wondering if the board is even alive because there won't be any LED's turning on. This is because the "PWR" LED is a power indicator for the SIM7000 module itself, and although you are supplying power you haven't turned the module on yet! This is done by pulsing the PWRKEY low for at least 72ms, which I'll explain later.

The next thing you need to do is power your Arduino because the LiPo battery does not boost up to 5V to supply the Arduino! You can do this either by plugging in the programming cable to supply 5V via USB (which will be used to charge the LiPo battery) OR you can use an external supply like 4x AA batteries, 9V battery, etc. but check the specs for the board you're using for max specs! (The supply on the Arduino Uno should be 7-12V). Note that if you are using an Arduino you can safely power the Arduino via an external power source while also keeping the programming cable plugged in because it has voltage-selection circuitry.

Once you power your Arduino you should see either a red or green LED light up. A red LED indicates that your battery is charging but not fully-charged, and a green LED indicates it's done charging!

Now that you know how to power everything let's move on to the cellular stuff!

Step 5: SIM Card & Antenna

Picture of SIM Card & Antenna

Choosing a SIM Card

Again, your SIM card needs to be able to support LTE and it has to be a "micro" SIM. You can use any LTE SIM card that you would normally use on a smartphone but usually those involve a contract of some sort. However, you can also get a prepaid SIM card but the drawback is that you only really have the option of choosing unlimited data/text/voice for somewhere around $40/month.
For my initial tests I personally used the AT&T Trio SIM card with 300MB data and 300 SMS based on a use-it-or-lose-it plan for 6 months. That is to say, the data or SMS will run out if you use it up or the entire card will expire 6 months after purchasing it, whichever comes first. Again, please note that the 300 SMS on this SIM card can only be used through the "AT&T Control Center" so it won't really be able to text your phone directly. It's really good for general fooling around if you only need a little data and I recommend it for users who don't need voice and unlimited everything because that costs at least $40 per month! However, note that you can only buy it online from AT&T and they charge $5 for standard Fedex shipping. No way around that, but still much cheaper than unlimited plans and you have 6 months to play with it!

Another caveat is that I had to go online and log in to the AT&T dashboard to activate my SIM card by entering the ICCID number printed on the SIM card. After activating the card click on "Launch AT&T Control Center" and it should bring up a new tab. Navigate to the "Devices" tab and you should see your SIM card's stats here. As you use your SIM card you will see the numbers change, and you can even see if your SIM card is being used in real time!

Inserting the SIM Card

First of all you should make have to break the micro SIM out of the normally-sized SIM card holder. On the LTE shield locate the SIM card holder on the left side of the board near the battery connector. The SIM card is inserted into this holder with the SIM's metal contacts facing down and the little notch on one edge facing the SIM card holder.

Antenna Goodness

The LTE/NB-IoT shield comes with a really convenient antenna because it integrates both cellular and GPS antennae in a single piece! It's also flexible (although you shouldn't try to twist and bend it a lot because you might break the antenna wires off the antenna if you're not careful) and has a peel-away adhesive on the bottom for you to stick it onto things! Connecting the wires is super simple: just take the wires and snap them onto the matching uFL connectors on the right edge of the LTE shield. NOTE: Make sure you match up the LTE wire on the antenna to the LTE connector on the shield, and the same with the GPS wire because they're criss-crossed!

Step 6: Arduino IDE Setup

Picture of Arduino IDE Setup

This LTE/NB-IoT shield is based on the Adafruit FONA boards and uses the same library but improved with added LTE support. You can read full instructions on how to install my revised FONA library here on my Github page.

You can also see how to test out the MCP9808 temperature sensor by following these instructions, but here I'll mainly be focusing on the cellular stuff!

Step 7: Arduino Example

Picture of Arduino Example

Baud Rate Setup

By default the SIM7000 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, first run the "FONA_LTE_setbaud" sketch to set the baud rate to a slower 4800 rate. You should only have to do this the first time you power your device! If successful you should see it initialize at 115200, find it, set it to 4800 baud, and print out the module details again.


LTE Shield Demo

Now that the baud rate is set up, follow these instructions to open the "FONA_LTE_Test" sketch. If you scroll down to the end of the "setup()" function you will see a line "fona.setGPRSNetworkSettings(F("m2m.com.attz"));" which sets the APN. This is absolutely needed, and you should first consult your SIM card's documentation on what the APN is. For the AT&T Trio SIM the line above worked a treat!

When the code runs the Arduino will attempt to communicate with the SIM7000 via UART (TX/RX) using SoftwareSerial. In order to do this, of course, the SIM7000 has to be powered on, so while it's trying to establish a connection, check for the "PWR" LED to make sure it turns on! (Note: it should turn on about 4s or so after the code runs). After the Arduino successfully establishes communication with the module you should see a large menu with a bunch of actions the module can perform! However, note that some of these are for SIMCOM's other 2G or 3G modules so not ALL of the commands are applicable to the SIM7000 but lots of them are! Simply type the letter corresponding to an action you want to perform and click "Send" at the top right of the serial monitor or simply press the Enter key. Watch in amazement as the shield spits back a reply!

Demo Commands

Below are some commands you should run to make sure your module is set up before proceeding:

  • Type "n" and press enter to check the network registration. You should see "Registered (home)". If not, check if your antenna is attached as well as your LiPo battery!
  • 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!
  • Now enter "G" to enable GPRS. This 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.
  • To test if you can actually do something with your module, enter "w". It will prompt you to enter the URL of the webpage you want to read, and copy/paste the example URL "www.adafruit.com/testwifi/index.html" and press enter. Shortly thereafter it should give you a test message like "if you see this then it works!"
  • Now let's test sending dummy data to dweet.io, a free cloud API by entering "2" in the serial monitor. You should see it run through some AT commands.
  • To test if the data really got through, try "w" again and this time enter "http://dweet.io/get/latest/dweet/for/{deviceID}" without the brackets, where the device ID is the IMEI number of your device which should be printed at the very top of the serial monitor from the module initialization. You should see "succeeded" and a JSON response containing the data that you had just sent! (Note that the 87% battery is just a dummy number that is set in the code and may not be your actual battery level)
  • Now it's time to test the GPS! Enable power to the GPS using "O"
  • Enter "L" to query the location data. Note that you might have to wait around 7-10s before it will get a fix on the location. 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 third number (the numbers are separated by commas) is the date and time, and the next three numbers are the latitude, longitude, and elevation (in meters) of your location! To check if it was accurate, go to this online tool and search your current location. It should give you the lat/long and altitude and compare these values with the one your GPS gave!
  • If you don't need GPS you can turn it off using "o"
  • Have fun with the other commands and check out the example "IoT_Example" sketch for a cool example on how to send data to a free cloud API via LTE!

IoT Example

Once you verify everything is working as expected, open the "IoT_Example" sketch. This example code sends GPS location and bearing data, temperature, and battery level to the cloud! Upload the code and watch in amazement as the LTE shield does its magic! To check if the data was really sent to the cloud, go to "http://dweet.io/get/latest/dweet/for/{IMEI}" in any browser (fill in the IMEI number found at the top of the serial monitor after module initialization, or printed on your SIMCOM module) and you should see the data that your device sent!

With this example you can also uncomment the line with "#define samplingRate 30" to send data repeatedly instead of only running once. This makes your device essentially a GPS tracking device!

Step 8: Testing With AT Commands

If you would like to test your module with AT commands an easy way is to use the "AT_Command_Test" example sketch which you can find in the LTE examples folder on Github. This sketch allows you to enter commands into the serial monitor and prints the response of the module. This way you can freely experiment with AT commands to your heart's content! I've also added a function for toggling the power of the module, resetting the module, and changing the baud rate!

If you still want to experiment with the AT commands but want to run them in a sequence and don't want to mess with altering the FONA library you can do that with a simple little library I wrote called the "AT Command Library" which you can find here on Github. All you need to do is download the ZIP from the repository and extract it into your Arduino libraries folder and an example sketch (called "AT_Command_Test.ino") for the SIM7000 can be found here in the LTE shield Github repo. This library allows you to send AT commands via Software Serial with timeouts, checks for a specific reply from the module, neither, or both!


Testing Network Connection

Here is a list of some AT commands that might be helpful to make sure your module is really connecting to the LTE network:

  • First type in "AT" to make sure that your module is communicating. You should receive an "OK" reply.
  • Next enter "AT+CREG?" to see the network registration. What you want to see is "+CREG: 0,1"
  • Next type in "AT+CPSI?" to see the network you're connected to. It should be either LTE CAT-M1 or LTE CAT-NB! If it's connected to either of these, you're good to go!

Step 9: Current Consumption

For IoT devices, you want to see these numbers to go way down, so let's take a look at some of the tech specs! Note: All these are based on the attached SIM7000 Hardware Design document so I'm only going to attempt to summarize the really important stuff!

  • Power Down Mode: You can use the "fona.powerDown()" function to completely power off the SIM7000. The SIM7000 hardware documentation says that this mode essentially shuts down the module's power supply entirely, but the SIM7000 spec overview document says it draws 7uA and I have yet to test that. Shortly after you turn off the module the "PWR" LED should turn off.
  • Power Saving Mode (PSM): This mode gives the most power savings (at only 9uA) while still keeping the module powered. In this mode only the RTC's power will be active. For those ESP8266 fans out there, it's basically "ESP.deepSleep()" and the RTC timer can wake up the module. Maybe I'll write some Arduino functions and post a followup tutorial on how to use this if I get a chance to play with it!
  • Flight Mode: In this mode power is still supplied to the module but RF is completely disabled but the SIM card is still active as well as UART and USB interface. You can enter this mode using "AT+CFUN=4".
  • Minimum Functionality Mode: This mode is the same as Flight Mode except the SIM card interface is inaccessible. You can enter this mode using "AT+CFUN=0" but you can also enter this mode using "AT+CSCLK=1" after which the SIM7000 will pull up the DTR pin when the module is in idle mode. In this sleep mode pulling DTR low will wake up the module. This can be handy because waking it up can be a lot faster than powering it up from scratch!
  • Discontinuous Reception/Transmission (DRX/DTX) Mode: The hardware datasheet also seems to indicate that you can configure the module to receive or transmit on a routine basis but not continuously, although I couldn't find documentation on this.
  • Disable "PWR" LED: To save a few more pennies you can disable the module's power LED by cutting the normally-closed solder jumper next to it. If later you change your mind and want it back, just solder the jumper!
  • "NETLIGHT" LED On/Off: You can also use "AT+CNETLIGHT" to turn off the blue network status LED completely if you don't need it!
  • GNSS On/Off: You can save 30mA by turning off GPS using the command "fona.enableGPS()" with true or false as the input parameter. If you're not using it I'd suggest you to turn it off! Also, I found that it only takes about 20s to get a fix on location from a cold start and only about 2s when the device has already been on (like if you turn GPS off then back on and query again), which is pretty fast! You can also experiment with warm/hot start and assisted GPS.

Step 10: Conclusions

Overall, the LTE/NB-IoT shield is super fast and uses cutting-edge technology with integrated GPS and comes loaded with cool features! Unfortunately for those of us in the United States, NB-IoT is not fully deployed here so we will have to wait until next year or later, but with this LTE shield we can still use LTE CAT-M1 which is also geared toward IoT devices. This shield is great for experimenting with low-power cellular devices like GPS trackers, remote dataloggers, and much more! By including other shields and modules for things like SD card storage, solar panels, sensors, and other wireless connectivity, the possibilities are almost endless!

  • If you liked this project, please give it a heart and vote for it!
  • If you have any comments, suggestions, or questions, feel free to post it below!
  • If you would like an LTE/NB-IoT shield comment below or email me at botletics@gmail.com! I am currently working on version 2 of the board so I don't have any in stock but you can check what the kit would look like here on my website.
  • As always, please share this project!

I plan on launching a crowdfunding campaign in the near future, so stay tuned for updates on that! I'm also considering making a complete all-in-one development board with an AVR microcontroller on-board running on 3.3V with the whole shebang powered by a single LiPo battery. Furthermore, integrating the microcontroller on the same board also allows a bit of flexibility in the design to minimize power consumption because the Arduino is not made for penny-pinching microamps of current. I am also planning on investigating the nitty-gritty of the power saving techniques for the SIM7000, writing custom functions in Arduino IDE, and maybe posting another tutorial on exactly how to use them!

With that said, happy DIY'ing and make sure to share your projects and improvements with everyone!

~ Tim

Comments

About This Instructable

1,183views

14favorites

Bio: I'm a young engineer with a passion for DIY and electronics! Learn to share, share to learn!
More by arduinofanboy:LTE NB-IoT Shield for ArduinoDIY Reflow Oven With Reflowduino
Add instructable to: