Lowcost 3d Fpv Camera for Android

5,509

62

41

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

3D Camera:

  • 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)

Additional needs:

    • Soldering Iron
    • Soldering experience
    • magnifying glass
    • AVR Programmer
    • PC with avrdude or some other AVR programming software
    • Android smart phone with USB OTG support
    • 3d printer for the camera holder

    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.

    [Update] I designed a new camholder. You can put the cameras in 8 directions now and it's more stable. Download Camholder2.stl and clamp2.stl

    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.

    UPDATE 6th September 2018:
    It is not necessary to remove the crystal and the capacitors/resistor. I have some new cameras and it's also working if you just connect a cable between the clock signals without removing anything. One crystal will force the other one to it's frequency. Try this before you remove the crystal of one camera.

    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.

    Update 5. Aug. 2018: I made a new AVR program for clock synced cameras. I don't know if it works when you don't sync the clocks. If you have synced cameras you should use it.

    It can happen that there are colour distortions with PAL cameras. Reset the AVR until you have a good picture for both cams. I added a reset button to my PCB for that.

    It can happen that you have randomly changing pictures with NTSC cameras. Reset the AVR until it stops to change randomly. You can also play around with the DIFF_SHORT parameter in the source code.

    There are a few changes to the last version:

    • PAL/NTSC gets autodetected. The manual selection is removed.

    • To set DIFF_SHORT put PB1 to +5V. You should do this if you see a part of the second picture at the bottom of the first picture.

    • The cameras are always syncing now.

    Here is the link

    Share

      Recommendations

      • Make it Glow Contest 2018

        Make it Glow Contest 2018
      • Optics Contest

        Optics Contest
      • Plastics Contest

        Plastics Contest

      41 Discussions

      0
      None
      MarcelH13

      6 weeks ago

      Started this project, recently. Parts have arived.

      Prototype is gonna be with DIL-ic's and the discrete analog parts are SMD.

      Made schematic based on Ani23456' design. Tnx, Andi!

      Here the basic setup:

      If errors, please let me know! Gonna place an Arduino NANO 328p as microcontroler.

      At first, gonna start with the 2 cam's and 2 LM1881 ( and the discrete parts )chips only!

      I know about composite video signal but want to learn more: begin with PC-logic-analyzer ( burst, odd/even/sync). At my oscilloscope I'll display the composite signal (time based).

      Marcel

      mySch_3d.jpg
      19 replies
      0
      None
      MarcelH13MarcelH13

      Reply 2 days ago

      Got me a secondhand handy and new VR-goggles. The "mono" setup is ok.
      And with adjustments, it can be used for the 3D-fpv, too!



      Have to continue programming the software for controlling the 2 cams.


      20181115_140716.jpgmono 2.jpg
      0
      None
      MarcelH13MarcelH13

      Reply 17 days ago

      Sure, I understand that 2 humans eyse are needed for depth!

      0
      None
      MarcelH13MarcelH13

      Reply 17 days ago

      So, your set ups sends alternately left and right picture ( each picture ODD and EVEN )?
      And at the recive site you send them to the alternately to the left and right side of the lcd?

      0
      None
      Andi23456MarcelH13

      Reply 17 days ago

      Yes, that is how line alternating 3d works. I put one picture on the Odd frame and the other one on the even frame. This picture is sent by the transmitter to the receiver. The android app or the raspberry pi divides the two fields back to left and right picture. One for each eye.

      0
      None
      MarcelH13Andi23456

      Reply 16 days ago

      Clear! You know, my very first aproach was to send the first ODD-line-cam1 followed ( then switch to ) by the first ODD-line-cam2, as were it 1 TV-line! Thand the second..etc
      When completed: take the EVEN-lines...etc...

      Kind regards!

      0
      None
      Andi23456MarcelH13

      Reply 16 days ago

      Ok, I'm not sure if you understand it right. I explain agein: The two cameras get synced by the circuit, that ODD/EVEN lines have the same timing. Then it switches one cams ODD field and the other cams EVEN field to the VTX. Now you have one NTSC/PAL picture with both camera pictures in it. At receiver side the App/Pi takes the picture and puts the ODD field to one side of the screen and the EVEN field on the other side. Because the picture is interlaced there is every second line(1,3,5,7,...) for ODD field(cam1) and the lines between(2,4,6,8,...) for EVEN field(Cam2). With the side by side 3d picture of the app at the screen you have a 3d view with google cardboard. One picture for each eye. In the picture below you can see a raw image before it gets "decoded" by the app/pi. You can see there, that left and right camera are line alternating.

      Bildschirmfoto von 2018-11-01 12-19-48.png
      0
      None
      MarcelH13Andi23456

      Reply 14 days ago

      For the moment, first gonna do some flights with my ( ready for weeks, except rPI split screen ) "MONO" setup at the heli and get some more skills using rPI in commen. Meanwhile, I ordered a quadrocopter, due of lack of channels on heli, it flies "like a hoovercraft"...
      By the way, you said you used rPI before, what programm did you used?
      Can't find anyting. ( for mobiles phones I see plenty ).

      0
      None
      Andi23456MarcelH13

      Reply 14 days ago

      I added the link to the source code of my self programmed viewer at some other comment before. Here is it again: link. But it is a big mess and just meant as a reference. You could also try MPV for RPI, but it has some disadvantages. The easiest would be to use my app or any other app on a smartphone.

      0
      None
      MarcelH13Andi23456

      Reply 17 days ago

      Thanks. So, there's more going on on the phone/pi than I thought...

      0
      None
      MarcelH13MarcelH13

      Reply 17 days ago

      Just realized that my aprouch/perception of the setup is wrong...

      I thought that switching between cam's and show them to bouth eyes, creates somehow a 3D-view. NOT! But as I pause the video, I can see that the left and right picture are different!
      Most easely to see by the 2 white quadracopterparts protuding at the bottom of the screen.



      0
      None
      MarcelH13MarcelH13

      Reply 24 days ago

      By pulling down a cams oscilator-circuit ( crystal ) for a fraction of a second, will let the cam's come in sync ( or more out of sync ). Works fine!

      0
      None
      MarcelH13MarcelH13

      Reply 5 weeks ago

      Gonna try it by using the clock of 1 othe the cam's and 'switch' to the other cam.

      To be sure: gonna place the 2 transsistors too, for on/off.

      0
      None
      Andi23456MarcelH13

      Reply 5 weeks ago

      You gonna try to switch the clock signal? Good idea. Maybe syncing is easier with this approach. I didn't do that, because in the beginning of the project I didn't want to touch the cameras electronics. My circuit is also working if you connect two cams without synced clocks, even if the result is much better if you sync them.

      0
      None
      MarcelH13MarcelH13

      Reply 5 weeks ago

      Nice!

      Connected all of the 4066, both 8118's and the mC and with some code got the stuf

      switching. The 4066 lets the videosignals pass well. Clear picture.

      Next thing is to code the sync-method.

      0
      None
      MarcelH13MarcelH13

      Reply 6 weeks ago

      Fot time being, there's no commen ocsilator clock for both cam's.