CircuitPython Boards & RVR

I’ve been successful at getting some commands to run on a number of CircuitPython boards. A big thanks to @rmerriam for his C++ API and to Matthias Kreier, a colleague at my school, for helping with testing on the boards.

Here is a link to the repository containing the code I’ve adapted from the micro:bit implementation:

My annotated library of functions is contained within the sphero_rvr.py file in the repository. The major success of the last week was getting the locator and yaw sensor to report coordinates and heading.

My students are working on a challenge this week to get the RVR to navigate around a VEX field and show what they have learned about control systems and using libraries and APIs. I’ll share some of their work when they finish the project.

One thing I’d love to do is use the CDC functions here in Circuitpython to connect to the RVR:
https://circuitpython.readthedocs.io/en/latest/shared-bindings/usb_cdc/index.html

I know the micro:bit has the DAPLink that sets up the CDC communication with the RVR so that its UART works over USB without any extra work. This doesn’t seem to be the case.

Does anyone have insights on how the RVR presents itself as a CDC host? Does it need to do any sort of handshake protocol to set up a connection? I have tried a few different configurations of the usb_cdc in CircuitPython to use both the console and the data ports, but neither seems to be connecting to the RVR by just plugging it in like the micro:bit. I have tried turning off the USB drive as well and no connection occurs.

Glad my material helped.

Sphero staff has commented that the USB on the RVR wond’t work (my wording) with the USB on many micors. I’m using the GPIO serial port on a Raspberry Pi and used it also with other boards.

Hi @emwdx,

As Rud alluded, RVR will only work properly with USB CDC devices, and none of the typical USB-UART converters such as FTDI/CH340/CP210x since they require custom drivers.

Since I don’t have a Metro board here to test with, it’s hard to know what’s going wrong. Have you tried digging into the MicroPython CDC implementation to see how it might differ from CircuitPython? I can tell you that we don’t have any vendor whitelists or anything like that, so it should be possible to make any USB CDC device work.

I should also mention that there are fairly aggressive current-limiting resistors on the RVR USB data lines, and as a result some USB devices require very short USB cables in order to enumerate successfully.

Hi Jim - great to hear from you again! I think it was almost exactly a year ago when you and Rabia spoke with my automation class.

The board I am trying to use is an Adafruit Neo Trinkey which is quite possibly the shortest link you could have between a USB port and the hardware : )

You can see how easy it would be (especially for students) to test code on a board that just plugs into the RVR USB port.

Everything I see in the documentation looks like it should work, so there’s something I’m missing. I haven’t thought about looking at the Micropython CDC library to see what it does differently for the micro:bit. Great idea!

Thanks all,

Evan