0

Challenger RP2040 WiFi/BLE MkII

The Challenger RP2040 WiFi/BLE MkII is an Arduino/Micropython compatible Adafruit Feather format micro controller board based on the Raspberry Pico chip, equipped with an WiFi/BLE chip that provides both WiFi as well as BLE functionality on the board. The MkII version is an updated version of the first iteration of the board including a new Bi2C connector as well as a an optional accelerometer.

The new MkII version is fully backwards compatible with the original version which means you can use all the available software for it.

RP2040

RP2040 is the debut micro controller from Raspberry Pi. It brings their signature values of high performance, low cost, and ease of use to the micro controller space. With a large on-chip memory, symmetric dual-core processor complex, deterministic bus fabric, and rich peripheral set augmented with our unique Programmable I/O (PIO) subsystem, RP2040 provides professional users with unrivaled power and flexibility. With detailed documentation, a polished Circuitpython port, and a UF2 boot loader in ROM, it has the lowest possible barrier to entry for beginner and hobbyist users

WiFi/BLE

The Challenger RP2040 WiFi/BLE MkII board is equipped with a powerful combined single chip solution that provides the WiFi and BLE connectivity of this board. The chip we are using is the ESP32-C3FN4 from Espressif and it is a complete WiFi subsystem that complies with IEEE 802.11b/g/n protocol and supports Station mode, SoftAP mode, SoftAP + Station mode, and promiscuous mode. It also implements A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth mesh.

This solution is based on an RISC-V micro controller core and comes with 4MByte of internal flash and 408Kbyte of internal SRAM as well as the advanced 2.4GHz radio.

The ESP32-C3 device comes pre loaded with the ESP-AT interpreter already programmed into flash. This interpreter provides the system with everything from low level TCP/UDP functionality up to high level functions such as a on board integrated web server, MQTT server and client functions and much more.

From the get go the on board ESP32 delivers the following functionalities:

  • Basic AT Commands
  • Wi-Fi AT Commands
  • TCP-IP AT Commands
  • Bluetooth® Low Energy AT Commands
  • MQTT AT Commands
  • HTTP AT Commands
  • Web server AT Commands

Setting an MQTT client up for instance is a matter of three lines of code, couldn’t be easier to use.

Other cool stuff on the board

It comes with a sturdy USB-C connector, a battery connector that allows you to plug in standard 1 cell LiPo batteries. It also has an on board charger chip that charges the battery whenever a USB cable is connected or 5V is applied to the USB power header pin. Oh and did we mention that the new MkII version can be equipped with a 16-bit accelerometer.

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 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:

#include <ChallengerWiFi.h>
#include <WiFiEspAT.h>

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(ESP_SERIAL);

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:

Serial2.println("ATE1");

Pass through example

This example Arduino program creates a USB2Serial pass through to the ESP32. This can be used to flash the ESP with new upgraded software or you can write your own code and use this short snippet to flash the device.

CircuitPython by Adafruit

The Challenger boards fully supports circuitpython and should be supported shortly by the official releases.

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:

object <module 'board'> is of type module
__name__ -- board
board_id -- challenger_rp2040_wifi_ble
SDA -- board.SDA
GP0 -- board.SDA
SCL -- board.SCL
GP1 -- board.SCL
D5 -- board.D5
GP2 -- board.D5
D6 -- board.D6
GP3 -- board.D6
ESP_TX -- board.ESP_TX
GP4 -- board.ESP_TX
ESP_RX -- board.ESP_RX
GP5 -- board.ESP_RX
D9 -- board.D9
GP6 -- board.D9
D10 -- board.D10
GP7 -- board.D10
D11 -- board.D11
GP8 -- board.D11
D12 -- board.D12
GP9 -- board.D12
D13 -- board.D13
GP10 -- board.D13
NEOPIXEL -- board.NEOPIXEL
GP11 -- board.NEOPIXEL
LED -- board.LED
GP12 -- board.LED
WIFI_MODE -- board.WIFI_MODE
WIFI_RESET -- board.WIFI_RESET
D0 -- board.D0
TX -- board.D0
GP16 -- board.D0
D0 -- board.D0
TX -- board.D0
GP17 -- board.D0
SCK -- board.SCK
GP22 -- board.SCK
MOSI -- board.MOSI
GP23 -- board.MOSI
MISO -- board.MISO
GP20 -- board.MISO
A0 -- board.A0
GP26 -- board.A0
A1 -- board.A1
GP27 -- board.A1
A2 -- board.A2
GP28 -- board.A2
A3 -- board.A3
GP29 -- board.A3
A4 -- board.A4
GP25 -- board.A4
A5 -- board.A5
GP21 -- board.A5
I2C -- <function>
SPI -- <function>
UART -- <function>

Using these defines it is now simple to access the serial port that interfaces to the WiFi modem.

import board
import busio
import digitalio

wifi=busio.UART(board.ESP_TX, board.ESP_RX, baudrate=115200, receiver_buffer_size=2048)
wrst = digitalio.DigitalInOut(board.WIFI_RESET)
wmde = digitalio.DigitalInOut(board.WIFI_MODE)
wrst.direction = digitalio.Direction.OUTPUT
wmde.direction = digitalio.Direction.OUTPUT
wrst.value = 0
wmde.value = 1
wrst.value = 1

Reading from the serial line at this point will read in a garbage string generated by the WiFi modem. So typing this:

print (wifi.read())

Will produce a bytearray that looks like this:

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_ble":
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_ble 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.


Download CircuitPython

Documentation for the Challenger RP2040 WiFi board.

Firmware:

Follow this link for instructions on how to update the firmware of the ESP32C3 device on the board.

You can always get our products from your local reseller if you like. Here is a list of current resellers.

  • The Pi Hut Raspberry Pi Superstore
  • The largest maker shop in Switzerland

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

You may also like…