1W LoRa MicroMod Function Board Hookup Guide
Introduction
This LoRa module can only be used in the 915MHz LoRaWAN frequency band (i.e. 902 to 928 MHz). It is not compatible with other frequency bands; double check the frequency band used in your region. Check out these resources from The Things Network for an unofficial summary of regional radio regulations and list of the regional frequency plans.
The 1W LoRa MicroMod Function Board adds LoRa capabilities to your MicroMod project. It is intended to be used in conjunction with a MicroMod processor board and a MicroMod main board, which provides the electrical interface between a processor board and the function board(s).
Match up the board's M.2 edge connector to the slot of the M.2 connector and secure the function board with the screws provided with the main board.
Utilizing the 915M30S LoRa module from EBYTE, which is a 1W (30dBm) transceiver based around the SX1276 from Semtech. There is a robust edge mount RP-SMA connector for large LoRa (915MHz) antennas; with modification, a U.FL connector is also available. We've successfully tested a 12 miles line-of-sight transmission with this module (user results may vary).
With the MicroMod standardization, users no longer need to cross-reference schematics with datasheets, while fumbling around with jumper wires. Simply, match up the function board's M.2 edge connector to the slot of the M.2 connector on the main board and secure the function board with screws. All connections are hardwired to compatible pins of the processor board and the pin connections are standardized for the processor boards.
Required Materials
To get started, users will need a few of the items listed below. (You may already have a some of these items; read through the guide and modify your cart accordingly.)
MicroMod Processor Board
A processor board is required for the MicroMod system to operate. Users can choose a processor board, based upon their needs, to attach to the MicroMod M.2 connector of the main board. Below, are few options:
MicroMod Main Board
A main board provides the electrical connections between the function and processor boards to operate. Users can choose a main board based upon their needs. Below, are few options:
Required Hardware
A Phillips screw driver is necessary to attach the processor board and function board(s) to the main board. Additionally, a USB-C cable is needed to connect the main board to a computer. The LoRa function board also requires a LoRa antenna for the transceiver to operate.
Below, is a selection of our 915MHz frequency band RP-SMA antennas.
Optional Hardware
A LoRa gateway provides internet connection for LoRaWAN network. Below are a few options from our LoRa product category.
Users can also use other LoRa boards for peer-to-peer communication. Below are a few options from our LoRa product category.
To modify the jumpers, users will need soldering equipment and/or a knife.
Suggested Reading
The MicroMod ecosystem is a unique way to allow users to customize their project to their needs. Click on the banner below for more information.
For users who aren't familiar with the following concepts, we also recommend reading the following tutorials before continuing.
Serial Communication
Serial Peripheral Interface (SPI)
Analog vs. Digital
Processor Interrupts with Arduino
SparkFun expLoRaBLE Hookup Guide
Getting Started with MicroMod
Designing with MicroMod
MicroMod Main Board Hookup Guide
Installing an Arduino Library
Installing Arduino IDE
Installing Board Definitions in the Arduino IDE
Hardware Overview
Board Dimensions
The overall board dimensions are roughly 65 x 35 mm with an approximate 6 mm protrusion of the RP-SMA antenna connector.
M.2 Edge Connector and Screw Slots
Like other function and processor boards, there is a polarized M.2 edge connector, which provides a standardized electrical connection. The attachment points for the screws prevent users from connecting a processor board into a function board slot and vice-versa.
Power
There is a power status LED to help make sure that your LoRa function board is getting (5V) power. Power is provided through the (MicroMod) M.2 edge connector. The LoRa module is meant to run on 5V with 3.3V logic levels. A jumper is available on the back of the board to remove power to the LED for low-power applications (see the Jumpers section below).
E19-915M30S LoRa Module
The Chengdu Ebyte E19-915M30S RF transceiver module is a 1W 915MHz LoRa module, based on the SX1276 from Semtech. It is FCC, CE, and RoHS certified and has been tested up to a range of 10km by the manufacturer. PLease refer to the datasheet for more details.
- Global license free ISM 915MHz band
- 1W maximum transmission power
- Software multi-level adjustable
- 256Byte FIFO data buffer
SX1276
The E19-915M30S transceiver is based on the SX1276 chip from Semtech. Please refer to the datasheet for more details.
Part Number | SX1276 |
---|---|
Frequency Range | 137 - 1020 MHz |
Spreading Factor | 6 - 12 |
Bandwidth | 7.8 - 500 kHz |
Effective Bitrate | .018 - 37.5 kbps |
Est. Sensitivity | -111 to -148 dBm |
Characteristic | Description |
---|---|
Operating Voltage | 3.3 - 5.5 V |
Current Consumption | 630 mA (TX)) 23 mA (RX)) 3 µA (Sleep) |
Operating Temperature | -40 - 85 °C |
Operating Humidity[1] | 10 - 90% |
Communication Interface | SPI (0 - 10 Mbps) |
Logic Level | 3.3 V |
Frequency Range | 900 - 931 MHz |
Transmit Power | 28.5 - 30 dBm (max) |
Modulation | LoRa, FSK, GFSK, MSK, GMSK, OOK |
Data Rate |
FSK: 1.2 - 300 kbps
LoRa: 0.018 - 37.5 kbps |
Antenna Impedance | 50 Ω |
Pin Connections
Below is a table of the pin connections available on the E19-915M30S RF transceiver module. However, not all the pins listed are utilized by the LoRa function board (see the Function Board Pinout Table section below).
Pin # | Pin Name | I/O Direction | Pin Description |
1 | GND | Ground | |
2 | DIO5 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
3 | DIO4 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
4 | DIO3 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
5 | DIO2 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
6 | DIO1 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
7 | DIO0 | Input/Output | Configurable IO port(Please refer to the SX1276 datasheet). |
8 | RST | Input | Reset |
9 | GND | Ground | |
10 | GND | Ground | |
11 | VCC | Input | Power supply: 4.75~5.5V (Ceramic filter capacitoris advised to add) |
12 | SCK | Input | SPI - Clock Signal |
13 | MISO | Output | SPI - Data from Peripheral Device |
14 | MOSI | Input | SPI - Data to Peripheral Device |
15 | NSS | Input | SPI - Chip Select |
16 | TXEN | Input | Radio frequency switch control, make sure the TXEN pin is in high level, RXEN pin is in low level when transmitting. |
17 | RXEN | Input | Radio frequency switch control, make sure the RXEN pin is in high level, TXEN pin is in low level when receiving. |
18 | GND | Ground | |
19 | ANT | Antenna | |
20 | GND | Ground | |
21 | GND | Ground | |
22 | GND | Ground |
MicroMod Edge Connector
The MicroMod M.2 edge connector provides a standardized interface for the pin connection of a function board.
Function Board Pinout Table
The tables below outline the pin on the M2. edge connector and their functions.
AUDIO | UART | GPIO/BUS | I2C | SDIO | SPI0 | Dedicated |
Functions | Bottom Pin |
Top Pin |
Functions | ||||||
---|---|---|---|---|---|---|---|---|---|
(Not Connected) | 75 | GND | |||||||
3.3V | 74 | 73 | G5 / BUS5 | ||||||
RTC_3V_BATT | 72 | 71 | G6 / BUS6 | ||||||
SPI_CS1# | SDIO_DATA3 (I/O) | 70 | 69 | G7 / BUS7 | |||||
SDIO_DATA2 (I/O) | 68 | 67 | G8 | ||||||
SDIO_DATA1 (I/O) | 66 | 65 | G9 | ADC_D- | CAM_HSYNC | ||||
SPI_CIPO1 | SDIO_DATA0 (I/O) | 64 | 63 | G10 | ADC_D+ | CAM_VSYNC | |||
SPI COPI1 | SDIO_CMD (I/O) | 62 | 61 | SPI_CIPO (I) | |||||
SPI SCK1 | SDIO_SCK (O) | 60 | 59 | SPI_COPI (O) | LED_DAT | ||||
AUD_MCLK (O) | 58 | 57 | SPI_SCK (O) | LED_CLK | |||||
CAM_MCLK | PCM_OUT | I2S_OUT | AUD_OUT | 56 | 55 | SPI_CS# | |||
CAM_PCLK | PCM_IN | I2S_IN | AUD_IN | 54 | 53 | I2C_SCL1 (I/O) | |||
PDM_DATA | PCM_SYNC | I2S_WS | AUD_LRCLK | 52 | 51 | I2C_SDA1 (I/O) | |||
PDM_CLK | PCM_CLK | I2S_SCK | AUD_BCLK | 50 | 49 | BATT_VIN / 3 (I - ADC) (0 to 3.3V) | |||
G4 / BUS4 | 48 | 47 | PWM1 | ||||||
G3 / BUS3 | 46 | 45 | GND | ||||||
G2 / BUS2 | 44 | 43 | CAN_TX | ||||||
G1 / BUS1 | 42 | 41 | CAN_RX | ||||||
G0 / BUS0 | 40 | 39 | GND | ||||||
A1 | 38 | 37 | USBHOST_D- | ||||||
GND | 36 | 35 | USBHOST_D+ | ||||||
A0 | 34 | 33 | GND | ||||||
PWM0 | 32 | 31 | Module Key | ||||||
Module Key | 30 | 29 | Module Key | ||||||
Module Key | 28 | 27 | Module Key | ||||||
Module Key | 26 | 25 | Module Key | ||||||
Module Key | 24 | 23 | SWDIO | ||||||
UART_TX2 (O) | 22 | 21 | SWDCK | ||||||
UART_RX2 (I) | 20 | 19 | UART_RX1 (I) | ||||||
CAM_TRIG | D1 | 18 | 17 | UART_TX1 (0) | |||||
I2C_INT# | 16 | 15 | UART_CTS1 (I) | ||||||
I2C_SCL (I/0) | 14 | 13 | UART_RTS1 (O) | ||||||
I2C_SDA (I/0) | 12 | 11 | BOOT (I - Open Drain) | ||||||
D0 | 10 | 9 | USB_VIN | ||||||
SWO | G11 | 8 | 7 | GND | |||||
RESET# (I - Open Drain) | 6 | 5 | USB_D- | ||||||
3.3V_EN | 4 | 3 | USB_D+ | ||||||
3.3V | 2 | 1 | GND |
LoRa Func. Board Pin | Function | Bottom Pin |
Top Pin |
Functions | LoRa Func. Board Pin | |
---|---|---|---|---|---|---|
(Not Connected) | - | 75 | GND | |||
VIN | 74 | 73 | 3.3V | 3.3V IN | ||
VCC IN | VIN | 72 | 71 | Power EN | Power EN | |
- | 70 | 69 | - | |||
- | 66 | 65 | - | |||
- | 64 | 63 | - | |||
- | 62 | 61 | F7 | |||
- | 60 | 59 | F6 | LoRa DIO2 | ||
- | 58 | 57 | F5 | LoRa DIO1 | ||
- | 56 | 55 | F4 | LoRa RST | ||
- | 54 | 53 | F3 | LoRa RX EN | ||
- | 52 | 51 | F2 | PWM | LoRa TX EN | |
- | 50 | 49 | F1 | SPI_CS0 | LoRa NSS (CS) | |
- | 48 | 47 | F0 | INT | LoRa DIO0 | |
- | 46 | 45 | GND | |||
- | 44 | 43 | - | |||
- | 42 | 41 | - | |||
EEPROM WP | - | 40 | 39 | GND | ||
A0 | 38 | 37 | USBHOST_D- | |||
EEPROM A0 | EEPROM_A0 | 36 | 35 | USBHOST_D+ | ||
EEPROM A1 | EEPROM_A1 | 34 | 33 | GND | ||
EEPROM A2 | EEPROM_A2 | 32 | 31 | Module Key | ||
Module Key | 30 | 29 | Module Key | |||
Module Key | 28 | 27 | Module Key | |||
Module Key | 26 | 25 | Module Key | |||
Module Key | 24 | 23 | I2C_INT | |||
22 | 21 | I2C_SCL | EEPROM SCL | |||
20 | 19 | I2C_SDA | EEPROM SDA | |||
UART_CTS | 18 | 17 | ||||
UART_RTS | 16 | 15 | UART_RX | |||
14 | 13 | UART_TX | ||||
12 | 11 | GND | ||||
10 | 9 | |||||
8 | 7 | SPI_CIPO | LoRa SDO | |||
6 | 5 | SPI_COPI | LoRa SDI | |||
4 | 3 | SPI_SCK | LoRa SCK | |||
2 | 1 | GND |
Signal
Group |
Signal | I/O | Description | Voltage | Power | 3.3V | I | 3.3V Source | 3.3V |
---|---|---|---|---|
GND | Return current path | 0V | ||
USB_VIN | I | USB VIN compliant to USB 2.0 specification. Connect to pins on processor board that require 5V for USB functionality | 4.8-5.2V | |
RTC_3V_BATT | I | 3V provided by external coin cell or mini battery. Max draw=100μA. Connect to pins maintaining an RTC during power loss. Can be left NC. | 3V | |
3.3V_EN | O | Controls the carrier board's main voltage regulator. Voltage above 1V will enable 3.3V power path. | 3.3V | |
BATT_VIN/3 | I | Carrier board raw voltage over 3. 1/3 resistor divider is implemented on carrier board. Amplify the analog signal as needed for full 0-3.3V range | 3.3V | |
Reset | Reset | I | Input to processor. Open drain with pullup on processor board. Pulling low resets processor. | 3.3V |
Boot | I | Input to processor. Open drain with pullup on processor board. Pulling low puts processor into special boot mode. Can be left NC. | 3.3V | |
USB | USB_D± | I/O | USB Data ±. Differential serial data interface compliant to USB 2.0 specification. If UART is required for programming, USB± must be routed to a USB-to-serial conversion IC on the processor board. | |
USB Host | USBHOST_D± | I/O | For processors that support USB Host Mode. USB Data±. Differential serial data interface compliant to USB 2.0 specification. Can be left NC. | |
CAN | CAN_RX | I | CAN Bus receive data. | 3.3V |
CAN_TX | O | CAN Bus transmit data. | 3.3V | |
UART | UART_RX1 | I | UART receive data. | 3.3V |
UART_TX1 | O | UART transmit data. | 3.3V | |
UART_RTS1 | O | UART ready to send. | 3.3V | |
UART_CTS1 | I | UART clear to send. | 3.3V | |
UART_RX2 | I | 2nd UART receive data. | 3.3V | |
UART_TX2 | O | 2nd UART transmit data. | 3.3V | |
I2C | I2C_SCL | I/O | I2C clock. Open drain with pullup on carrier board. | 3.3V |
I2C_SDA | I/O | I2C data. Open drain with pullup on carrier board | 3.3V | |
I2C_INT# | I | Interrupt notification from carrier board to processor. Open drain with pullup on carrier board. Active LOW | 3.3V | |
I2C_SCL1 | I/O | 2nd I2C clock. Open drain with pullup on carrier board. | 3.3V | |
I2C_SDA1 | I/O | 2nd I2C data. Open drain with pullup on carrier board. | 3.3V | |
SPI | SPI_COPI | O | SPI Controller Output/Peripheral Input. | 3.3V |
SPI_CIPO | I | SPI Controller Input/Peripheral Output. | 3.3V | |
SPI_SCK | O | SPI Clock. | 3.3V | |
SPI_CS# | O | SPI Chip Select. Active LOW. Can be routed to GPIO if hardware CS is unused. | 3.3V | |
SPI/SDIO | SPI_SCK1/SDIO_CLK | O | 2nd SPI Clock. Secondary use is SDIO Clock. | 3.3V |
SPI_COPI1/SDIO_CMD | I/O | 2nd SPI Controller Output/Peripheral Input. Secondary use is SDIO command interface. | 3.3V | |
SPI_CIPO1/SDIO_DATA0 | I/O | 2nd SPI Peripheral Input/Controller Output. Secondary use is SDIO data exchange bit 0. | 3.3V | |
SDIO_DATA1 | I/O | SDIO data exchange bit 1. | 3.3V | |
SDIO_DATA2 | I/O | SDIO data exchange bit 2. | 3.3V | |
SPI_CS1/SDIO_DATA3 | I/O | 2nd SPI Chip Select. Secondary use is SDIO data exchange bit 3. | 3.3V | |
Audio | AUD_MCLK | O | Audio master clock. | 3.3V |
AUD_OUT/PCM_OUT
I2S_OUT/CAM_MCLK |
O | Audio data output. PCM synchronous data output. I2S serial data out. Camera master clock. | 3.3V | |
AUD_IN/PCM_IN
I2S_IN/CAM_PCLK |
I | Audio data input. PCM syncrhonous data input. I2S serial data in. Camera periphperal clock. | 3.3V | |
AUD_LRCLK/PCM_SYNC
I2S_WS/PDM_DATA |
I/O | Audio left/right clock. PCM syncrhonous data SYNC. I2S word select. PDM data. | 3.3V | |
AUD_BCLK/PCM_CLK
I2S_CLK/PDM_CLK |
O | Audio bit clock. PCM clock. I2S continuous serial clock. PDM clock. | 3.3V | |
SWD | SWDIO | I/O | Serial Wire Debug I/O. Connect if processor board supports SWD. Can be left NC. | 3.3V |
SWDCK | I | Serial Wire Debug clock. Connect if processor board supports SWD. Can be left NC. | 3.3V | |
ADC | A0 | I | Analog to digital converter 0. Amplify the analog signal as needed to enable full 0-3.3V range. | 3.3V |
A1 | I | Analog to digital converter 1. Amplify the analog signal as needed to enable full 0-3.3V range. | 3.3V | |
PWM | PWM0 | O | Pulse width modulated output 0. | 3.3V |
PWM1 | O | Pulse width modulated output 1. | 3.3V | |
Digital | D0 | I/O | General digital input/output pin. | 3.3V |
D1/CAM_TRIG | I/O | General digital input/output pin. Camera trigger. | 3.3V | |
General
Bus |
G0/BUS0 | I/O | General purpose pins. Any unused processor pins should be assigned to Gx with ADC + PWM capable pins given priority (0, 1, 2, etc.) positions. The intent is to guarantee PWM, ADC and Digital Pin functionality on respective ADC/PWM/Digital pins. Gx pins do not guarantee ADC/PWM function. Alternative use is pins can support a fast read/write 8-bit or 4-bit wide bus. | 3.3V |
G1/BUS1 | I/O | 3.3V | ||
G2/BUS2 | I/O | 3.3V | ||
G3/BUS3 | I/O | 3.3V | ||
G4/BUS4 | I/O | 3.3V | ||
G5/BUS5 | I/O | 3.3V | ||
G6/BUS6 | I/O | 3.3V | ||
G7/BUS7 | I/O | 3.3V | ||
G8 | I/O | General purpose pin | 3.3V | |
G9/ADC_D-
CAM_HSYNC |
I/O | Differential ADC input if available. Camera horizontal sync. | 3.3V | |
G10/ADC_D+
CAM_VSYNC |
I/O | Differential ADC input if available. Camera vertical sync. | 3.3V | |
G11/SWO | I/O | General purpose pin. Serial Wire Output | 3.3V |
EEPROM
There is an I2C serial EEPROM on the LoRa function board. It has been reserved for future use, but users have access to it. A jumper is available on the back of the board to write protect the EEPROM (see the Jumpers section below).
RP-SMA Antenna Connector
The LoRa function board features a sturdy RP-SMA antenna connector for users to attach an antenna of their choice. While this antenna connector is fairly robust, users should not expect to leverage a lot of weight off of it.
The edge-type antenna connector allows for the threads to protrude just beyond the edge of the board. Along with the dimensions of the LoRa function board, this feature is designed so that the connection also extends past the edge of the main board that the function board interfaces with; and is therefore, well suited to be used with an enclosure.
Note: Users who wish to use the u.FL connector can modify the position of this 0Ω resistor. Due to the size and position of the resistor, we only recommended for highly experience soldering experts attempt this modification. More novice users could potentially damage their LoRa function board if they attempt this modification.
Antenna select jumper on the E19-915M30S RF transceiver module. (Click to enlarge)
Jumpers
There are three jumpers available on the LoRa function board.
LED Power
For more low power projects, the PWR
jumper can be cut to remove power from the red power LED.
Current Measurement
For users who would like to measure the current going to LoRa function board, the MEAS
jumper can be cut and used for measurements. This jumper is only connected to the 5V power, which is used by only the E19-915M30S RF transceiver module and power LED.
EEPROM Write Protection
To permanently write protect the EEPROM on the LoRa function board, users can bridge the WP
jumper.
Software Overview
Getting Started with MicroMod
For those unfamiliar with the MicroMod ecosystem, be sure to review the Getting Started with MicroMod guide. Also, make sure that the correct board definitions are installed in the Arduino IDE, for the associated processor board.
Getting Started with MicroMod
October 21, 2020
Programming
Note: Make sure that the correct board definitions are installed in the Arduino IDE, for the connected processor board. Depending on the processor board, users may need to install drivers (if they have not done so already). For help installing board definitions, use the MicroMod processor boards landing page and review the associated hookup guide for that hardware.
Installing Board Definitions in the Arduino IDE
September 9, 2020
Arduino Library
Note: The example for this tutorial assumes users have the latest version of the Arduino IDE installed. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide:
Installing an Arduino Library
January 11, 2013
SparkFun External EEPROM Arduino Library
We've written a library to easily get setup and read/write data on the EEPROM. You can install this library through the Arduino Library Manager. Search for SparkFun External EEPROM Arduino Library and you should be able to install the latest version. If you prefer manually downloading the libraries from the GitHub repository, you can grab them here:
For more details on this Arduino library and its use, please refer to the Serial EEPROM hookup guide:
Reading and Writing Serial EEPROMs
August 11, 2017
RadioLib Arduino Library
The RadioLib library provides support for peer-to-peer RF communication with the 1W LoRa MicroMod Function Board. Users can install this library through the Arduino Library Manager. Search for RadioLib and you should be able to install the latest version. If you prefer manually downloading the libraries from the GitHub repository, you can grab them here:
For more details on this Arduino library, check out the Arduino reference page, the API refernce page, and GitHub repository. Additional specifics of the library that users may be interested in can be found in the links below:
LoRaWAN Library
The MCCI LoRaWAN LMIC Library library provides support for an end node/device (i.e. 1W LoRa MicroMod Function Board) integration into a LoRaWAN network and communication with a LoRaWAN server. Users can install this library through the Arduino Library Manager. Search for MCCI LoRaWAN LMIC and you should be able to install the latest version. If you prefer manually downloading the libraries from the GitHub repository, you can grab them here:
- Initially we were inclined to utilize the Arduino-LMIC library. However, we followed the repository's recommendation and chose to utilize the MCCI LoRaWAN LMIC Library instead.
- Support for this library has only been confirmed with The Things Stack - Community Edition's (i.e. V3 or previously TTN) and Helium's servers.
- To utilize this library, users are expected to be able to modify various files for regional configuration and compatibility with specific processor boards.
- We assume that users are familiar with the device registration process for each LoRaWAN server. For more information, please refer to the LoRaWAN server's documentation:
- Helium Device Registration
- Usage Cost: 1 Data Credit (1 DC = 0.001¢ in USD) per packet (up to 24 bytes)
- After a device is first added/registered to an account, it takes approx. 20 min for it to get added to the blockchain. Until then, hotspots will not recognize the device and relay its data packets.
- The Things Stack Device Registration:
- The information below also assumes that users have migrated to and are currently using The Things Stack Community Edition (or V3).
- When manually registering a device on The Things Stack, users will need to set the LoRaWAN version to
MAC V1.0.3
(per the library specifications). - Devices registered with the V3 console will only work with gateways on the V3 console. (i.e. Data transmissions from a device registered on the V3 console will not be passed to the server, if its transmissions are only received by a gateway on registered to the V2 console.)
- Helium Device Registration
- We have no control over its service.
- We are not liable for any customer's choice to utilize the network.
- The cryptocurrency market valuation can be volitile.
- There may be legal and financial implications for digital wallets.
- etc.
To be able to utilize this library with the 1W LoRa function board and various MicroMod processor boards, users will need to make the following modifications to the library's files:
Regional Configuration
In the lmic_project_config.h
file make sure that #define CFG_us915 1
and #define CFG_sx1276_radio 1
are uncommented.
language:c
// project-specific definitions
//#define CFG_eu868 1
#define CFG_us915 1
//#define CFG_au915 1
//#define CFG_as923 1
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP /* for as923-JP; also define CFG_as923 */
//#define CFG_kr920 1
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
Processor Board Compatibility
nRF52840 Processor Board
In the hal.cpp
file, users will need to modify lines 368-370 (based on the default code) to provide compatibility with the nRF52840 processor board to the library:
language:c
#if !defined(ARDUINO_ARDUINO_NANO33BLE)
void hal_sleep () {
// Not implemented
}
#endif // !defined(ARDUINO_ARDUINO_NANO33BLE)
Artemis Processor Board
noInterrupts()
and Interrupts()
functions. There is already an issue filed with the GitHub repository. Once this issue has been resolved, the modifications below will no longer be necessary.In the hal.cpp
file, users will need to modify lines 339-347 (based on the default code) to provide compatibility with the Artemis processor board to the library:
language:c
void hal_disableIRQs () {
#if !defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB)
noInterrupts();
#endif // !defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB)
irqlevel++;
}
void hal_enableIRQs () {
if(--irqlevel == 0) {
#if !defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB)
interrupts();
#endif // !defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB)
ES32 Processor Board
In reference to issue #714 for the library, users will need to add the following lines to the end of lmic_project_config.h
file, which is the same file used for the regional configuration.
language:c
#if defined(ARDUINO_ESP32_MICROMOD)
#define hal_init LMICHAL_init // ESP32: https://github.com/mcci-catena/arduino-lmic/issues/714
#endif // defined(ARDUINO_ESP32_MICROMOD)
Hadware Assembly
For those unfamiliar with the MicroMod ecosystem, be sure to review the Getting Started with MicroMod guide.
Getting Started with MicroMod
October 21, 2020
Processor Board and Main Board
To get started users will need a compatible processor and main board. Insert the MicroMod processor board into the M.2 socket for the processor board at an angle, with its edge connector aligned to the matching slots.
When inserted properly, the processor board will rest at an angle:
To secure the processor board, gently hold down on the board and attach the M.2 screw with a Phillip's head (PH0 or PH1) screw driver. Below, is an example of an assembled MicroMod system:
Function Board and Main Board
Warning: The LoRa module is susceptible to electrostatic discharge. Therefore, it is recommended that users a static discharge strap, like the one included in the iFixit Pro Tech Toolkit.
Static discharge strap in the upper righthand corner. (Click to enlarge)
Users should also address any humidity and temperature concerns, when utilizing the LoRa function board.
Similarly to the processor board, insert the MicroMod function board into the M.2 socket for the function board at an angle, with its edge connector aligned to the matching slots.
When inserted properly, the function board will rest at an angle:
To secure the function board, gently hold down on the board and attach the M.2 screw with a Phillip's head (PH0 or PH1) screw driver. Below, is an example of an assembled MicroMod system:
Don't forget to attach the antenna for the LoRa function board. Transmitting or powering the LoRa module without an attached antenna has the potential to permanently damage the transceiver.
Main Board Example - Pin Connection Table
This table summarizes the pins utilized on the LoRa function board's MicroMod edge connector and their connections to the main board's processor pins; based on the slot that the LoRa function board is inserted to.
Function Board
Pin Name |
MicroMod
Pin Number |
I/O
Direction |
Description |
Main Board's
Processor Pin |
Slot 0 | Slot 1 |
---|---|---|---|---|---|
VCC | 72 | Input |
Power supply: 4.75~5.5V
|
- | |
3.3V | 73 | Input |
Power supply: 3.3V
|
- | |
GND | 11 | - | Ground | - | |
Power Enable | 71 | Input | Controls the 3.3V power | 68 | 66 |
SCK | 3 | Input | SPI - Clock signal for transceiver | SCK (57) | |
CIPO | 7 | Output | SPI - Data from transceiver | CIPO (59) | |
COPI | 5 | Input | SPI - Data to transceiver | COPI (61) | |
NSS | 49 (F1) | Input | SPI - Chip select for transceiver | CS0 (55) | CS1 (70) |
RST | 55 (F4) | Input | Resets transceiver | G1 (42) | G6 (71) |
DIO0 | 47 (F0) |
Input
Output |
Transceiver's configurable IO(Please refer to the SX1276 datasheet). | D0 (10) | D1 (18) |
DIO1 | 57 (F5) |
Input
Output |
Transceiver's configurable IO(Please refer to the SX1276 datasheet). | G2 (44) | G7 (69) |
DIO2 | 59 (F6) |
Input
Output |
Transceiver's configurable IO(Please refer to the SX1276 datasheet). | G3 (46) | G8 (62) |
TXEN | 51 (F2) | Input | Transceiver's RF control switch: The TXEN pin is in high level, RXEN pin is in low level when transmitting. | PWM0 (32) | PWM1 (47) |
RXEN | 53 (F3) | Input | Transceiver's RF control switch: The RXEN pin is in high level, TXEN pin is in low level when receiving. | G0 (40) | G5 (73) |
SCL | 21 | Input | I2C - Clock signal for EEPROM | SCL (14) | |
SDA | 19 |
Input
Output |
I2C - Data signal for EEPROM | SDA (12) | |
EEPROM WP | 40 | Input | Controls the write protection pin for the EEPROM. Pull low to enable. | - | |
EEPROM A0 | 6 | Input | Controls EEPROM's I2C address configuration. | - | |
EEPROM A1 | 4 | Input | Controls EEPROM's I2C address configuration. | - | |
EEPROM A2 | 2 | Input | Controls EEPROM's I2C address configuration. | - |
Programming
To program the processor board utilized on the Main Board; connect the board to a computer with a USB-C cable. Depending on the processor board, users may need to install drivers (if they have not done so already).
Note: Make sure that the correct board definitions are installed in the Arduino IDE, for the selected processor board. For help installing board definitions, use the MicroMod processor boards landing page and review the associated hookup guide for that hardware.
Installing Board Definitions in the Arduino IDE
September 9, 2020
Peer-to-Peer Example
0
function board slot of the main board.The example codes below, allow users to communicate between two LoRa function boards. Simply download, extract the files, and upload the code the main board with associated processor and function boards.
Additional examples have also been provided for users who would like to use their expLoRable (LoRa Thing Plus) board to communicate with a LoRa function board.
-
Arduino IDE version: 1.8.16
- If not using the Teensy - Windows App Store version 1.8.51.0
- RadioLib Library version: 4.6.0
-
MicroMod Processor Boards and Arduino Cores:
Processor Board Definition RP2040 Arduino Mbed OS RP2040 Boards version: 2.5.2 ESP32 esp32 version: 2.0.0 STM32 SparkFun STM32 Boards version: 2.0.0 Artemis SparkFun Apollo3 Boards version: 2.1.1 SAMD51 SparkFun SAMD Boards (dependency Arduino SAMD Boards version 1.8.1) version: 1.8.5 - Requires - Arduino SAMD Boards (32-bit ARM Cortex-M0+) version: 1.8.11
nRF52840 [DEPRECATED - Please install standalone packages] Arduino Mbed OS Boards version: 1.3.1 Teensy Teensyduino version: 1.55
Once uploaded, users can open the serial monitor to view the progress of the data transmission or reception. When using the RP2040 processor board, the example code will wait until the Serial Monitor is opened to execute the code and transmit/receive data.
Code Breakdown
In order to get the built-in example for the RadioLib library working, a few changes needed to be made. Below, is a short explanation of the modifications made to the example code that we provide (see above), to include compatibility with all the available processor boards.
CS Pin Definition
The SPI library for the Arduino IDE, by default expects the chip select pin to be defined as PIN_SPI_SS
. However, this pin definition is different for the ESP32 and Artemis (Apollo3) Arduino cores. Therefore, the code below was inserted to allow the code to compile for all the various processor boards.
language:c
// Redefine CS Pin Name
// SPI_CS0: ESP32
// SS: ESP32, nRF, RP2040
// SPI_CS: Artemis
// PIN_SPI_SS: STM32, SAMD51, nRF, RP2040
#ifndef PIN_SPI_SS
// For Artemis
#ifdef SS
#define PIN_SPI_SS SPI_CS
#endif
// For ESP32
#ifdef SPI_CS0
#define PIN_SPI_SS SS
#endif
#endif
MicroMod Pin Names
Unfortunately, for the RP2040 MicroMod processor board hasn't been included in the MbedOS Arduino core; current progress is on hold
(please refer to this issue in the GitHub repository). However, with the modifications below, the RP2040 Pico board definition can be used.
By using the RP2040 Pico board definition, the generic MicroMod processor board's pin names obviously can't be used. Therefore, all the pins must be declared by their GPIO pin numbers. In addition, the default pin connections for the SPI bus on the RP2040 MicroMod processor board differs from the RP2040 Pico. To accommodate for the different pin connections, a custom SPI object was created and passed into the library.
language:c
// SX1276 pin connections:
// | SLOT 0 | SLOT 1 |
//==========================
// cs | CS0 | CS1 |
// dio0 | D0 | D1 |
// dio1 | G2 | G7 |
// dio2 | G3 | G8 |
// rst | G1 | G6 |
// tx_en | PWM0 | PWM1 |
// rx_en | G0 | G5 |
#if defined(ARDUINO_RASPBERRY_PI_PICO)
// MM RP2040 Processor Board (Using RP2040 Pico board definition)
int pin_cs = 21;
int pin_dio0 = 6;
int pin_tx_enable = 13;
int pin_rx_enable = 16;
int pin_nrst = 17;
int pin_dio1 = 18;
// Redefine SPI pins
int miso = 20;
int mosi = 23;
int sck = 22;
// Custom SPI object
MbedSPI SPI_mm(miso, mosi, sck);
SX1276 radio = new Module(pin_cs, pin_dio0, pin_nrst, pin_dio1, SPI_mm);
#else
Similarly to the RP2040, the Teensy MicroMod processor board definition doesn't include the generic MicroMod processor board pin names yet (we are currently working on this update). Therefore, all the pins must be declared by their pin numbers.
language:c
#if defined(ARDUINO_TEENSY_MICROMOD)
// MM Teensy Processor Board
int pin_cs = 10;
int pin_dio0 = 4;
int pin_tx_enable = 3;
int pin_rx_enable = 40;
int pin_nrst = 41;
int pin_dio1 = 42;
#else
RP2040 Special Consideration
As mentioned above, a custom SPI object was created and passed into the library for the RP2040 MicroMod processor board. However, the library doesn't initialize the SPI bus when it is passed in. Therefore, the setup()
loop includes a modification to start the SPI bus operation.
In our testing, the RP2040 MicroMod processor board had issues with the printouts on the serial port. Adding a while()
statement to wait for the serial port to be accessed by the Serial Monitor, resolved the issue.
language:c
#if defined(ARDUINO_RASPBERRY_PI_PICO)
// Wait for serial monitor/port to open
while (!Serial){
; // wait for serial port
}
// Start SPI bus
SPI_mm.begin();
#endif
Enabling the STM32 Serial Port
When uploading to the provided example code (see above) to the STM32 MicroMod processor board, users will need to enable the serial port on the processor board. Otherwise, when the Serial Monitor is opened, nothing will appear. The following settings must be used in the in the Tools
drop down menu:
Tools
drop-down menu to enable the microcontroller's serial port. (Click to enlarge) LoRaWAN Examples
- The example below assumes that the LoRa function board is inserted into the
0
function board slot of the main board. - While there are sketch examples built into the MCCI LoRaWAN LMIC Arduino library for both the Helium and The Things Network (TTN) servers, users should use the example code that we provide below (click the Download buttons). Otherwise, users will run into various issues.
- The examples below, require a user account and device registration on whichever server you decide to utilize.
- Click here to setup an account on Helium
- Usage Cost: 1 Data Credit (1 DC = 0.001¢ in USD) per packet (up to 24 bytes)
- After a device is first added/registered to an account, it takes approx. 20 min for it to get added to the blockchain. Until then, hotspots will not recognize the device and relay its data packets.
- Click here to setup an account on The Things Stack
- The information below also assumes that users have migrated to and are currently using The Things Stack Community Edition (or V3).
- Devices registered with the V3 console will only work with gateways on the V3 console. (i.e. Data transmissions from a device registered on the V3 console will not be passed to the server, if its transmissions are only received by a gateway on registered to the V2 console.)
- When manually registering a device on The Things Stack, users will need to set the LoRaWAN version to
MAC V1.0.3
(per the library specifications).
- Click here to setup an account on Helium
- We have no control over its service.
- We are not liable for any customer's choice to utilize the network.
- The cryptocurrency market valuation can be volitile.
- There may be legal and financial implications for digital wallets.
- etc.
Our example codes below, allow users to communicate with a LoRaWAN server (through a connected gateway) with the LoRa function board. Simply download, extract the file, modify the sketch to include a registered device's EUIs and application key, and then upload the code the main board with associated processor and function board.
-
Arduino IDE version: 1.8.16
- If not using the Teensy - Windows App Store version 1.8.51.0
- MCCI LoRaWAN LMIC Library version: 4.1.0
-
MicroMod Processor Boards and Arduino Cores:
Processor Board Definition RP2040 Arduino Mbed OS RP2040 Boards version: 2.5.2 ESP32 esp32 version: 2.0.0 STM32 SparkFun STM32 Boards version: 2.0.0 Artemis SparkFun Apollo3 Boards version: 2.1.1 SAMD51 SparkFun SAMD Boards (dependency Arduino SAMD Boards version 1.8.1) version: 1.8.5 - Requires - Arduino SAMD Boards (32-bit ARM Cortex-M0+) version: 1.8.11
nRF52840 [DEPRECATED - Please install standalone packages] Arduino Mbed OS Boards version: 1.3.1 Teensy Teensyduino version: 1.55
Configuring the End Device Information
Once users have registered/added an end (i.e. node) device to their user account, they will need to modify the example sketch to include their device's application EUI (APPEUI
), device EUI (DEVEUI
), and application key (APPKEY
) (provided by the server at the end of the device registration process). Simply, replace the FILLMEIN
value in { FILLMEIN }
, inside of the sketch at these locations:
static const u1_t PROGMEM APPEUI[8]={ FILLMEIN };
static const u1_t PROGMEM DEVEUI[8]={ FILLMEIN };
static const u1_t PROGMEM APPKEY[16] = { FILLMEIN };
in this section of the sketch:
language:c
// For normal use, we require that you edit the sketch to replace FILLMEIN
// with values assigned by the TTN console.
//# warning "You must replace the values marked FILLMEIN with real values from the TTN control panel!"
// This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70. For Helium issued EUIs the last bytes should be 0xF9, 0x81, 0x60.
static const u1_t PROGMEM APPEUI[8]={ FILLMEIN };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]={ FILLMEIN };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}
// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { FILLMEIN };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}
The format of the values should be in a hex format, as shown in the example code below. Users should doublecheck they haven't mixed up their APPEUI
and DEVEUI
values and that they have entered those values with the least significant byte (lsb) first. These are the most likely culprits, if users aren't seeing a join/accept response or data transmissions in the LoRaWAN server's console or the serial terminal.
language:c
// This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70. For Helium issued EUIs the last bytes should be 0xF9, 0x81, 0x60.
static const u1_t PROGMEM APPEUI[8]={ 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x## };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]={ 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x## };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}
// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x##, 0x## };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}
Once uploaded, users can open the serial monitor to view the progress of the device joining their chosen server's network and data transmissions. When using the RP2040 processor board, the example code will wait until the Serial Monitor is opened to execute the code. Users can also view the same information in the server's console, device information page.
Code Breakdown
In order to get the built-in example for the MCCI LoRaWAN LMIC library working, a few changes needed to be made. Below, is a short explanation of the modifications made to the example code that we provide (see above), to include compatibility with all the available processor boards and improve the code performance.
CS Pin Definition
The SPI library for the Arduino IDE, by default expects the chip select pin to be defined as PIN_SPI_SS
. However, this pin definition is different for the ESP32 and Artemis (Apollo3) Arduino cores. Therefore, the code below was inserted to allow the code to compile for all the various processor boards.
language:c
// Redefine CS Pin Name
// SPI_CS0: ESP32
// SS: ESP32, nRF, RP2040
// SPI_CS: Artemis
// PIN_SPI_SS: STM32, SAMD51, nRF, RP2040
#ifndef PIN_SPI_SS
// For Artemis
#ifdef SS
#define PIN_SPI_SS SPI_CS
#endif // SS
// For ESP32
#ifdef SPI_CS0
#define PIN_SPI_SS SS
#endif // SPI_CS0
#endif // PIN_SPI_SS
MicroMod Pin Names
Unfortunately, for the RP2040 MicroMod processor board hasn't been included in the MbedOS Arduino core; current progress is on hold
(please refer to this issue in the GitHub repository). However, with the modifications below, the RP2040 Pico board definition can be used.
By using the RP2040 Pico board definition, the generic MicroMod processor board's pin names obviously can't be used. Therefore, all the pins must be declared by their GPIO pin numbers. In addition, the default pin connections for the SPI bus on the RP2040 MicroMod processor board differs from the RP2040 Pico. To accommodate for the different pin connections, a custom SPI object was created.
language:c
// SX1276 pin connections:
// | SLOT 0 | SLOT 1 |
//==========================
// cs | CS0 | CS1 |
// dio0 | D0 | D1 |
// dio1 | G2 | G7 |
// dio2 | G3 | G8 |
// rst | G1 | G6 |
// tx_en | PWM0 | PWM1 |
// rx_en | G0 | G5 |
#if !defined(USE_STANDARD_PINMAP)
// All pin assignments use Arduino pin numbers (e.g. what you would pass
// to digitalWrite), or LMIC_UNUSED_PIN when a pin is not connected.
const lmic_pinmap lmic_pins = {
#if defined(ARDUINO_RASPBERRY_PI_PICO)
// MM RP2040 Processor Board (Using RP2040 Pico board definition)
.nss = 21, //Chip Select
.rxtx = LMIC_UNUSED_PIN,
.rst = 17,
.dio = {6, 18, LMIC_UNUSED_PIN},
Similarly to the RP2040, the Teensy MicroMod processor board definition doesn't include the generic MicroMod processor board pin names yet (we are currently working on this update). Therefore, all the pins must be declared by their pin numbers.
language:c
#elif defined(ARDUINO_TEENSY_MICROMOD)
// MM Teensy Processor Board
.nss = 10, //Chip Select
.rxtx = LMIC_UNUSED_PIN,
.rst = 41,
.dio = {4, 42, LMIC_UNUSED_PIN},
RP2040 Special Consideration
As mentioned above, a custom SPI object was created. However, the custom SPI object must be passed into code execution for the RP2040 MicroMod processor board. Therefore, the setup()
loop includes a modification to do this. Additionally, during our testing, the RP2040 MicroMod processor board had issues with the printouts on the serial port. Including a while()
statement to wait for the serial port to be accessed by the Serial Monitor, resolved the issue.
language:c
#if defined(ARDUINO_RASPBERRY_PI_PICO)
// Wait for serial monitor/port to open
while (!Serial)
; // wait for serial port
// Pass object back into SPI
SPI = SPI_mm;
#endif // defined(ARDUINO_RASPBERRY_PI_PICO)
Helium Network Configuration
In order to improve the performance of the example code, the modifications below were made to address a clock timing issue and limit the transmission band.
language:c
// allow much more clock error than the X/1000 default. See:
// https://github.com/mcci-catena/arduino-lorawan/issues/74#issuecomment-462171974
// https://github.com/mcci-catena/arduino-lmic/commit/42da75b56#diff-16d75524a9920f5d043fe731a27cf85aL633
// the X/1000 means an error rate of 0.1%; the above issue discusses using values up to 10%.
// so, values from 10 (10% error, the most lax) to 1000 (0.1% error, the most strict) can be used.
LMIC_setClockError(1 * MAX_CLOCK_ERROR / 40);
LMIC_setLinkCheckMode(0);
LMIC_setDrTxpow(DR_SF7,14);
#if CFG_LMIC_US_like
// This makes joins faster in the US because we don't wander all over the
// spectrum.
LMIC_selectSubBand(1);
#endif
Enabling the STM32 Serial Port
When uploading to the provided example code (see above) to the STM32 MicroMod processor board, users will need to enable the serial port on the processor board. Otherwise, when the Serial Monitor is opened, nothing will appear. The following settings must be used in the in the Tools
drop down menu:
Tools
drop-down menu to enable the microcontroller's serial port. (Click to enlarge) Resources and Going Further
For more information on the SparkFun 1W LoRa Function Board, check out the links below:
Hardware Documentation:
- Schematic
- Eagle Files
- Board Dimensions
- Datasheet (E19-915M30S)
- Datasheet (SX1276)
- Arduino Libraries:
- GitHub Hardware Repo
MicroMod Documentation:
Looking for more inspiration? Check out these other tutorials related to MicroMod.