Introduction: Binocular Robot Head a Stereoscope Camera

About: My name is John Espey. I am a videographer and artist in the San Francisco Bay Area. All my life I have loved ants and machines so why not make mechanical lifeforms? If you like my work, subscribe to my pag…

Introduction

Famous film robots like Wall-E and Johnny Five have binocular vision not only because it is cute and relatable, but it can serve a practical function. Binocular vision is nature’s way of adding depth to our sense of sight. I want to show you a method I created of building a binocular or stereoscopic robotic camera that could be used in your RC project or videography.

Stereoscopic photography has been around for a long time. Thankfully, early adopters have figured out a few simple rules to improve the 3D effect generated by taking two photos side by side. One of these rules is the 1/30th rule (Information on stereoscopes). This rule relates to the interaxial separation between the camera lenses. Essentially, the distance between each “eye” relates to how well we as viewers see depth in the resulting image.

My motivating interest is to record stereoscopic macro footage of a subject within one foot of the camera, so I’ll show you a method to shrink down the interaxial separation considerably by using very small cameras. This is known as Hypo-stereo, and mimics the eyes of small organisms like a frog or mouse. The resulting image makes small objects appear big, just what I want. The opposite would be Hyper-stereo. The larger interaxial separation makes large objects appear small. You can see this effect in 3D movies sometimes when areal shots of towns make them appear to be scale models.

Step 1: Parts and Tools

Snag yourself a few Y2000 cameras online. They are the cheapest tiny cameras I have found, running less than $20. That’s about how much the micro SD cards you’ll need to record images cost too. I purchased two cameras, but received the wrong kind, so the seller sent me two extra. As it turns out, I’m glad I had the backups, because these cameras are pretty unpredictable.

You will also need two analog micro servos like the Tower Pro SG90, and a handful of electronic components.

Here’s the list:

Components:

X2 Micro Servos

X2 6V Battery packs for AA or AAA

X2 1K Resistors

X4 330 Ω

X2 10K Trim Potentiometers (set to 5k)

X2 100K Trim Potentiometers (set to 48k)

X4 220nF capacitors

X6 BC547B (or 2N3904) npn Transistors

X1 Analog joystick 2 Axis like this one from Parallax https://www.parallax.com/product/27800

X1 Wire connecting port, like a Cat 6 port with 8 pins

X1 Cat 6 cable with 8 wires or 4 pairs (any 6 - 8 wire cable will work, just get a matching port)

X1 Double Pole Single Throw switch

X1 Project Enclosure large enough for your batteries, switch, joystick, and connecting port

Tools required are wire cutters and strippers, soldering iron, pliers, super glue, and a vise. I like to use a fly-tying vise because it is designed to hold small objects, and easily rotates on an axis.

Later in the instructions, I use a drill, Dremel, screwdriver, and computer with Adobe Premiere and After Effects video editing software.

Step 2: ​Build the Stereoscopic Camera

Carefully take apart each Y2000 and remove the battery, board, and sensor assembly. The sensors are attached to the board with a very delicate ribbon cable. Make sure not to over work this cable and potentially break a connection.

The microphone is hiding inside the mounting component for the sensor. Coax it out and let it stick off to the side, we can arrange this piece later.

Turn one of the cameras upside down so the sensor mounts mirror each other. Use a toothpick to apply super glue to one side of each plastic sensor mount and press together. The flat sensor mounts make this easier. Hold these in place with a couple pieces of tape. The goal is to set each camera pointed in the same direction perfectly parallel to each other.

Apply glue to one mounting tab on the micro servo opposite the cables and attach the camera sensors to the servo case opposite the drive shaft.

Take small cuts of double-sided foam tape and place them on the SD card port. Stack them so the boards can be attached to the servo without glue and flush with the sensor mounts.

Take another couple cuts of foam tape and stick the LiPo batteries to the boards.

Sand one servo horn with a nail file and score the edge of the servo without cameras on the large side. Glue the servo horn to the case of the servo. This will be the pivot point for the panning servo.

Test out your cameras to make sure they are working. Each camera will need to be turned on and set to record each time you use it. Also, you’ll need to charge the very small batteries pretty often, as they drain quickly. Later I will describe how to work with the footage.

Step 3: ​Create the Servo Controller Circuits: Theory

Servos require what is called Pulse Width Modulation at their signal wire to understand where you want the servo arm to turn to. Pulse Width Modulation is the act of adjusting the duty cycle of a waveform like a square wave. For analog servos, most need 1 – 2 ms of on signal (positive voltage) and 7 – 18 ms of off signal (zero voltage). The datasheet for the SG90 servo says they operate at 50 Hz (20ms) but I found they function well upwards of 90 Hz. The on signal must always be between 1 and 2 ms though.

You can find many examples online of controlling servos with Arduino or even a 555 timer chip, but I am going to get really fundamentals here and use only discreet components. Let’s use the Astable Multivibrator Circuit! Just a warning, this circuit tends to be… jumpy, and your servos will gain a lot of personality.

The Astable Multivibrator creates a square wave at a frequency determined by the resistor capacitor charge time in the circuit. What is neat about this circuit is that the duty cycle of the square wave can be set by adjusting both sets of resistors and capacitors.

I found that when the capacitors in this circuit are 220 nF, the resistors should be 5 – 15k for the 1 – 2 ms on time, and 48k for about 8ms of off time. Now, in total, this is 10 ms or 100 Hz frequency, which is much higher than the stated operating frequency for these servos, but I found these values through trial and error and they worked for me.

The 2 axis joystick (https://www.parallax.com/product/27800) I am using is just like those found in playstation controllers. When you move the joystick in the x or y direction, it changes the resistance of two potentiometers, one for the x-axis and the other for y. Those resistance values are ~5k in the center, and go down to 0 and up to 10k when you move the joystick.

So, if we set our trim potentiometers to 5k in the circuit, then we can use each axis potentiometer of the joystick to change the pulse width from 1 to 2 ms of on signal, and thus, control the position of the servo horn, our robot neck.

The drawback to using this circuit is that you need separate power supplies for each servo because they interfere with each other’s signal. You can’t just run both circuits in parallel on one battery. Not a super big deal, but it does add an extra step in the wiring process later. It also means that our pre-soldered parallax joystick needs to be liberated from its board because it comes soldered with a common ground.

Step 4: ​Create the Servo Controller Circuits: Build

I will show you how to solder this circuit together in the “Dead bug” or point to point style. This style is a method of constructing circuits without a circuit board. It used to be very commonplace, but it has gone out of style. I like it though.

We’re making two of the exact same circuit, one for each servo.

Start by trimming each lead of the components like the attached photo.

Tin each lead with solder.

Join the capacitors to the base and collector of the npn transistors.

Solder the 330 Ω resistors to the collector – capacitor junction.

Solder the center lead of each trim potentiometer (pot) to one end. The center is the wiper and when it is shorted to one end, the whole pot acts as a variable resistor.

Solder the 10k trim pot to one base – capacitor junction and the 100k trim pot to the other base – capacitor junction in both circuits.

Solder the two open ends of the 330 Ω resistors to the open end of the 100k trim pot. This is our positive voltage rail.

Solder the 1k resistor to the collector of the third transistor not currently attached to anything.

Solder the base of this third transistor to the emitter of the transistor whose base is attached to the 10k trim pot. This is very important to do carefully, otherwise our pulse width modulation will be inverted. Double check the diagram.

Now solder the emitter of this third transistor to the emitter of the other transistor on the opposite side. This connection is our 0V rail.

Glue this circuit to the back of each servo.

Trim the servo cables and solder the orange signal wire to the collector – 1k junction.

Solder the red positive voltage wire to the two 330 Ω and 100k trim pot junction, or positive rail.

Solder the brown or black 0V wire to the emitter connection, our 0V rail.

Cut off the last 4 inches of the Cat 6 cable and strip back the twisted pairs. Hold onto the short 4 inch trimmed end and strip those pairs as well, they'll connect the components inside the control box.

Solder one pair to the positive rail, one wire to the 0V rail, and one wire to the unconnected 10k pot lead.

If the Ethernet has eight wires or four pairs, you’ll use all eight by keeping the positive voltage wire a pair and un-pairing the others.

Note the colors of these wires like solid green, stripped green, solid blue, solid orange, etc… This way you’ll know which wires to solder where in the control box.

Step 5: ​Create the Servo Controller Circuits: Control Box

Frankly, I felt like this was the hardest step, but maybe you’re better at working with enclosures.

We need to securely mount the joystick, switch, Cat 6 port, and hold our batteries.

I cut holes in the plastic box large enough to put the switch and port through and bolted them in with small nuts.

I cut a 3/4 “ hole for the 1 inch joystick. But the joystick needs to be bolted to the lid hovering about ¾” down below the top of the enclosure.

To solve this problem, I glued the joystick to a piece of plastic with four holes drilled in the corner. These match four holes in the top of the enclosure. Then I cut short sections of plastic tube (like an old pen) and used these as spacers to keep the joystick mount positioned securely below the enclosure top. I used four 1 inch bolts that thread through the enclosure, spacers, and joystick mounting plate to hold it all in place.

I used double sided foam tape to hold the battery cases into the enclosure, and soldered the positive leads of each battery case to the switch. Then I soldered the switches to each circuit matching the colors of the twisted pair coming off the Cat 6 port.

The joystick pots will be soldered to the positive rail wire pair, and the wire that runs to the 10k pot for each PWM circuit.

In hindsight, maybe the PWM circuit should have been in the enclosure as well, but I wanted this to seem like an adaptable solution for a robot head, not a remote camera, so in future designs the control circuit can stay local to the servos and some other sensor can replace the joystick.

Step 6: Attach Servo Horn to Something

Implement your own version of this design and attach it your drone, car, or maybe mount it in a tree. I'd love to see what you create!

Of course, this version is tethered to the control box, so a good tip would be to secure the Cat 6 cable to this mount so the wires don't tug on the servos. Large cables are actually heavier than this whole circuit and can really ruin your day if they yank on it too much.

I didn't know this before I started, but the batteries for the cameras can actually be replaced by a couple AAs. In hindsight, I might consider lightening the load on the servos, and reducing the need to recharge batteries on the robot head by supplying power from afar. That is good news for those of you hoping to attach this to your existing power system. The cameras require at least 3V.

Step 7: Media Management and Editing

After you start each camera recording, make sure to mark the
audio and video with a distinct sound. It is best if you can see the source of the sound in the frame too. This will allow you to synchronize the two cameras together by aligning the clips to that spike in the audio waveform.

Copy the contents of each memory card to your computer and import into your editing software. I am using adobe premiere, but final cut pro works great too. You may need to convert files to a format your editing software understands. I use the free program MPEG Streamclip, because you can convert almost anything to anything. Check them out: Squared 5 Mpeg Streamclip

Based on my design, the left camera is upside down. In your editing program, resize each clip from each camera to cover it’s respective side of the frame. For example, the right camera must stay on the right side of the frame and the left camera must be turned upside down and stay on the left side of the frame. The Y2000 camera records a 4:3 aspect ratio image in standard definition resolution, so creating an HD video, you’ll need to scale up the size a bit.

Find that moment when you slated each camera. In the audio waveform, you should notice a strong spike. Align the spike from both camera clips to the same exact time and both cameras should be perfectly in sync.

Because each camera recorded it’s own audio as well, you can even pan the left camera’s audio all the way to the left and the right camera’s all the way to the right and create your own stereo audio.


3D Video Formats

Side by Side video is the easiest method of producing a distributable video. The video frame is split in the middle. Currently (early 2015), YouTube accepts side by side 3D video in their advanced uploading options. Select 3D and choose the “side by side, left on the left” option. In order to watch these videos, you’ll need some kind of viewer like the Google Cardboard, or the Oculus Rift, which use lenses to let your eyes focus up-close on a small screen like your smart phone.

I built my own Google Cardboard by downloading their template and instructions from their website. https://www.google.com/get/cardboard/

Another method of 3D viewing is called anaglyph. Creating an anaglyph (red/cyan, green/magenta) requires removing certain colors from the left and right videos.

This is more challenging to edit, but it is the only way to get an audience to share the experience of watching your videos together. Instead of forcing each eye to see separate images like the side by side method, both images are overlaid with slightly different colors. Then the viewer wears glasses with colored filters to block one of the images from each eye.

I followed this tutorial to start creating an anaglyph. http://www.svoigt.net/index.php/tutorials/22-ster...

In Adobe After Effects, import both camera clips and make sure they are synchronized. Then select the channel mixer effect and make sure the left camera has only Red-Red color.

Apply the same channel mixer effect to the right, but keep the green and blue colors, abandoning the red.

Finally, set the layer mode of the left camera to “difference” or “add” and you should see both images overlaid with different colors.

The tutorial I linked above goes on to suggest more fine tuning to your anaglyph, but this will get you started and you can follow the link to optimize your video.

Now just find a bunch of pairs of 3D glasses and distribute to your friends, or sit down with a Google Cardboard and zone out.

Thank you for reading and following along, I hope you enjoyed this instructable.

Automation Contest

Participated in the
Automation Contest