Introduction: Lowcost 3d Fpv Camera for Android
This is an entry in the
FPV is a pretty cool thing. And it would be even better in 3d. The third dimension does not make very much sense at big distances, but for an indoor Micro Quadcopter it's perfect.
So I had a look at the market. But the cameras I found were all too heavy for a micro quadcopter and you need expensive goggles for it. The other possibility would be to use two cameras and two transmitters. But again you have the problem of the expensive goggles.
So I decided to make my own. All cameras on the market use a FPGA for making the 3d picture. But I wanted to keep it cheap and easy. I was not sure if it will work but I tried to use two Sync Separator ICs, a Micro controller to manage the syncing and a analog switch IC to switch between the cameras. The biggest problem is to get the cameras synchronized but it is possible to do that with the controller. The result is pretty good.
Another problem were the 3d goggles. Normally you need special 3d goggles which are pretty expensive. I tried a few things, but I was not able to solve it just with electronics. So I decided to use a USB video grabber and a raspberry Pi with google cardboard. This worked pretty well. But it was not very nice to put the screen into the cardboard and have all the electronics around. So I started to write an android app. In the end I had a complete 3d FPV system for android for less than 70 Euro.
There is a delay of about 100ms. That's because of the video grabber. It's small enough to fly with it.
You need pretty good soldering skills to make the camera because there is a self made circuit board but if you are a little experienced you should be able to do it.
OK, let's start with the parts list.
Step 1: Parts List
- PCB: you can get the PCB with the parts here (about 20 Euro
- 2 Cameras: It should work with almost any pair of FPV cameras. They must have the same TVL and the same clock speed. A good choice is to use some cams where you can easily access the Christal. I used a pair of these small cameras with 170 degree lenses because I wanted to use it on a Micro Quad. (about 15 to 20 Euro)
- FPV transmitter: I use this one (about 8 Euro)
- FPV receiver (I had one laying around)
- 3d Printed Frame
- Easycap UTV007 video grabber: It's important to have the UTV007 chipset. You can try other UVC video grabbers, but there is no guarantee that it's working (about 15 Euro)
- USB OTG cable (about 5 Euro)
- 3d FPV Viewer Android App: Lite Version orfull version
- some sort of google cardboard. Just google for it (about 3 Euro)
Step 2: Assemble the PCB
Order the PCB. You can order it directly from Aisler with all the parts you need. After you have received the PCBs assemble all parts. It's pretty small, but with magnifying glasses it's easily possible. (I use desoldering wire to remove the soldering bridges from the ICs. I'm sure you find some soldering howto in the internet)
If you want to make the PCB yourself or order it somewhere else, you can download the eagle brd file and the parts list (3dcam_mini_tiny24.txt).
The size of the PCB is for 20mm * 20mm or 16mm * 16mm mounting holes. If you use the 16x16 holes you can cut the PCB at the outer slits.
When you are finished with soldering and you have checked all connections again you can connect the isp wires. In the first picture you see where to connect SCL, MOSI, MISO, RESET, + and -. In the third picture you can see the pinout of the AVR ISP programming wire. The fourth picture shows how my connections looks.
Download and extract the '3dcam.zip' file from the link on the bottom of this step. The hex file is located in the Debug folder. The fuses should be programmed to LFUSE 0xe2, HFUSE 0xDF and EFUSE 0xff. If you use linux and avrdude you can use the flash.sh file in the Debug folder. The avrdude command line is: "avrdude -c avrisp2 -p t44 -U flash:w:./3dcam.hex -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m". If you use windows you will find a howto with google.
If programming worked and you soldered alright, the LED blinks fast. This indicates that no camera was found. You can now remove the programming wires.
The source code is included. Feel free to upgrade the code.
Here is the LINK TO THE AVR PROGRAM
Step 3: Connect the Video Transmitter
Now its time to connect the video transmitter. I connected it with some strong wires to have it mechanically fixed. Connect + to +, - to - and the 3d video output to the video input of the VTX. You can see it in the second picture. If you use a 5V video transmitter like me, you can connect the internal 5 V pin to + with a soldering bridge.You can see in the third picture where the connection should be.
It's also possible to use a video transmitter with a different supply voltage. If you use such a transmitter don't connect the internal 5V to +. Instead connect your supply voltage to + at the video transmitter connectors on the PCB.
Step 4: Print the Cam Holder
Print the three stl files. I printed it with PLA, a 0.3 mm nozzle and 100% infill. Feel free to design your own cam holders if you don't like mine or you use different cameras.
Step 5: Connect the Cameras, Download the App and Test the 3d Camera
Now you can test the 3d camera. Connect the two cameras to the PCB like in the picture. You can solder the cameras directly to the PCB. I just use plugs because I tested a few different cameras.
Download the App 3D FPV Viewer Lite from google play store. Start the app and connect the UTV007 video grabber with a USB OTG cable. (The app also supports UVC video grabbers with a resultion of 640x480, but it is only tested with the UTV007 video grabber. I tried a Eachine ROTG01 receiver, but it didn't work because it deinterlaces the video). Tap on START and power the 3d camera. The LED on the PCB blinks a few times. Then it flashes constantly for NTSC cameras or is off for PAL cameras. If it is blinking fast, the circuit could not detect the cameras. After a few seconds you should see the pictures of the cameras on the android screen. Maybe you see a part of the first camera at the picture of the second camera like in the third picture. That's OK for the moment. I will give some tips how to solve that at the end of the instructable. If you get no picture, just one picture on both sides, a very small picture on one side or a picture that is not aligned alright, try to restart the camera a few times until it's OK. You can close the video window on the upper left side where the 'X' is. Even if it's working you should go on with the next step.
Step 6: Connect the Clocks of the Cams for Syncing(not Needed But Strongly Recommend)
To get the cameras synced good they have to run from the same clock. You don't need to do that but it is strongly recommend. If you don't sync them you will get bad color distortions or it doesn't get synced at all. It depends on the cameras you use. Sometimes the clocks of the cameras are far away from each other.
To connect the clocks you have to remove the crystal, the capacitors and the resistor of the oscillator from one of the cams. Then you must connect a cable from the second cam's crystal to the desoldered pad of the first cam. In my case it worked without removing the capacitors and the resistor. With some other cams I had to remove them.
If you use big cameras this is pretty easy. With the small cams I use it's pretty hard but possible. Sadly I have no good camera to make good photos, but I added some pictures to make clear what to remove and where to put the connection cable. I used a small side cutter to remove the crystal. After you have added the connection cable you should fix it with some super glue.
If you have an oscilloscope power both cams and check the output signal to be sure it's working.
Step 7: Conclusion, Additional Info and Some Tips
Conclusion: The camera is working pretty well. Even if it's not perfect, It's usable. There is a delay of about 100ms, but for normal flying and to test 3d fpv it's ok.
Info and Tips:
- If you don't have an android smartphone which supports the easycap UTV007 or UVC you can easily get one on e-bay. I bought an old Motorola Moto G2 2014 for 30 Euro.
- The camera is not syncing every time. If you don't get a picture or the picture is not OK try to restart the camera a few times. For me that always worked after a few tries. Maybe somebody can improve the source code for a better syncing.
- If you didn't sync the clock of the cameras, one picture will slowly go up or down. It's less disturbing if you turn the cameras by 90 degrees, that the picture is going to the left or right. You can adjust the rotation in the app.
- Sometimes the left and right sides are changing randomly. If that happens restart the camera. If the problem still remains try to set the DIFF_LONG parameter in the 3dcam.h higher, recompile the code and flash the hex file again.
- You can set the standard to PAL by putting PB0 and PB1 to +5V
- You can set the standard to NTSC by putting just PB0 to +5V
- With PB0 and PB1 not connected the auto-detect mode is active with big difference (standard)
- With just PB1 connected to +5V the auto-detect mode is active with small difference. Try this if you see a part of the first picture on the bottom of the second picture. The risk for randomly changing pictures is higher.
- I use the standard mode with clock synced PAL cameras, but I set the app to NTSC. With this adjustment I have NTSC resultion and no risk of randomly changing pictures.
- I had very bad color distortions with not clock synced PAL cameras. With NTSC cameras this did not happen. But anyway, syncing the clocks is better for both standards.
Details about the code:
The code is just documented in the 3dcam.h file. All important settings can be done there.
Some comments on the defines:
MIN_COUNT: After this number of lines the side is switched to the second camera. You should leave it how it is.
MAX_COUNT_PAL: This option is just used in PAL mode. After this number of lines the picture is switched back to the first camera. You can play around with this parameter if you use PAL mode.
MAX_COUNT_NTSC: The same for NTSC
DIFF_LONG/DIFF_SHORT: These parameters are used in auto detect mode. This number is subtracted from the auto detected switch time. You can play around with these parameters.
MAX_OUTOFSYNC: This was meant to check the syncing of the cameras, but it never worked alright. Just leave it like it is or try to implement it yourself.
If you use my PCB you should leave the rest of the defines like they are. A makefile is located in the Debug folder.
That's it. I will add an inflight video and an instructable for the quadcopter soon. For the moment there's just the camera test video.
We have a be nice policy.
Please be positive and constructive.
You can use this instuctable to add a FPV receiver to your Easycap UTV007 video grabber:
would a Samsung galaxy j3 work with that chipset?
I don't know. In general it is working on all devices where normal UVC cameras are working. The galaxy j3 supports USB OTG but it looks like it doesn't support UVC cameras. Anyway, for the UTV007 no UVC support is needed. There is a driver for it in the app. But the USB controller must support isochronous transfer. Not all mobile USB controllers do so (LG X Power is not working). I think you should try it. But there is no guarantee that it's working. If it doesn't work you can get an old smartphone with UVC support on ebay for small money.(e.g. Motorola Moto G, Samsung Galaxy S3, ...)