Driving A Tiny RC Car Online Using ESP8266

Driving A Tiny RC Car Online Using ESP8266

A number of months ago we set ourselves a project to create an internet-connected RC track where people from anywhere in the world might drive genuine 1: 43 scale RC automobiles over the web in real-time– even when countless miles far from our race track here in Helsinki, Finland. See the build video:

One of the most significant challenges we came across throughout this project was determining a way to wirelessly manage the RC vehicles from a remote computer.

For this job, we chose 1: 43 scale SIKU Racing RC cars. We chose to go with them because seem to be rather durable, which will be perfect for limitless online sessions, where people will check the automobiles to their full potential.

As we decided to go with the little factor RC automobiles, we didn’t truly wish to do any customized modifications to the internal automobile electronic devices. For that factor, we at first prepared to try to utilize the cars and truck’s initial boards and to link and manage the vehicles using the out-of-the-box controllers.

We therefore took apart among the initial RC car controllers and examined the board inside it. It was a really basic 2.4 Ghz RC controller, which would receive analog commands from the players’ input– pushed buttons, rotator wheel, speed trigger– and after that send them to the RC vehicle.

To link the RF controllers to our game engine, we decided to utilize a Raspberry Pi Model B3 as our server to get and send the commands.

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

As pointed out, these controllers get and send analog signals, so we included a digital to analog signal converter to the architecture.

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

While this idea worked well when we checked it with just one car, we encountered numerous issues when we ran a set of 6 cars and trucks at the same time.

Often the controllers would lose the connections to the automobiles, or would somehow send a command signal to a totally various cars and truck. We had high wish for this service, however as however as we wanted to link more than simply 1 or 2 cars and trucks at a time, it wasn’t the one for us.

We returned to the drawing board and started checking out possibly replacing the car’s original electronics.

When we took apart the cars and truck, the electronic devices were quite simple. There were DC 2 motors connected to a fundamental electronic devices board that would transmit and receive RF commands using an nrf24 l01 radio frequency controller. They were attached using an easy JST plug and might be easily detached from the electronics board, with no unsoldering or additional tinkering.

Now, as mentioned, the vehicles that we chose to use were quite little, and so were the electronic devices boards inside them. Because of that, our choice for a replacement board was pretty restricted– and the board needed:

  1. a Wi-Fi chip to connect to the regional 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 numerous kilohertz
  5. an analog in port to measure the potentiometer worths used for the servo
  6. flash memory to shop cars and trucks’ particular parameters
  7. to fit inside the automobile based on the physical restraints.

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

We decided to go with the Wemos D1 mini professional as it had the best dimensions to change the automobile’s initial electronics board. The Wemos D1 mini professional, nevertheless, didn’t address the hardware PWM or the motor chauffeur requirements by itself.

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

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

As we didn’t desire to do a lot of soldering to link the RC car’s motor and sensing unit cabling to the cars and truck, we printed a customized PCB with all of the plug and play connectors.

We wound up having a 3-layered board architecture, that simply managed to fit within the automobile’s internal dimensions.

Now comes the software part …

The intriguing thing we discovered with these automobiles, is that the cars and truck steering motor wasn’t a servo motor, but instead a DC motor that used a potentiometer to specify the guiding angle.

Technically, a potentiometer and a DC motor are the 2 components of a servo, so we needed to execute a bit of custom-made coding to make them collaborate as a single system.

To be able to communicate with the cars and truck, we established a UDP server on the Wemos ESP8266 board. This allowed us to read signals from the control PC to deal with the steering and rotating of the motors, while also checking out the status of the car.

While all the cars we used had the specific same hardware setup, each motor would work really differently when sending the exact same values. So, we hand adjusted each automobile to recognize what worths work best, and then stored these criteria within the Wemos board’s flash memory. The UDP server and a basic command-line calibration tool which functions as a UDP client were utilized to do the calibration by hand.

As we didn’t want to have to take apart the automobiles each time we ‘d desire to flash updated values or parameters, we also implemented OTA update support for these ESP boards. This allows us to quickly modify, test, and enhance the automobile controls with simply a couple of lines of code.

And that’s the entire setup!

By utilizing the ESP-8266 based Wemos board, we had the ability to overcome the connectivity problems we had with the RF controllers while acquiring far better access to the in-car criteria for simple adjustments, offering us full access to the tuning of the automobile. These Wemos boards are an excellent pick when size is a severe restraint. They are an off-the-shelf option that can suit even the small dimensions of a 1: 43 scale RC cars and truck.

This was certainly a more tough task than we anticipated, but it sure was an amazing learning for the group. Stay tuned for more jobs to come!

You can evaluate the setup and the final result yourself, by playing the video game online

Read More