car

Racing Wheel controlled RC Car

Our latest tech toy is a radio controlled car that can be driven with any USB game controller. We built this car to demonstrate what’s possible with HTML5 and Arduinos. We tested the car with an Xbox gamepad and a Logitech racing wheel. The raw gamepad control data is retrieved from the browser’s navigator object so any other front-end tricks could be used to drive the car like a javascript joystick or voice control with the HTML5 web speech API.

IMG_20150330_192351

The work has started off by taking out the original radio and motor drive modules and the antenna from the car. We were left with two motors, one for steering and one for acceleration, and the plan was to rebuild the whole architecture using Arduinos. We succeeded and the motors are now driven with a powerful H-bridge module (L298n) and the wireless connection is handled by two nRF24l01 antennas. The arduino and the motors are both powered from the original 6V battery pack (4xAA).

IMG_20150330_193544

The onboard Arduino Nano receives wireless messages from an Arduino UNO connected to a Macbook Pro. This laptop runs a Node.js server that has two main two tasks in this workflow: firstly it sets up a realtime connection with the browser using web sockets and the socket.io node module, secondly it passes on this control data to the Arduino UNO through the USB port. Serial messages can very easily be sent through the port with the serial node module. Essentially this server is the link between the browser and the Arduino UNO.

IMG_20150330_195450

In the browser we don’t have to worry about too many things. The raw gamepad data is available natively from the navigator.getGamepads method. This method will return an array of javascript objects. Each element in the array is a gamepad data object and each object has the x, y, z analogue values of the joysticks, pedals or wheels and the binary values for all the buttons.

We put together a quick, one and a half minute video showing the build process and the first test drives.

This project is not yet finished. We are planning to install an onboard, wireless camera that will be streamed to a monitor in front of the racing wheel for a true simulator experience, like if you were sitting in the seats of the toy car. Adding a pair of red break lights and white headlamps, two temperature sensor for the motors or a buzzer for horn is also in the plan.