As Internet of Things (IoT) projects become more complex and interconnected, utilizing versatile development boards and potent libraries is of the essence. The Challenger RP2040 LTE board is one such powerful development tool, offering an excellent base for IoT projects. When paired with the NB_Generic library, it promises seamless network communication, enabling you to create high-performing IoT applications. In this article, we’ll walk you through the steps to get started using the Challenger RP2040 LTE board integrated with the NB_Generic library.
Step 1: Setting Up Your Environment
Before you dive in, you’ll need to ensure that your development environment is set up correctly. The necessary elements include:
- Arduino IDE: Download and install the latest version of Arduino IDE from the official Arduino website.
- Board Support Package: Install the board support package for the Challenger RP2040 LTE from your Arduino IDE’s board manager. Click on this link for a detailed description on how to do this.
- NB_Generic Library: Download and install the NB_Generic library, which can be found in the Arduino library manager or from its GitHub repository.
Step 2: Familiarizing with Challenger RP2040 LTE Board
Understand the features and functionalities of the Challenger RP2040 LTE board. Familiarize yourself with its architecture, which includes the RP2040 microcontroller, LTE modem, and various peripherals.
Step 3: Understanding the NB_Generic Library
The NB_Generic library serves as a wrapper for different cellular modules, including LTE. It helps in streamlining the communication process between your board and the cellular network. Before you start coding, take time to explore the library’s documentation and example sketches.
Step 4: Connecting Your Board
- Connect the Challenger RP2040 LTE board to your computer using a suitable USB cable.
- Select the Challenger RP240 LTE board and port from the Arduino IDE’s tools menu.
Step 5: Building the NBWebClient example as our first step into a fully connected device.
- Create a new project by Selecting the NBWebClient example in the Arduino IDE file menu (File->Examples->NB_Generic->NBWebClient).
- This creates a new version of the example files which we need to make a few modifications to, to make them recognize our board.
- A defines.h file is created where we need to make some additions and changes (look for the iLabs comments) to as described below:
/*********************************************************************************************************************************
defines.h
**********************************************************************************************************************************/
#ifndef defines_h
#define defines_h
#define DEBUG_NB_GENERIC_PORT Serial
// Debug Level from 0 to 5. Level 5 is to print out AT commands and responses
#define _NB_GENERIC_LOGLEVEL_ 1
#define SECRET_PINNUMBER ""
//////////////////////////////////////////////
#if defined(ARDUINO_CHALLENGER_2040_LTE_RP2040) // <- iLabs new line added
#define SerialNB SARA_SERIAL_PORT // <- iLabs new line added
#define NB_RESETN PIN_SARA_RST // <- iLabs new line added
#define NB_PWR PIN_SARA_ON // <- iLabs new line added
#elif defined(ARDUINO_SAMD_MKRNB1500) // <- iLabs Modified line (#elif instead of #if)
#define USING_CUSTOMIZED_MKRNB1500 false
#if USING_CUSTOMIZED_MKRNB1500
#define SerialNB Serial1
#define NB_RESETN (3u)
#define NB_PWR (2u)
#else
#define SerialNB SerialSARA
#define NB_RESETN SARA_RESETN
#define NB_PWR SARA_PWR_ON
#endif
#else
// Override the default (and certainly not good) pins and port
// Only for boards other than ARDUINO_SAMD_MKRNB1500
#define NB_RESETN (10u)
#define NB_PWR (11u)
#if ESP8266
// Using Software Serial for ESP8266, as Serial1 is TX only
#define NB_USING_SOFTWARE_SERIAL true
#else
// Optional Software Serial here for other boards, but not advised if HW Serial available
#define NB_USING_SOFTWARE_SERIAL false
#endif
#if NB_USING_SOFTWARE_SERIAL
#warning Using default SerialNB = SoftwareSerial
#define D8 (15)
#define D7 (13)
#include <SoftwareSerial.h>
SoftwareSerial swSerial(D7, D8); // (D7, D8, false, 256); // (RX, TX, false, 256);
#define SerialNB swSerial
#else
#warning Using default SerialNB = HardwareSerial Serial1
#define SerialNB Serial1
#endif // NB_USING_SOFTWARE_SERIAL
#warning You must connect the Modem correctly and modify the pins / Serial port here
#endif
//////////////////////////////////////////////
// Optional usage of NB_RESETN and NB_DTR. Need to be here only when true. Default is false
#define UBLOX_USING_RESET_PIN true // <- iLabs uncommented
#define UBLOX_USING_POWER_ON_PIN true // <- iLabs uncommented
//////////////////////////////////////////////
#define NB_MODEM_SARAR4 true
//////////////////////////////////////////////
// Not supported yet
#define NB_MODEM_SIM7000 false
#define NB_MODEM_XBEE false
#define NB_MODEM_SEQUANS_MONARCH false
//////////////////////////////////////////////
// libraries
#include <NB_Generic_Main.h>
#endif //defines_h
- We also need to make a small addition to the sketch in order to get the modem started properly. Add the following lines to the setup function. This will enable the separate power supply to the modem.
// Power on modem
if (!Challenger2040LTE.doPowerOn()) {
Serial.println("Failed to start the modem properly !");
while(1);
} else {
Serial.println("Modem started !");
delay(1000);
}
With these minor adjustments to the defines.h files and the sketch you can now connected to the internet and can read and write data in pretty much any way you like.
Conclusion
The fusion of the Challenger RP2040 LTE board with the NB_Generic library offers a robust platform for IoT development, allowing for rapid prototyping and deployment. By understanding and modifying the defines.h
file as described, you can tailor the library to work seamlessly with the Challenger RP2040, paving the way for innovative IoT projects. Remember, the journey doesn’t end here; explore further functionalities and features to enhance your projects significantly.
Happy coding!
0 Comments for “Getting started with the Challenger RP2040 LTE board”