Virtual Reality Controlled RC Car

About: Mechatronics Engineer and tinkerer. Making Robots is my main hobby.

Have you ever wanted to be shrunk down and pilot a craft like Innerspace or Fantastic Voyage? Well, I think this is as close as you're going to get on short notice!

Here's the pitch:

A Real-Life remote control car piloted from a VirtualReality command console. This means that you strap on a VR Headset, Flip a switch on an RC Car, then can pilot from VR with live video feed straight to your face.

There are thee things that I implemented that you can control on the VR Car.

  1. Wheels
  2. Horn
  3. Lights

All of these have some sort of button or lever in VR that you can flip or switch to drive the car.

For the full repo and more info, check out my Github and my website!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials and Tools

Step 2: Construct Car

The chassis for the car is super easy to construct. You just need to attach the motors to the main board via the tabs that they give you. After you have attached the wheels and motors, you will also need something to attach the camera to the front of the car.

I used the cardboard box that the camera came in to mount it. I cut out a large L shape and cut a hole for the camera to poke thorough. After that, you can just slot the camera through, and put some tape in the back to keep it in place. If you want, you can also put holes in for your headlights now too, or do that later when measuring out the length of wire.

You will also need to attach the wheel encoder to one of the wheels. It doesn't matter which, I put it on the back left wheel. You need to put the magnetic disk on the actual shaft of the wheel, and the encoder should be attached to the car next to it. It's pretty receptive, so it doesn't need to be right up on it, but as close as possible. I secured my encoder with tape and a zip tie. The encoder is what we will use to measure the speed of our car.

Step 3: Solder Circuits

This part is rather tedious, but not complicated. If you follow the picture, and measure out everything before you cut your wire, it isn't too bad.

While you're doing this, you should also calibrate your buck converter to output the correct voltage. The Raspberry Pi and Jetson Nano both take 5v in, but our battery is at 11.1v. So, we need to make sure we don't fry our electronics. To do this, plug your battery into the input side of the buck converter. While the battery is plugged in, use your multimeter to measure the output side of the buck converter. Use a small flat-head screwdriver to turn the potientiometer on the buck converter until the output voltage is 5v. Once the output is correct, you won't have to turn the potientiometer anymore.

Step 4: Install Dependencies on Embedded System

Not too much to do here, but still incredibly important.

First, make sure you connect to the router you will be using so it can connect automatically from now on.

Then, open up a terminal and type in the following:

sudo apt update
<p>sudo apt install openssh-server</p>sudo apt install python-pip


pip install numpy
pip install opencv-python
pip install pyzmq

Once these things have installed, we need to make sure that, no matter what port the arduino is plugged into, it is always recognized. So, we write what are called UDEV rules. These are rules for your operating system that govern what happens when you plug things in. We want to identify the arduino when it's plugged in, and give it a name to access it by. That name will be "arduino_0". To do this, we will use the arduino's internal serial number to identify it.

<p>udevadm info -a -n /dev/ttyUSB1 | grep '{serial}' | head -n1</p>

This will spit out a value for the serial number, go ahead and copy that value.

We then need to edit (or create if it doesn't exist) a file called "99-usb-serial.rules". This file lives in the following file path "/etc/udev/rules.d/99-usb-serial.rules". Like I mentioned, if that file doesn't exist, just create it and paste in the following line with VALUE_FROM_ABOVE replaced with your value from before.

<p>SUBSYSTEM=="tty", ATTRS{serial}=="VALUE_FROM_ABOVE", SYMLINK+="arduino_0"</p>

This tells the operating system that whenever it sees this specific serial number to call it arduino_0.

The last thing to do here is to download the pushArucoVideoPullCommands.py and put it somewhere easily accessible. I would recommend the home directory for your user, as that's where we will end up when we SSH into the embedded system later.

Step 5: Setup Static IP Address

Now is the part that everybody loves, IP addressing. For this project to work, the code needs to know where to send images and control commands to, and that means our devices need a static IP.

There are many ways to assign your device a static IP, but, because we have a router connecting our ground station and embedded system, we can use it to give us specific IP addresses very easily.

Navigate to your router's admin section, typically (for most routers) this is done by opening a web browser and going to "192.168.1.1". It will ask you to sign in, and the typical standard username and password for most routers is "admin".

Once there, navigate to something that mentions 'DHCP Server". This is a process that runs on your router and keeps track of what devices are connected to it by their MAC Address, which is always constant. We want to select the devices we care about, the ground station computer and embedded system, and add them to the reserved client section. This will give them a static ip whenever they are connected to this router.

Make sure that you set the Embedded System's IP to 192.168.1.122
The ground station's IP can be set to anything.

Step 6: Upload Code to Arduino

To upload the arduino code, we need to first install a library to work with the motor shield.

On your Arduino IDE, go to Sketch->Include Library->Manage Libraries... Then, search for Adafruit Motor Shield Library. Install this library, then upload the code to your arduino, nothing else should be required.

Step 7: Attach Circuitry & Computer to Car

Now that the circuit is built, It's time to put it all on the car. I'm not going to lie, a lot of this stuff is just held on with tape because that's what was easiest for me to slap together real quick. That being said, the has fitted mounting holes as seen in the image above.

Most of the things are pretty easy to just let sit somewhere on top of the car, so, don't worry if there's not a lot of space.

Step 8: Setup VR Environment

This section is going to look a litte different depending on what sort of VR setup you've got going on. Whatever the case, I used SteamVR to develop this software, so you may need to have that installed.

As long as you're using SteamVR, the controls should adapt to different controllers. I've mapped the controls to "Actions" not necessarily buttons, so, in theory, it will adapt for everyone.

You just need to download and unzip the file with the build Unity world and be ready to run the VR_Bot.exe.

Step 9: Run It All Together

So, now that we've got the car setup, and the ground station all hooked up and ready to go, how do we actually run this bad boy? Well, from the Ground Station's point of view, all you have to do it run the VR_Bot.exe file we saw from earlier.

At the same time, you will need to plug in the battery to the Embedded System, and have it automatically boot up and connect to your router. Once it's booted up, SSH into it. To access this, you will need some sort of terminal on the ground station, I recommend GitBash.

SSH stands for Secure Shell and it is a protocol for accessing remote systems securely. In our case, it will give us access to the Embedded System from the Ground Station. Click Here to learn more.

You need to know the username that you setup your embedded system with. For raspberry pi's the default username is 'pi' and password 'raspberry'.

Once installed, open up a terminal and type in the following:

ssh {Embedded System's username}@192.168.1.122

This will open up a terminal in the Embedded System.

Once there, you just need to execute the python script we copied over earlier.

python /path/to/pushArucoVideoPullCommands.py

After you do that, the Embedded System will start pumping out images and receiving commands to and from the ground station.

You're then good to start driving and having fun!

Robotics Contest

This is an entry in the
Robotics Contest

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions