Close

First Prototype Development

A project log for Mario Kart in Real Life

Custom Mario Kart-style game with small PCB-framed RC cars using ESP32 and machine vision

jake-wachlinJake Wachlin 04/27/2019 at 19:150 Comments

The first step for this project was determining some of the base technologies. I wanted to use the ESP32 modules as the brains and communications of the cars, since it provides a huge amount of computation ability and FreeRTOS is really convenient for handling everything needed. However, I had never done point-to-point communication with ESP32. ESP-NOW seemed like the perfect option, with allegedly low-latency and seemingly easy to use. When I started testing with it, it actually seemed to be more difficult than I'd hoped. Eventually I got it working, and to help others I made an example and wrote it up on Hackaday here.

I also did some testing with the Jevois smart vision camera. I was worried that latency would be an issue. Using the AR tags however, it seemed to be able to track many at once at >120fps and very low latency. I think it should work well.

The basic idea is that a python program on my laptop would communicate with the Jevois camera to get the positions of all of the carts, communicate with a USB Xbox controller, and send commands through the ESP-NOW network with an ESP32 dev board connected via USB.

The first prototype I made was fairly simply. It uses 2 DRV8833 dual-H-bridge motor drivers to control all 4 motors. Space is made for each motor, with cutouts in the PCB for the wiring connections to pass through. In the future, the motor tabs would stick through the PCB to be soldered directly. The motor is then supported to the PCB with hot glue, which seems to be strong enough. Wheels are press fit onto the motor shafts. Since the car is so lightweight and there are four motors, I expect this to be OK (to be seen if I burn out motors too often).

I wanted to be able to write some traction control software and a drift mode, and to do that, the car needs feedback about what it is doing--likely encoders on each wheel and a gyro. This first prototype does not have a gyro, but I did try to design DIY encoders at each wheel. The wheels have 6 spokes, so I thought of sending modulated IR light (classic 38kHz, like for remote controls) through the wheel and detecting it on the other side. This would be low resolution, only 6 CPR, and provides no direction measurement, but would be very cheap. The idea is to solder the through-hole emitter and detector components directly to the PCB next to each wheel, and bend the components into place. As it turned out, the leads on the components are not quite long enough so I am rethinking the approach.

I have been using the ESP32 on a number of other projects recently, and having a robust way to program them has been a challenge. I built an adapter board that connects to a cheap USB-FTDI converter, has a reset and a bootloader button, and connects to a standard Molex cable. I can then put a cheap "picoblade" Molex 5-pin connector on my projects and easily connect to it for programming.

Unfortunately, once I built the first prototype, I was having issues programming it. The exact issue appears to be related to the flash memory inside the ESP32 WROOM module. It seems it was either damaged at the factory or was damaged during my reflow process. I may have to swap it out to get the prototype to work.

Discussions