Arduino Nano BLE Head Tracking Camera Set Up
by Kevr102 in Circuits > Electronics
2459 Views, 4 Favorites, 0 Comments
Arduino Nano BLE Head Tracking Camera Set Up
This head tracking camera set up would normally be used for RC Planes but can be used for any vehicle platform.
So in this Instructable I would like to show you how I put together firstly a tracked Radio Controlled tracked chassis with a 10amp RC driver and a Pan/Tilt Camera system, the chassis is controlled by a FrSky Taranis Transmitter and a Flysky 10 Channel Receiver.
There are quite a lot of things to cover in this Instructable, things that I had issues with and managed to sort out.
The Pan/Tilt mechanism is set up within the Taranis Transmitter using one of the 3 Way switches Switch SC in this case to select between (off Position 1)centres the pan/tilt system, (middle Position2) is Head Tracker mode and the( lower 3rd position) is for slider manual operation, the chassis motion is controlled by the right stick which would in normal flying situations would be Elevator and Aileron movements but using the 10amp Cytron RC Driver we can use this to drive the motors on the chassis.
For Head Tracker operations the Arduino Nano BLE which is a pretty cool Microcontroller, not only does it have Bluetooth should your Transmitter have Bluetooth capabilities, (mine does not) but it also comes with a 9 axis inertial measurement unit (IMU) which means that it includes an accelerometer, a gyroscope, and a magnetometer with 3-axis resolution each. This makes the Nano 33 BLE the perfect choice for more advanced robotics experiments, exercise trackers, digital compasses, etc.
The Nano BLE is attached to the side of DJI Goggles then via a cable into the trainer port of the Transmitter and used in conjunction with a Caddx Air camera module, the Goggles came with the DJi FPV kit and the Air Module was purchased separately, all these components are expensive to buy and there will be cheaper ways of achieving the same result but I already had the DJi goggles so it made sense to go with the Air unit.
I believe some models of Fat Shark Goggles have the Head Tracker Trinity option.
So for the Components:
Supplies
Tracked chassis in this case.
FrSky Taranis X9 plus
Flysky FS-IA10B Receiver
DJi Goggles V2
CaddX Starlight Camera Air Unit
Arduino Nano BLE
Cytron 10 amp 2 Motor RC Driver
Pan/Tilt Servo module
2 x SG90 Micro Servo's
6v NimH Battery pack for the chassis receiver and pan/tilt
9v Rechargeable batteries and Switched Holders
Tracked Chassis Set Up
In this first step we will cover getting the Tracked chassis up and running via the RC Transmitter, The Tracked chassis is a bought chassis, you have to build it from the components and it's not too expensive.
To drive the motors I am using a Cytron 10amp 2 Motor driver, this motor driver allows you to connect up 2 individual motors and control them via an RC Transmitter there are instructions with the driver on how to connect etc this is designed for RC vehicles and I connected the 2 motors up to the relevant channels on the receiver, power is provided by a 6v NimH power pack, the camera module needs more power so is on a separate 3S power supply, the driver board has switches so you can test motor direction at that stage before coupling everything together
RC1 and RC2 on the driver board is where you make the connection to the receiver channels, I use channels 1 and 2 which give me full directional control using the right hand sticks on the Transmitter.
The Chassis can be tested at this point, any directional tweaks needed can be made in the Mixes section within the Transmitter.
We can now move onto Installing the Pan/Tilt Servo Arrangement and also the Caddx Air unit and Camera onto the chassis:
Setting Up the Caddx Air Module
The Pan/Tilt module for now is just a bought one and you can get them from Amazon etc, for future uses I would like to design and 3D Print one, I positioned this on front of the chassis and secured with double sided tape.
The Caddx Air Unit and Goggles binding:
Before going any further I thought at this point I would see if the camera and Air unit actually worked.
This is where I had a couple of issues, once again there are quite a few videos on Youtube on how to bind the Air module to the Goggles but which ever route I took didn't work for me, I did eventually get the Goggles and Air Unit to bind and this is what worked for me.
Both the Goggles and the Air Module should be updated with the latest version software prior to commencing with the set up, to do this you download DJi Assistant 2, I downloaded as a Zip file and made a desktop short cut, the screen shot shows you what you should be seeing after download.
I clicked on the image but I think it detects automatically and then brings either the goggles or Air unit component up whichever unit you are connected to and you click on that and it shows which version of software is loaded.
Clicking the folder takes you into the software page and if you need to update or refresh etc.
Binding the DJi Goggles to the Caddx Air unit, this is where I hit a stumbling block, I couldn't get these to bind no matter how hard I tried.
After looking at various Youtube videos on the matter, most were conflicting on how to set up, the next paragraph is what worked for me.
With both the Goggles and Caddx Air Unit powered up, go into the menu of the Goggles, go to settings then from the list scroll down to about and then scrolling down again Switch to DJi FPV System click on this, then come out of the menu.
On the Air unit just below where the SD card slot is is the bind button, you need a paper clip to depress this, the adjacent LED will turn from green to red, next take hold of the Goggles and where the power cable is there is a red indented button, press this it should go from an intermittent beep to constant then nothing, this should be bound to the Air unit, check the Goggles to ensure the camera is working, if it is then happy days, if it isn't then try pressing the button on the goggles first then the Air unit.
Now the next part for those of you with the FPV drone, it states that it should automatically bind back to the drone, well it doesn't, when I went back into the menu on the Goggles it was in Chinese or Japanese and no way to change the language, the menu is the Air unit menu so you have to rebind each component Goggles to drone then Drone to the controller, I got there in the end but it took me ages to sort out.
The next section is building the Headtracker module.
Headtracker Build
What we are doing in this section electronically is fairly basic in the bigger scheme of things but the actual implementation is very clever, a big shout out to a guy called Cliff who has gone to the trouble of implementing this very clever bit of kit and compiled the GUI go to his Github page and download the zip file for this project.dlktdr/HeadTracker
Within this Github there is a link to a Wiki where all the various connections and wiring diagrams are, in this Instance I am using the wired PPM set up.
There are various videos about this Headtracker on Youtube, this is how I went about setting the whole thing up using a Frsky Taranis X9 Plus Transmitter.
The wiring connections are a momentary switch, this is used to centre the pan/tilt module, connections are D2 on the Nano and Ground, next is the connectivity between the Head tracker and Transmitter trainer port for my set up I am using a 3.5mm Male to Male cable and a suitable Jack, I just used a cylindrical Jack and Hot glued it to the back of the Nano, connections are D10 for the Tip, sleeve to ground, to power the Nano is Vin and Ground, I just used a rechargeable 9v Battery in a switched holder, this is attached with Velcro and a strap to the strap of the Goggles, as for the Arduino Nano, the first attempt I made a 3D Printed case, this was attached to the top of the Goggles using Velcro, I didn't like this, too bulky, so I made another and for that one I just used suitable heat shrink and cut a hole through for the switch button.
You set this Nano up in the HeadTracker GUI, download the latest firmware, it says disconnect then re-connect and then refresh the port, Pins D2 and D10 are default, you need to select the channels for the Receiver and Transmitter, looking at the GUI interface channel selection is to the right hand side, I went for having the Head tracker module to the right hand side of the goggles, so Roll is my Tilt on channel 8, Pan is as is and is Channel 7 there is an on screen notification to calibrate which is just manipulating the Nano in all Axis after this you can see that the head tracker is working in GUI and that pressing the button centres everything, Save the settings in the GUI.
We can now move onto setting the transmitter up.
Frsky Taranis X9 Plus Head Tracker Settings
This section is setting up the Head Tracker via the Trainer port on the Taranis.
At the end of this section, by using 3 position Switch SC(You can use any switch) we will be able to centralize the Pan/Tilt module using Switch SC in the off position, in the middle or 2nd position this will trigger the Head tracker on the Goggles and with the switch in the 3rd position we can manually move the Pan/Tilt with the Left and Right sliders, the idea is is that you hit a snag you can just flick the switch up and the Pan/Tilt module will centralise, when in Head Tracking mode, pushing the momentary switch on the Nano Centralises the Pan/Tilt module.
In the GUI we selected Channel 7 for Pan and Tilt Channel 8
I created a new model and I'm using a Flysky 10 Channel receiver which I had already bonded if that's the word?
We go into the Inputs page and clicking on Channel 7 then edit and set Channel 7 up as Pan, starting at the top of the page you can enter the word pan, source is TR7 which is trainer, then scroll further down to switch and toggle switch SC centre position, Position 2 of the switch, now copy this input and place under the TR7 input name is Pan, Source is LS for Left Slider then scrolling further down to switch make this the 3rd position of the switch, as you toggle the switch it changes in the edit, then enter, do the same with channel 8 and you should end up with the Head tracker pan on Channel 7 Tilt on Channel 8 Switching SC in the centre or 3rd position is for using the sliders on the side of the Taranis Left and Right to manually move the servo's, Switch C in the centre position will be for the Head tracker on the Goggles and the switch in the first position will centralise the servo's.
To set a curve up so when you in effect turn the switch SC off both the Pan and Tilt servos will centralise, the Curve is set up first for Pan and it's a 2 point curve, you can adjust the curve if your servo's are off centre at this point, should something go wrong when you are flying or exploring.
Testing the Head Tracker Set Up and Summary
So there we have it, a fully functional Head Tracking set up for not too much money, ok you still need an FPV system which ever way you look at it, there are cheap camera set ups and cheaper goggles, I used what I had to hand, this system will work with any goggles, I know it works with the Frysky Taranis X9 plus and Painless 360 on Youtube uses a Radiomaster Transmitter and it works, some Frsky Transmitters have Bluetooth which is great, one less cable to worry about.
Testing this set up was pretty cool, I can sit in my lounge and go explore the garden, and have a good look around, albeit a bit of a bumpy ride, I can imagine what it's like on an RC Plane too, would be a great experience, all in all a great project.
I hope you enjoyed this Instructable and thanks for looking.