The SparkFun LoRa Thing Plus – expLoRaBLE is a feather form-factor development board with the NM180100 system in package (SiP), from Northern Mechatronics. The NM180100 SiP includes a Semtech SX1262 LoRa module paired with the Apollo3 MCU, which is used in the SparkFun Artemis module. This provides the board with compatibility in the Arduino IDE, through our Apollo3 Arduino core. The Semtech SX1262 is a long range, low power RF tranceiver introduces LoRaWAN capabilities to the board. Additionally, both the BLE and LoRa capabilities of the expLoRaBLE allow it to operate as a Bluetooth enabled LoRa node.
To get started, users will need a few items. Now some users may have a few of these items, feel free to modify your cart accordingly.
Gateways Antennas Headers Batteries Jumper Modification JTAG Functionality
For mobile applications, users will want to pick up a single-cell LiPo battery from our catalog. Below, are a few available options:
If you would like to follow along with the examples below to interact with the physical world, you will also need the following items:
Headers are great for development purposes, letting users swap parts with just a set of jumper wires. If you would like to add headers to your board, check out some of the options for the Thing Plus or Feather form factor boards:
Below is a sample selection of our other headers and soldering tools in our catalog. For a full selection of our available Headers or Soldering Tools, click on the associated link.
Users interested in JTAG applications (i.e. programming and debugging the RP2040) will need an Arm® Programmer and need to solder on a JTAG header. We recommend these programmers from our catalog:
Below, is a selection of a few LoRA antenna options from the antenna product category.
As a more professionally oriented product, we will skip over the more fundamental tutorials (i.e. Ohm's Law and What is Electricity?). However, below are a few tutorials that may help users familiarize themselves with various aspects of the board.
One of the new, advanced features of the board is that it takes advantage of the Qwiic connect system. We recommend familiarizing yourself with the Logic Levels and I2C tutorials. Click on the banner above to learn more about Qwiic products.
The board dimensions are illustrated in the drawing below. The listed measurements are in inches and the four mounting holes are compatible with 4-40 standoff screws.
The USB connector is provided to power and program the board. For most users, it will be the primary programing interface for the NM180100.
The CH340E allows the NM180100 to communicate with a computer/host device through its USB-C connection. This allows the board to show up as a device on the serial (or COM) port of the computer. Users will need to install the latest CH340 driver for the computer to recognize the board.
The SparkFun expLoRaBLE only requires 3.3V to power the board. However, the simplest method to power the board is with the USB-C connector. There are additional power pins available on the board:
The charging circuit utilizes the MCP73831 linear charge management controller and is powered directly from the USB-C connector or USB
. The controller is configured for a 500mA charge rate and battery charging is indicated when the yellow, CHG
LED. If the charge controller is shutdown or charging is complete, the CHG
LED will turn off. For more information, please refer to the MCP73831 datasheet.
The NM180100 SiP from Northern Mechatronics is the brains of the SparkFun expLoRaBLE. The system in package (SiP) includes an Apollo3 MCU connected to a Semtech SX1262 radio transceiver. The connection between the two ICs is laid out in the table below.
Apollo3 | SX1262 | Description | ||
---|---|---|---|---|
Pin | Name | Pin | Name | |
H6 | GPIO 36 | 19 | NSS | SPI Slave Select |
J6 | GPIO 38 | 17 | MOSI | SPI Slave Input |
J5 | GPIO 43 | 16 | MISO | SPI Slave Output |
H5 | GPIO 42 | 18 | SCK | SPI Clock Input |
J8 | GPIO 39 | 14 | Busy | Radio Busy Indicator |
J9 | GPIO 40 | 13 | DIO1 | Multipurpose Digital I/o |
H9 | GPIO 47 | 06 | DIO3 | Multipurpose Digital I/o |
J7 | GPIO 44 | 15 | NRESET | Radio Reset Signal (Active Low) |
A breakdown of the NM180100 functionality is shown in the block diagram below and the functionality of each embedded chip is laid out in the following subsections. It should be noted, that the Bluetooth and LoRa antenna connections on the SparkFun expLoRaBLE share the same u.FL connector with the use of a diplexer. For more details on the NM180100 SiP, check out the datasheet.
Note: While most users will utilize the USB connection for serial programming, the Apollo3 MCU in the NM180100 SiP can also be programmed through its JTAG or SWD pins. This might is useful for individuals developing and testing firmware that would be flashed directly onto the NM180100 SiP, such as in production for commercial applications. For more details on programming, please check out our ARM Programming tutorial
For details on the Apollo3, users should refer to the Designing with the SparkFun Artemis hookup guide. Additionally, users can reference the following resources for more technical information:
The Semtech SX1262 module is a long range, low power, half-duplex transceiver with global LoRa® frequency coverage, capable of operating as a Long range (LoRa) wide area network (LoRaWAN) or frequency-shift keying (FSK) modem. The module was designed for long battery life with just 4.2 mA of active receive current consumption and it can transmit up to +22 dBm with the use of its highly efficient, integrated power amplifiers. The SX1262 is optimal for devices that are designed to comply with the physical layer requirements of the LoRaWAN specification released by the LoRa Alliance™. For more details on the SX1262, check out the datasheet.
Characteristic | Description |
---|---|
Current Consumption |
4.2 to 10.1 mA (RX) 32 to 118 mA (TX) |
Frequency Range | 150 to 960 MHz |
Modulation |
FSK, GFSK, MSK, GMSK and LoRa |
Link Budget | 170 dB (max) |
Bit Rate (programmable) |
FSK: .6 to 300 kb/s LoRa: .018 to 62.5 kb/s |
RF Sensitivity | -104 to -148 dBm |
RF Output Power | +14 to +22 dBm |
The Apollo3 BLE and SX1262 RF antenna connections share a single U.FL antenna connector with the use of a diplexer.
The pins from the NM180100 SiP are broken out into a feather form factor layout.
The power pins aren't really I/O (Input/Output) connections for the microcontroller; however, they are pertinent to the board.
The power I/O mostly consists of voltage supply pins. These pins are traditionally used as power sources for other pieces of hardware (like LEDs, potentiometers, and other circuits).
EN
pin is used to contol the 3.3V voltage regulator output (i.e. the boards power) from the battery or USB connection to the rest of the board.There are 21 I/O pins broken out on this board, which can be used as digital inputs to or outputs from the NM180100 SiP.
All of the SparkFun expLoRaBLE pins are broken out with .1" pitch spacing for headers. It is best practice to define the pinMode()
(link) in the setup of each sketch (programs written in the Arduino IDE) for the pins used.
When configured properly, an input pin will be looking for a HIGH or LOW state. Input pins are High Impedance and takes very little current to move the input pin from one state to another.
When configured as an output the pin will be at a HIGH or LOW voltage. Output pins are Low Impedance: This means that they can provide a relatively substantial amount of current to other circuits.
There are several pins that have special functionality in addition to general digital I/O. These pins and their additional functions are listed in the tabs below. For more technical specifications on the I/O pins, you can refer to the Apollo 3 datasheet.
Note: Be aware that the ADC input range is from 0 - 2V. Although connecting a sensor with an output to 3.3V is safe for the NM180100 SiP, it will saturate the ADC at 2V.
The NM180100 SiP offers a 14-bit ADC input for eight of the SparkFun expLoRaBLE's I/O pins. This functionality is accessed in the Arduino IDE using the analogRead(pin)
function.
analogRead()
returns a 10-bit value. To change the resolution of the value returned by the analogRead()
function, use the analogReadResolution(bits)
function.
Note: To learn more about analog vs. digital signals, check out this great tutorial.
The NM180100 SiP provides 16-bit PWM output for all of the SparkFun expLoRaBLE's twenty-one digital I/O pins. Additionally, the SCL
line of the primary, Qwiic I2C bus and GPIO 10
, which is connected to the status LED are also PWM capable outputs. This functionality is accessed in the Arduino IDE using the analogWrite(pin, value)
function or the Servo library.
Note: By default, in the Arduino IDE, analogWrite()
accepts an 8-bit value. To change the resolution of the PWM signal for the analogWrite()
function, use the analogWriteResolution(bits)
function.
(*The PWM output is the result of the NM180100 SiP's signal generator clock functionality and is not a true analog signal.)
The SparkFun expLoRaBLE has two UART modules that can function independently of each other. By default, the dedicated UART port to the USB connection (Serial
) can be accessed through the Arduino IDE using the serial communication module. D0
(RX) and D1
(TX) of the breakout I/O pins are connected to the secondary UART module.
Note: To learn more about serial communication, check out this great tutorial.
The default SPI bus on the SparkFun expLoRaBLE is accessible through the Arduino IDE using the SPI module. By default, in the Arduino IDE, the SPI module is configured to utilize pins 25
, 27
, and 28
.
Connection | Pin |
---|---|
SCK | 13 |
SDI or CIPO | 12 |
SDO or COPI | 11 |
CS | ANY |
MOSI
signal on a controller has been replaced with the title SDO
. Please refer to this announcement on the decision to deprecate the MOSI/MISO terminology and transition to the SDO/SDI naming convention.Note: To learn more about the serial peripheral interface (SPI) protocol, check out this great tutorial.
The SparkFun expLoRaBLE has 2 I2C modules. The Qwiic connector is connected to the default I2C bus that is accessed through the Arduino IDE using the Wire module.
Note: To learn more about the inter-integrated circuit (I2C) protocol, check out this great tutorial.
There are two buttons on SparkFun expLoRaBLE; a reset and GPIO button.
The reset (RST
) button allows users to reset the program running on the NM180100 SiP without unplugging the board.
Note: In order to utilize the user button, connected to GPIO 10
, the pin mode will need to be configured as an input with an internal pullup (i.e. INPUT_PULLUP
); see an example below.
pinMode(D10, INPUT_PULLUP);
The user (10
) button allows users to short GPIO 10
to ground (GND
).
GPIO 10
button on the SparkFun expLoRaBLE. (Click to enlarge) There are five indication LEDs on the SparkFun expLoRaBLE:
The red, PWR
LED will light up once 3.3V is supplied to the board. For most users, it will light up when 5V is supplied through the USB connection and/or when a LiPo battery is attached to the JST connector.
PWR
status LED indicator. (Click to enlarge) The yellow, CHG
LED will light while a battery is being charged through the charging circuit. The LED will be off when no battery is present (*dimmed), when the charge management controller is in standby (after the battery charging has been completed), or when the charge management controller is shutdown. The LED will be on when the charge management controller is in the process of charging the battery. For more information, please refer to the MCP73831 datasheet.
Charge Cycle State | STAT1 |
---|---|
Shutdown
|
Off (High Z) |
No Battery Present | Dimmed (High Z) |
Charge Complete – Standby | Off (H) |
Preconditioning | On (L) |
Constant-Current Fast Charge | On (L) |
Constant Voltage | On (L) |
The blue, status (18
) LED is typically used as a test or status LED to make sure that a board is working or for basic debugging. This indicator is connected to GPIO 18
.
18
) LED indicator on the SparkFun expLoRaBLE Thing Plus. (Click to enlarge) The yellow, RX
and green, TX
LEDs are used to indicate serial communication and programming between the CH340E serial-to-UART and NM180100 SiP.
RX
and TX
LED indicators on the SparkFun expLoRaBLE Thing Plus. (Click to enlarge) There are three jumpers on the back of the board that can be used to easily modify the hardware connections on the board.
PWR
LED and reduce power consumption on the board.RESET
pin of the Apollo3; effectively, disabling the ability of the CH340E to reset the MCU through software.The Qwiic connector is attached to the primary I2C bus. The primary I2C bus for this board utilizes the pin connections, detailed in the table below:
Connection | VDD |
GND |
SCL |
SDA |
---|---|---|---|---|
Pad Number
(NM180100 SiP) |
3.3V | GND | D15 |
D14 |
A Qwiic connector is provided for users to seamlessly integrate with SparkFun's Qwiic Ecosystem.
What is Qwiic?
The Qwiic system is intended a quick, hassle-free cabling/connector system for I2C devices. Qwiic is actually a play on words between "quick" and I2C or "iic".
Cables plug easily between boards making quick work of setting up a new prototype. We currently offer three different lengths of Qwiic cables as well as a breadboard friendly cable to connect any Qwiic enabled board to anything else. Initially you may need to solder headers onto the shield to connect your platform to the Qwiic system but once that’s done it’s plug and go!
Qwiic cables connected to Spectral Sensor Breakout
How many times have you swapped the SDA and SCL wires on your breadboard hoping the sensor will start working? The Qwiic connector is polarized so you know you’ll have it wired correctly, every time, from the start.
The PCB connector is part number SM04B-SRSS (Datasheet) or equivalent. The mating connector used on cables is part number SHR04V-S-B or equivalent. This is a common and low cost connector.
1mm pitch, 4-pin JST connector
It’s time to leverage the power of the I2C bus! Most Qwiic boards will have two or more connectors on them allowing multiple devices to be connected.
Users will need to install the latest CH340 driver on their computer, in order for it to properly recognize the board.
Most users will be familiar with the Arduino IDE and it's use. As a point of reference for professional developers who aren't aware, the Arduino IDE is an open-source development environment, written in Java, that makes it easy to write code and upload it to a supported board. For more details, feel free to check out the Arduino website.
To get started with the Arduino IDE, check out the following tutorials:
Note: The installed board definitions for our Apollo3 development boards must be version 2.0.5 or later.
Note: For more instructions, users can follow this tutorial on Installing Additional Cores provided by Arduino. Users will also need the .json
file for the SparkFun Ambiq Apollo3 Arduino Core:
https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json
SPI1
bus is used..zip
file installation)
Note: Currently, there isn't an Arduino library that provides a LoRa implementation, supporting the SX1262. However, we were able to modify and port the basicmac code as an Arduino library for the SparkFun expLoRaBLE. Users will need to manually install the library with this .zip file.
The library includes modifications for the SPI pins use by the NM180100 to connect the Apollo3 MCU to the SX1262 module. Additionally, it also contains modifications to pre-configure the library to use the SX1262, the US LoRa frequency band, and defaults to a SF7 (spreading factor).
Users will need an account on The Things Network for the example that demonstrates the LoRaWAN capabilities of the expLoRaBLE. Please, use the information in either of the following tutorials to create an account on register a node on The Things Network.
The USB connection is utilized for programming and serial communication. Users only need to plug their SparkFun expLoRaBLE into a computer using a USB-C cable.
In order to utilize the LoRa and RF capabilities of the SX1262, users will need to attach an antenna. Check out the tutorial below for tips on using U.FL connectors.
For remote LoRa applications, a Li-Po battery can be connected. Additionally, users may be interested in utilizing a solar panel and USB-C cable to recharge their battery.
The Qwiic system allows users to effortlessly prototype with a Qwiic compatible I2C device without soldering. Users can attach any Qwiic compatible sensor or board, with just a Qwiic cable. (*The example below, is for demonstration purposes and is not pertinent to the board functionality or this tutorial.)
Regional Configuration: The (ported) basicmac library includes configurations required for the SPI pins use by the NM180100 to connect the Apollo3 MCU to the SX1262 module. Additionally, it also contains modifications to pre-configure the library to use the SX1262, the US LoRa frequency band, and defaults to a spreading factor of 7 (SF7).
In order to change the regional configuration (for outside the US), users will need to go into the library files to make the necessary modifications to the target configuration file (target-conf.h
). The configuration file can be found with the following file path BasicMAC>src>hal>target-config.h
; on Windos 10, the file path is C:\Users\"username"\Documents\Arduino\libraries\BasicMAC\src\hal\target-config.h
.
target-conf.h
file used to configure the regional settings. (Click to enlarge)
On lines 36-43, users will find the available regional options. To make the required modifications, users simply need to comment in/out their configuration choice and save the file, before uploading their code. (*It is recommended that users also close and re-open the Arduino IDE before uploading their code, to ensure the modifications are in place.)
In order to utilize this example, users will need access to a gateway that is connected to The Things Network. Additionally, users should have their own account on The Things Network and have registered a device for their node. A device must be registered, in order to receive the Network Session Key, App Session Key, and Device Address required for the SparkFun expLoRaBLE to operate as a node and have its data passed to The Things Network servers. For those who are unfamiliar with LoRaWAN and The Things Network, please refer to the information provided below.
Users will need an account on The Things Network for this example. Please, use the information in either of the following tutorials to create an account and register a device on The Things Network.
Once a device has been registered (*the device activation method should be configure to ABP), the Network Session Key, App Session Key, and Device Address are displayed on the Device Overview page. In order for the expLoRaBLE to have its data passed to The Things Network, the Network Session Key, App Session Key, and Device Address must be hard coded on the device. By default, the Network Session Key and App Session Key fields are obscured for security reasons. Click the
icon to show the code and click the
<>
button to show the codes in a C
-style format. Below, is a diagram explaining which field on the Device Overview page corresponds to the variables in the provided example code.
For more information, feel free to utilize the documentation from The Things Network to:
Once users have a device registered on The Things Network, the example code will need to be downloaded and a few modifications are required before uploading.
Lines 36-47 of the example code, need to be modified to hard code the credentials required for the payload from the node to be passed to The Things Network:
language:c
// LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the early prototype TTN
// network.
static const PROGMEM u1_t NWKSKEY[16] = { 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x## };
// LoRaWAN AppSKey, application session key
// This is the default Semtech key, which is used by the early prototype TTN
// network.
static const u1_t PROGMEM APPSKEY[16] = { 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x## };
// LoRaWAN end-device address (DevAddr)
static const u4_t DEVADDR = 0x######## ; // <-- Change this address for every node! For example, our device address is 26022DEN. We will need to replace "DEVICE_ADDRESS_HERE" as 0x26022DEB.
Lines 62-64 of the example code, are used to set the transmission intervals between payloads:
language:c
// Schedule TX every this many milliseconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 20000;
Lines 329-336 of the example code, is where the contents of the payload can be modified. The contents of the transmission on can be viewed on The Things Network through the Application Data page, once the node begins broadcasting. To access the Application Data page, click on the Data
tab from the Device Overview page on The Things Network console.
language:c
void send_packet() {
// Prepare upstream data transmission at the next possible time.
uint8_t mydata[] = "<Enter Text>";
LMIC_setTxData2(1, mydata, sizeof(mydata) - 1, 0);
Serial.println(F("Packet queued"));
last_packet = millis();
}
mydata[]
) can take 3 different formats: text (as shown above), integers (8-bit unsigned), or an array. Any data sent as an array, must be in the following format: { 0x01, 0x02, 0x03,
... up to ... 0x13}
(i.e. up to 13 hexadecimal numbers in an array).
Regional Configuration: Before uploading the code, be sure to make any necessary regional configuration changes, as mentioned at the beginning of this section, to avoid breaking any laws.
Note: For those utilizing our LoRa Gateway - 1-Channel (ESP32), the code on lines 288-300 will need to be uncommented. The modification forces the device/node to only use channel 8; instead of randomly picking a channel to broadcast on. This is important as the single channel gateeway only receives transmissions on channel 8 and if the device were broadcasting on channels randomly, only a portion of the transmissions would reach The Things Network.
// disable channels 0-7 for (int i = 0; i <= 7 ; i++) { LMIC_disableChannel(i); } // note, leave channel 8 enabled // disable all other higher channels for (int i = 9; i <= 63 ; i++) { LMIC_disableChannel(i); }
Once the example code has been modified and uploaded to the SparkFun expLoRaBLE, users can monitor the serial terminal (or SerialMonitor on the Arduino IDE) for successful transmissions. Additionally, users can use The Things Network to decode the data packets to verify the data transmission.
For those looking to test out the range of their setup configuration, The Things Network has an application called TTN Mapper. To get started follow the Mapping Gateway Coverage using a Things Node. There is also an option to map using a either an Android phone or iPhone. For more information on the app, please cheack out the documentation on The Things Network.
To generate the images below, the Android guide was followed. The steps were relatively simple:
The TTN Mapper app uses the phone's positioning and ties it to the data transmission from the linked device. Therefore, users will need to enable their phone's data and location for the application to work properly.
Patch Antenna | Whip Antenna |
---|---|
SF7
), for two different antennas. You can even publish your data online, to get a radar-like coverage map for a gateway:
There were some vehicles parked to the northwest and northwest-by-north of where the gateway was positioned; as well as a tree and post to the immediate west and west-by-north. The image illustrates how the signal strength to the west drops off significantly, due to the proximity of the trees and poles. Additionally, how the signal strength in the northwest gradually falls from interference by the vehicles. The signal coverage to the south of the gateway was spotty since it was around the corner of the building.
Note: This section has been updated to no longer use the modified RadioLib library. As mentioned in the pull request for our changes, users only need to delcare that the SPI1
bus is used.
Important: Users should also use the example codes that we provide with the download buttons below. There seem to be several users, trying to use the built-in examples and running into issues, even though we provide example codes below. The example codes below have been written and tested for users to be able to upload directly to their expLoRaBLE and execute without any issues. (Obviously because we are based in th US, the example code has been written for use at 915MHz (the reserved frequency band for our region). Users outside the US and using a different frequency band, will need to reference the library and modify the code on their own.)
In this example, the RadioLib library utilizes the frequency shift keying (FSK) capabilities of the SX1262 transceiver. For this example, users will need two expLoRaBLEs; one to transmit data and the other to receive that data. For more information on this library, check out the GitHub repository Wiki. User simply need to download and upload the code below to separate expLoRaBLEs:
Once the example codes has been uploaded to their respective boards, users should see the data transmissions in the Serial Monitor:
Hello World!
transmissions will begin to appear.For more on the Artemis Development Kit, check out the links below:
.json
file needed for the SparkFun Ambiq Apollo3 Arduino Core:
https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json
Need some inspiration for your next project? Check out some of these related tutorials:
learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado