Driving A Tiny RC Car Over The Internet Using ESP8266

0
11
Driving A Tiny RC Car Over The Internet Using ESP8266

A couple of months ago we set ourselves a project to create an internet-connected RC track where people from anywhere in the world could drive real 1:43 scale RC cars over the internet in real-time – even when thousands of miles away from our race track here in Helsinki, Finland. See the build video:

One of the biggest challenges we encountered throughout this project was figuring out a way to wirelessly control the RC cars from a remote computer.

For this project, we picked 1:43 scale SIKU Racing RC cars. We decided to go with them because seem to be quite durable, which will be perfect for endless online sessions, where people will test the cars to their full potential.

As we decided to go with the small factor RC cars, we didn’t really want to do any custom modifications to the internal car electronics. For that reason, we initially planned to try to use the car’s original boards and to connect and control the cars using the out-of-the-box controllers.

We therefore dismantled one of the original RC car controllers and analyzed the board inside it. It was a very standard 2.4Ghz RC controller, which would receive analog commands from the players’ input—pressed buttons, rotator wheel, speed trigger—and then send them to the RC car.

To connect the RF controllers to our game engine, we decided to use a Raspberry Pi Model B3+ as our server to receive and send the commands.

We then connected an Arduino board (JOY-iT Mega 2560 R3) to the Raspberry Pi, to be able to send current signals to the RC controllers. We went with this board because it allowed us to send signals to all 12 controllers from a single Arduino board.

As mentioned, these controllers receive and send analog signals, so we added a digital to analog signal converter to the architecture.

We then soldered the corresponding cables to the controller pins and created a simple program that sends the commands with the right values. See the code here.

While this concept worked well when we tested it with just one car, we encountered multiple issues when we ran a set of 6 cars simultaneously.

Sometimes the controllers would lose the connections to the cars, or would somehow send a command signal to a completely different car. We had high hopes for this solution, but as but as we wanted to hook up more than just 1 or 2 cars at a time, it wasn’t the one for us.

We went back to the drawing board and started looking into potentially replacing the car’s original electronics.

When we dismantled the car, the electronics were quite simple. There were DC 2 motors connected to a basic electronics board that would transmit and receive RF commands using an nrf24l01 radio frequency controller. They were attached using a simple JST plug and could be easily disconnected from the electronics board, without any unsoldering or additional tinkering.

Now, as mentioned, the cars that we decided to use were pretty small, and so were the electronics boards inside them. For that reason, our choice for a replacement board was pretty limited—and the board needed:

  1. a Wi-Fi chip to connect to the local network
  2. to be able to run a UDP server to receive the steering and rotor motor commands
  3. to have 2 motor drivers to run the DC motors
  4. support hardware for 2 PWM outputs of multiple kilohertz
  5. an analog in port to measure the potentiometer values used for the servo
  6. flash memory to store cars’ specific parameters
  7. to fit inside the car based on the physical constraints.

After some quick googling, we found a couple of ESP-8266 based boards that could be potential candidates.

We decided to go with the Wemos D1 mini pro as it had the perfect dimensions to replace the car’s original electronics board. The Wemos D1 mini pro, however, didn’t address the hardware PWM or the motor driver requirements by itself.

To address the missing features, we added a Wemos motor shield that is easily attachable with pins in a hat style manner. This motor shield has an STM32 based microcontroller that controls a Toshiba TB6612 motor driver through its hardware PWM outputs. The communication between the ESP-8266 and the STM32 happens via the I2C bus with a simple protocol to control each motor separately.

Here’s the initial prototype with the Wemos board and motor shield. As you can see, there was a lot of soldering involved,

As we didn’t want to do a lot of soldering to connect the RC car’s motor and sensor cabling to the car, we printed a custom PCB with all of the plug and play connectors.

We ended up having a 3-layered board architecture, that just managed to fit within the car’s internal dimensions.

Now comes the software part…

The interestin

Read More

Leave a reply