Intro: Alternately Occluding Dichoptic Modifier of Stereoscopic Transmission [ATmega328P+HEF4053B VGA Superimposer]
After my experiments with liquid crystal glasses used to occlude the eyes (here and there), I decided to build something that is little more sophisticated and also does not force the user to wear PCB on his or her forehead (people sometimes can behave in a hostile manner when seeing others with electronics sticking out of their bodies, cyborgs just don’t have it easy these days). Device I designed modifies VGA signal send to 3D display (video must be in Top – Bottom or Side By Side format), enhancing video signal with dichoptic stimulation. Enormous library of movies and games that can be watched and played in compatible 3D formats should make any AODMoST user happy and engaged. There are studies indicating, that forms of treatment that are possible with AODMoST are beneficial to people with amblyopia.
Step 1: Disclaimer
Usage of such a device may cause epileptic seizures or other adverse effects in small portion of device’s users. Construction of such a device requires use of moderately dangerous tools and may cause harm or damage to property. You build and use described device at your own risk.
Step 2: Parts and Tools
Parts and materials:
- ATmega328P-PU microcontroller
- HEF4053BP analog switch
- 7805 in TO-220 package voltage regulator
- 3x 2N2222 transistors
- BS170 transistor
- 2x diffused blue 3mm LEDs
- diffused red 3mm LED
- 2x diffused yellow 3mm LEDs
- diffused green 3mm LED
- 20 MHz HC49/US crystal
- 10 pin AVR ISP (IDC) male connector
- 2-pin PCB screw terminal block 5.08mm connector
- 8x 6x6mm tactile switch buttons
- 3x 1k ohm trimpot 6mm
- 3x 75 ohm 1/4W resistor
- 3x 1k ohm 1/4W resistor
- 3x 2k7 ohm 1/4W resistor
- 3k3 ohm 1/4W resistor
- 11x 10k ohm 1/4W resistor
- 2x 20pF ceramic capacitors
- 3x 100nF ceramic capacitors
- 2x 100uF electrolytic capacitors
- perfboard (70mm x 90mm, min 24 x 31 hole array)
- few pieces of wire
- insulating tape
- VGA male to VGA male cable
- 12V – 15V DC power supply
Step 3: Soldering Electronic Components
If you want to program ATmega before soldering, do it (you can then leave CON1 out of PCB). Solder all electronic components to prefboard. Use copper wires (0.5 mm diameter ones from UTP cable should be perfect) to make electrical connections between components. Make sure that wires do not cause any short-circuits. If there is a risk of short-circuit (as it is the cause with one of the leads of R21, wire on the front between SW8 and C7 and wire located on the front side next to Y1), cover wire with insulating tape or heat-shrink tubing.
If you like, you may each a PCB, instead of using prefboard. I described processes of making PCB using toner transfer method in my previous project. Board in .svg files should have 64.77mm x 83.82mm. Attached files that contain track layouts should be great help even if you are making connections on prefboard with copper wires.
Step 4: Attaching VGA Cable
Cut your VGA cable in half and strip all wires from insulation. Mark one part of cut cable as IN and other as OUT. Solder wires to appropriate pads on PCB. To identify which wire is connected to which pin in the connector, use continuity tester in your multimeter and then consult VGA pin out to identify each wire purpose. You only need to connect wires that transmit Red, Green and Blue video and horizontal and vertical sync pulses. If there are other wires in your cable just solder them back together, or better yet solder them back through prefboard, as I did with white wire that connects pins 11 in the VGA connectors (connection is now located between R7 an R8). Video card detects that a VGA display is plugged in by sensing resistance in approximate range of 50 ohm to 150 ohm between R, G and B video pins and ground (75 ohm termination resistors in the display, AODMoST adds to that resistance), so I2C pins aren’t really necessary and VGA cable can work without them being connected (like in the cable I used, of course lack of I2C means that monitor won’t be able to send information concerning supported resolutions and that can be problematic). If there is a risk of shot-circuit, use insulating tape or heat-shrink tubing. Connect shielding in two parts of the wire with each other and use insulating tape to secure both parts of VGA cable together and to attach cable firmly to PCB. Put few layers of paper on the back of PCB attach it with insulating tape.
Step 5: Programing ATmega Microcontroller
Plug your AVR programmer to CON1 with appropriate ribbon cable or female to female jumper wires. I used USBasp and AVRDUDE, so uploading .hex file required me to execute following command:
avrdude -c usbasp -p m328p -B 8 -U flash:w:aodmost.hex
I also needed to change fuse bits to E:FF, H:D9, L:F7, so that microcontroller will be using 20MHz crystal. I’ve kept default extended and high fuse byte values, and changed low fuse byte value from L:62 to L:F7 with use of following command:
avrdude -c usbasp -p m328p -B 8 -U lfuse:w:0xF7:m
If you get an error during uploading .hex file, you may need to change -B (bitclock) value from 8 to something higher, like 16.
Step 6: Use of AODMoST
Connect 12V – 15V DC power supply to screw terminals (- is closer to a top edge of PCB). Plug VGA connector from IN half of VGA cable to video card, connector from OUT half to 3D display. Device has 4 modes, 3 of them draw pairs of rectangles upon video. There are 6 pages of stetting. Those with numbers 0 and 3 contain settings of frequency/period, occlusion rate, rectangle being on/off and such. Pages 1 and 4 contain position settings while pages 2 and 5 contain size settings. By pressing MODE + PAGE buttons you restore default settings in all modes. You can read more about configuring AODMoST in user_manual.pdf
One possible source of 3D content in Top – Bottom or Side By Side format are computer games. If you use GeForce video card, many games from this list can be played with CustomShader3DVision2SBS in 3DMigoto enabled. Yo can learn how to enable it and how to resolve problem of tint put upon screen by 3D Vision Discover anaglyph 3D mode here (note: I’ve found that you need to set "LeftAnaglyphFilter" to "&HFF00FF00" and "RightAnaglyphFilter" to “"&HFFFF0000"” [other combinations of colors should also work, just make one component color missing] in order to disable tint in Discover anaglyph mode). Radeon and GeForce users should be able to use TriDef 3D software. There are games like GZ3Doom (ViveDoom) that natively support 3D and can be played without any special software.
EDIT: I had problems with disabling 3D Vision Discover tint in newer version of NVIDIA drivers. That lead me to the discovery of SuperDepth3D, a ReShade post-process shader. This software is compatible with at lest 20+ games, and works with GPUs from different manufacturers.
Step 7: Design Overview
VGA signal has 3 component colors: Red, Green and Blue. Each of them is send through separate wire, with intensity of component color coded into voltage level that can vary between 0V and 0.7V . AODMoST draws rectangles (overlay) by replacing color signal generated by video card with voltage level provided by transistors Q1-Q3 in emitter follower configuration, that convert impedance of voltage on a 2k7 resistor – 1k trimpot voltage divider. Switching of signals is done by HEF4053B analog multiplexer/demultiplexer, powered from 12V – 15V DC power supply. Resistance across HEF4053B is linked to its supply voltage (higher voltage – lower resistance). If lower supply voltage would be used, video card wouldn’t be able to detect the display.
Rest of AODMoST is powered from 5V DC provided by 7805 voltage regulator. Level of signal from microcontroller that controls switching of HEF4053B is converted by fast BS170 MOSFET.
Horizontal and vertical synchronization pulses vary in voltage level between 0V and 5V and wires that carry them are directly connected to ATmegas interrupt pins configured as high impedance inputs.
For some reason ATmega328P-PU microcontrollers that I had (they have different numbers on top of them), all have problems with internal pull-up resistors, so I used external 10k pull-ups. Only logical reason for this behavior that I found, is that fundamental laws of nature are changing with the expansion of the universe and that makes integrated circuits malfunction (that was a joke, probably).
Device consumes approximately 50 mA.