Updated The Serpente R2 from Solder Party is yet another addition to the now long roster of compact Atmel microcontroller-based breakout boards aimed at the maker community.
Compact is the word: the R2 is just 24 x 22mm in size yet makes room for 4MB of Flash, a reset switch, GPIO breakout, three-colour RGB LED and — perhaps the best bit — an integrated USB-to-UART adaptor.
The R2 I have here has a female USB-C connector but you can also get R2s with either a male USB-C port or an extended circuitboard that has four USB lines: both can be slotted straight into the right kind of port on your computer. That doesn’t mean the R2 is intended as a GPIO and bus breakout for a host computer. No, it’s the board’s way of making itself easy to transfer code to.
Connect the R2 up and a CIRCUITPY
drive mounts on your system. Open it up and copy code across to start using the device. Simple.
As the drive’s name will have told you — and indeed the name of the board itself — the Serpente R2 runs CircuitPython, the Adafruit-inspired MicroPython rival. Both forms of the hugely popular interpreted language were developed for microcontrollers; Adafruit’s incarnation is intended to be a little easier for learners.
The board has six GPIO pins which are muxed to provide either six digital/analogue IO pins, or a mix of digital/analogue IO, SPI, I²C and UARTs. You should be able to wire it up to all the parts you’re incorporating into the device you’re making. Bear in mind if you’re using SPI, you’ll likely need one of the remaining three GPIO pins for Chip Select.
I²C is available on just two pins, D4 (data) and D5 (clock); SPI on three, D0 (controller out), D1 (clock) and D2 (controller in). But there are two pairs of UART pins — D4 (TX) and D5 (RX), and D0 (TX) and D1 (RX) — for two separate UARTs.
All of these break out on one side of the board, with holes drilled so you can solder on a male or female header. The pins are crenellated (half-holes drilled through the board edge) to make it easy for surface-mount soldering. This explains the odd positioning of the R2’s other breakout: power lines providing 3V3, GND, VUSB and VIN. These four pins are likewise crenellated and header ready, but because they’re arranged at right-angles to the GPIO pins, they’re not breadboard friendly. Plug the six GPIOs into their own breadboard rows, and the power pins are positioned to slot into a single, common row.
Not that they’ll actually fit: they’re placed so that the 3V3 doesn’t correspond to a hole on a standard five-holes-per-row breadboard. There’s room on the R2 to have shifted the pins closer to the front edge so that they could have matched up with a breadboard’s pin array, so it looks like Solder Party arranged it that way to prevent the R2 being fitted that way.
What this all means is that the R2 is great for soldering to a custom board, but not very convenient for prototyping with a breadboard. In the end, I fitted a male header to the GPIOs and a female header to the power lines so that I could access both. Personally, I prefer boards with pins in parallel down the sides so I can drop them into a breadboard and run off wires from every pin. Solder Party says the power pins are “optional”. Up to a point, Lord Copper — to connect anything useful to the R2, you’re going to need power and ground. But again, with a custom board you’d just route your power and ground lines as you need them.
When it is connected, the R2 is very easy to use. Just create a code.py
file and write your Python:
import board, busio spi = board.SPI() i2c = board.I2C() uart_one = board.UART() uart_two = busio.UART(board.TX2, board.RX2)
Or a fuller ‘Hello World’ example:
import time import board import digitalio led_one = digitalio.DigitalInOut(board.LED_R) led_one.direction = digitalio.Direction.OUTPUT led_two = digitalio.DigitalInOut(board.LED_B) led_two.direction = digitalio.Direction.OUTPUT state = True while True: led_one.value = state state = not state led_two.value = state time.sleep(0.5)
Copy code.py
to the connected board’s drive. The onboard file manager reboots the MCU when new code is copied over, so you don’t even need to eject the drive to run your new code. I particularly like this because it means you can open code.py
in your text editor right off the drive and whenever you make changes, all you need do is save the file to run the code.
Meanwhile you can fire up a terminal and connect to the R2 by serial to help debug any errors that might occur.
I ran the R2 with my standard I²C test device: a four-digit, seven-segment LED based on the Holtek HT16K33 controller. I coded up a simple counter. It worked, but was flaky when driven from the R2’s 3V3 power line, triggering this error:
The microcontroller's power dipped. Make sure your power supply provides enough power for the whole circuit and press reset (after ejecting CIRCUITPY).
This while running off a good USB AC adaptor. However, the setup was rock solid after I switched to the VUSB line, when feeds power straight from the USB port.
If you need a microcontroller capable of running a handful of peripherals, but which takes up less space that an Adafruit Feather, Teensy, SparkFun Thing Plus or similar compact breakout board, Serpente R2 is certainly worth a look.
The Serpente clocks in at 48MHz board for £15. In comparison, the only slightly larger (32 x 18mm) Teensy 4.0 runs at 600MHz, has way more memory (1024KB to 32KB) though less storage (2048KB to 4096KB), runs CircuitPython too and is less than a fiver more. Or you can go for the larger, but WiFi-enabled SparkFun Thing Plus ESP32 WROOM, also for a fiver more. Both boards have a better pin layout.
Update One other point to note: the R2’s 32KB drops to about 21KB once all the foundation code that makes it work is running. So you may have to do some extra work squeezing your application code or you’ll see MemoryError:
in the console. You may need to fall back on the MicroPython cross-compiler to compress imported libraries and avoid overly verbose code.
But, yes, they’re not quite as cheap, nor a surface-mountable as the R2, and that might be what swings it for your project, especially if you foresee adding it to a custom board.
I got my Serpente R2 for £15 from Pimoroni.