Virtual Reality R/C Car: Part 4 Adding The Head Tracker

Virtual Reality R/C Car: Part 4 Adding The Head Tracker

May 14, 2018

Luke Ridley


After some testing, we realized that only looking forward is very limiting. Almost everyone who drove the car was tilting their head one way or another in order to try and look around. After doing a little more research on Fatshark's Trinity Head tracking Module I realized that it would be easier to just use another IMU. This was because the trinity is meant to be used with one of the store/online bought R/C remote controllers. However I did order a roll, pan, and tilt camera mount for the FatShark 700L CMOS V2 Camera you can find it here:

 

http://www.getfpv.com/fatshark-pan-tilt-roll-camera-mount-servos.html

 

After looking around online for a bit I chose to use Adafruit's 9DOF IMU Breakout board. You can find it here:

 

https://www.adafruit.com/product/1714

 

Adafruit has lots of documentation on all their boards and that makes it much easier to use their products. Once we got the board the next step was to get it hooked up and to learn how it worked. Some information about how to connect the board can be found here:

 

https://learn.adafruit.com/adafruit-9-dof-imu-breakout/connecting-it-up

 

Basically what that page translates to is this:

 

Arduino            IMU

 

5V        <<-->>  Vin

 

GND    <<-->>  GND

 

A5        <<-->>  SCL

 

A4        <<-->>  SDA

 

Also I connected pins 3, 5, and 6 to the signal pins of the pan, tilt, and roll Servos on the camera mount.

 

After I connected everything up it was time to start downloading libraries and putting the test code together. I found all my information on how to set up the code for this chip from here:

 

https://learn.adafruit.com/adafruit-9-dof-imu-breakout/software

 

The key thing is that you have successfully downloaded all four of the libraries they mention in the articles above. The LSM303DLHC and L3DG20 libraries are there to read the information from the gyro and accelerometer/magnetometer. The unified sensor library combines all of this information and the 9DOF library makes this information extremely easy to interpret. On Adafruit's Github they even have an example sketch to help get you started which I have adapted to print some more debugging information and to control the servos. This code that I used to test both the IMU and the camera mount can be found on my Github here:

 

https://github.com/lukebocabearings/VRRC/blob/master/IMU_TEST

 

And a video of the code in action:

 

 

So now that I know how to use the IMU to control the camera mount the next step will be to add the IMU to the board to the transmitting Arduino connected to arcade motorcycle and to add the camera mount to the receiving Arduino on the car. Also I want to make the step towards running the ATMEGA328p micro-controllers totally separate for the Arduino boards. This will help make the wiring cleaner, the design more durable, and also with the help of CircuitMaker (a PCB design software) the design easier for anyone to recreate. Here are the schematics that I have drawn up to include the IMU and servos for the camera mount.

 

Receiver Diagram

vr car

 

Transmitter Diagram

vr car

Tags

Archives