The Challenger RP2040 WiFi MkII is an Arduino/Micropython compatible Adafruit Feather format micro controller board based on the Raspberry Pico chip.
The new and improved MkII gives you better RF performance with its new 4-layer PCB design as well as a new Bi2C connector that allows you to connect all our Bi2C peripherals.
the extremely powerful dual core RP2040 Cortex-M0 device. So the main controller of this board is the RP2040 which has 264KByte of SRAM internally and 8MByte of external FLASH memory.
WiFi
The WiFi chip that we’re using on this board is the Espressif device ESP8285. For those of you that is unfamiliar with this device, it is basically an ESP8266 device with an integrated 1MByte of flash memory. This allows us to have an AT command interpreter inside this chip that the main controller can talk to and connect to you local WiFi network. The communications channel between the two devices is an unused UART on the main controller and the standard UART on the ESP8285. As simple as it can be.
The ESP8285 chip comes pre-flashed with Espressif’s AT command interpreter stored in the internal 1MByte of the ESP8285. This interpreter support most of the operating and sleep modes of the standard ESP8266 framework which makes it easy to work with. Talking to the device is as easy as opening the second serial port (Serial2), resetting the ESP8285 and start listening for events and sending commands
USB Type C
In the recent years we have noticed that we are seeing more and more USB Type C cable laying around the lab due to the fact that all new phones and accessories use them. As of yet we haven’t seen any shortage of micro USB cables but we are not getting any new ones any more and old ones do break occasionally. So we decided to go for a USB Type C connector for this board. A bonus of this is that they are quite bit more durable and you don’t have to fiddle with the cable before plugging it in.
Pinout
On board antenna or U.FL ?
This board is available in two different antenna option versions. The most common version is with an on board chip antenna which just works straight out of the box. The second version has a U.FL connector on board which requires you to add an external antenna for your system. You can basically use any 50ohm 2.45GHz antenna and it will work just fine.
Weight
0.009 kg
Dimensions
5.07 × 2.28 × 0.72 cm
Using the Arduino environment
We’ve teamed up with Earle F. Philhower over at his Github page to provide Arduino support for our RP2040 based boards. You can follow the instructions on Earle’s github page or you can check out our instructions here on how to install the package.
MicroPython
The Challenger RP2040 WiFi board is fully compatible with both the micropython package found at the Raspberry Pi site as well as Adafruits CircuitPython. Instruction are available on how to install the python interpreter of your choice is available on respective web site.
Short initialization example
To simplify the hardware aspect of the WiFi modem we have included a small helper class in the Arduino IDE that is always available to you as a developer. This new class replaces the previous examples on how to do a proper reset and sync.
The first thing you need to do in your sketch is to include the HW support library and the WiFi library by entering:
After this basically all you need to do before starting the WiFi manager is the following:
if (Challenger2040WiFi.reset())
Serial.println(F("WiFi Chip reset OK !"));
else
Serial.println(F("Could not reset WiFi chip !"));
After these step the modem is initialized and is ready to accept your commands. The reset() function of the built in Challenger2040WiFi library will perform a HW reset of the WiFi modem and wait for it to return the “ready” prompt. After this a WiFi manager can be started and start communicating with the modem. Here at iLabs we use the WiFiEspAT library and initializing the stack is as easy as
WiFi.init(Serial2);
Make sure the library is included at the top of the file with: #include <WiFiEspAT.h>
At this point you can also do a check to make sure that the data link is setup properly.
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
You are now good to go, so doing something like this:
Serial.println("Waiting for connection to WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print('.');
}
Serial.println();
Serial.println("Connected to WiFi network.");
will work as expected.
Changing the baudrate
The default baudrate between the RP2040 micro controller and the ESP8285 WiFi modem is 115200 and while this is probably good for most IoT applications that normally don’t send very much data it can sometimes be useful to increase the baudrate. The Challenger2040WiFi contains a method for doing this and again it is super simple to use. Just do the following and the baud rate will be altered on both systems and the devices will be synced up.
Challenger2040WiFi.changeBaudRate(921600);
After this you can proceed to communicate with the device as normal.
Sending and AT command
After the modem has been initialized and it has reported that it is ready you can now send a command to it. Here’s an example on how a simple command can be sent.
Serial2.println("ATE0");
This command simply tells the modem not to repeat everything back that you send to it. If you want to enable this again you would simply send the following command:
The Challenger boards fully supports circuitpython and should be supported shortly by the official releases. But until then we have created a beta release of the circuitpython image which can be downloaded from here.
Please go ahead and put it through its paces and feel free to report back any issues that you may find.
How do I use it
Basically it works as any other circuitpython board but we have included relevant board parameters for simplify accessing specific pins and other special IO’s. The board help function lists the following functions:
You can discard this string as it is simply a startup message from the modem that looks like garbage. If we now instead send a simple AT command to the modem like this:
wifi.write(bytearray('ATrn'))
You should now receive a valid response back from the modem when reading. It should look like this:
print (wifi.read())
b'ATrnrnOKrn'
Initializing the board in circuitpython using Adafruit espatcontrol library
The following piece of startup code is taken from Adafruits espatcontrol python library examples and modified to support our board. You
if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_RX TX = board.ESP_TX resetpin = DigitalInOut(board.WIFI_RESET) rtspin = False uart = busio.UART(TX, RX, baudrate=11520, receiver_buffer_size=2048) esp_boot = DigitalInOut(board.WIFI_MODE) esp_boot.direction = Direction.OUTPUT esp_boot.value = True else: RX = board.ESP_TX TX = board.ESP_RX resetpin = DigitalInOut(board.ESP_WIFI_EN) rtspin = DigitalInOut(board.ESP_CTS) uart = busio.UART(TX, RX, timeout=0.1) esp_boot = DigitalInOut(board.ESP_BOOT_MODE) esp_boot.direction = Direction.OUTPUT esp_boot.value = True # For Boards that do not have an rtspin like challenger_rp2040_wifi set rtspin to False. esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag ) print("Resetting ESP module") esp.hard_reset()
And you are good to go. Happy snaking around the system and feel free to report any bugs that you may find.
Reviews
There are no reviews yet.