Hello everyone ! I want to share with you my first real finished Arduino project. I tried to make a kind of homemade augmented reality. Let me explain it to you :
It is basically a system that uses a camera to track your head moves to adapt it as an X and Y joystick axis. Until there, the project can be adapted on any game you want.
Then, we will link those axes to the head movement in the War Thunder settings, to give a bit more sensations in the cockpit view.
To make this project, you will need :
I want to thanks Eric Jacob with his Instructable Wii Remote IR Camera Hack With Arduino Interface which gave me this idea.
I took an old broken Wii remote, and i suggest you to do the same. You can still buy one, but it will cost you abot 40$ (expensive !) i think. The remote is sealed with four 3 pointed crosses. Find the right tool or crush the frame. You see the square camera ? Unsold it ! (I tried to but i didn't want to burn the camera. I soldered wires directly on the remote PCB)
Now, solder wires to the camera's pins so we can plug it on the breadboard.
The camera works in I²C, but can't work when plugged directly on the Arduino. We will add some components to simulate the DFRobots IR camera. Follow the electric diagram to complete the camera.
Try to make the camera looking at you, at your head's height, typically like a webcam onto your screen.
I used the UnoJoy and DFRobotIRPosition library to emulate the joysticks. the principle is very simple :
Once the code is flashed, we need to turn the Arduino into a joystick controller.
Now, your Arduino will appear as a controller for Windows. Go to Config panel > Hardware > Peripherals > Right click on your new controller > Settings > Properties. You can see here a panel which gives you a preview of the joystick axes and button evolution. Note that if the led is not detected, the returned value from the camera will be 255,255. The default position of the stick will be in the down right corner.
Important note : If the arduino doesn't returns anyvalue, even if the code and the board are correct, try to unplug/replug your wires and reset it until the cross shows the down right corner (which means the camera communicates now).
To recover the "Arduino mode", follow the same pattern :
The controls we want to set are in the "Camera control" settings. Link the X axis to the left-right axis and the Y axis to the upward-downward axis. Test in-game the moves it makes, you can rescale to make the moves as realistic as it can with the "scale" settings.
And it's finished ! well done ! you can now enjoy a more realistic gameplay for your aircrafts game. Note that the depth axis is not present. I will probably make a 2.0 version with 2 LEDs to have a depth notion, but I don't think it will be enough accurate.