Use a Raspberry pi to make your own head-mounted virtual reality or augmented reality displays.
Head mounted displays are definitely the latest fad that's going around town now. You might have seen several wearable displays such as the google glass, and many others including virtual reality systems like the oculus rift. Head mounted displays are primarily used for video sharing, navigation, checking notifications, etc. However, several pioneers argue that the quintessential use for it have not yet been identified. But, if you ever wanted to build one for yourself from scratch, and are not willing to pay 1500$ just to experience its functionalities, then this DIY Head Mounted Display tutorial is for you.
This DIY hacking tutorial will show you how you can make your own head-mounted virtual reality or augmented reality displays. I have built a "Smart Cap", the first of its kind, having a head mounted display on it. Here, I will instruct on how to build a monocular wearable display that runs on the raspberry pi as seen in the picture above. The system includes a webcam for video sharing and recording and also incorporates voice recognition for a hands-free experience. Thus, you will be able to build an interactive voice recognition based wearable display at the end of this tutorial.
How Does the Head-Mounted Display Work?
Head mounted displays usually consists of a high-resolution LCD or any other display screen within about 5-10 cm in front of your eyes. For virtual reality systems, usually, one split display or two identical displays are used for each of your eyes for the stereoscopic effect. Here, I am only using one miniature LCD display in front of an eye, hence called a monocular head mounted display.
In this system, in order to cope with the "Least distance of distinct vision", which is about 15-25 cm, I have used an aspheric loupe magnifier lens having 5X magnification. This makes it possible for me to see the screen impeccably at about 5-6 cm from my eye. The display is also completely enclosed and insulated from outside light. The next part of the system is a normal USB webcam which was cannibalized to take only the camera and the microphone. All the plastic enclosures of it was removed, and the wires were re-soldered to get a niche position for the camera and microphone on the cap. Furthermore, I used a Raspberry Pi running a voice recognition software I engineered, to ensure hands-free operation.
The LCD display acts like any other PC display. However, when certain voice commands are executed in tandem with the system, appropriate results or data is displayed in front of your eye. A few of those examples are email, maps for navigation, Google search, YouTube, webcam recording, and first person viewing of other cameras, etc. The Raspberry Pi integrated with this head mounted display thus has to be connected to the internet for performing these functions.
Preparing the Head-Mounted Display Enclosure
The display needs to be cut off from all external light sources to ensure a sublime viewing experience. Here, I have used plastic sun board sheets, the kind of sheets normally used for vinyl advertising, for making the enclosure. Cut out a piece of the sheet of length 21 cm and width 6 cm. Mark cross sections vertically at 6 cm, 10.5 cm, 17 cm, and 21 cm as shown. Next, take a cutting knife with the length of the blade adjusted to be just 3 mm. On the lines earlier marked, cut through half way of the board. This will ensure, that the board bends properly to form a rectangular enclosure for the display.
Now, hot glue the circuit board attached to the display to its back. This will make it a rigid one piece display as shown. Next, apply fevicol SR glue or any other synthetic rubber based adhesive to the edges of the display and stick it to the sun board sheet as shown. Bend and stick all the edges of the display and finally seal it, to make the enclosure.
Attaching the Lens for the Head-Mounted Display
The enclosure now has to be cut off in such a way that it fits snug with the contours of your face. Make outlines of your nose, your right eyebrow, etc using excess sun board sheets. Mark the outline obtained for the contours of your right eye on the prepared enclosure. Cut out all excess material on the four sides based on the outline. The ultimate aim being that the enclosure fits snug on your face.
Furthermore, take the aspheric lens and place it in front of the newly modified enclosure. View the display through the lens and wrap it using black insulation tape, such that only the LCD display could be viewed through it. The enclosure and the surroundings of the display shouldn't be seen while viewed through the lens. This ensures a better visual experience for the head mounted display.
Stick the lens to the enclosure using the rubber adhesive as shown. Here, I have also spray painted the enclosure black, to prevent outside light from getting in.
Next, use some sponge or soft foam like material to stick on the front crevices of the plastic enclosure. This will make the head mounted display more comfortable while wearing it. Cut out the foam sections in the same shape as the four contours of the enclosure. Stick it to the edges using the rubber adhesive.
Hacking the USB WebcamTake the USB webcam you have and remove its plastic enclosures. Remove the peripheral buttons, etc attached to it. Cut off the microphone attached to the circuit board. Next, salvage and remove a flexible mic enclosure with the mic from an old headphone. Now solder the new microphone terminals to the existing mic pads on the webcam circuit. Ensure that the interconnecting wires for the mic have adequate length to be positioned near your ear. You can also use infrared LEDs with your webcam so that your head mounted display will even have night vision!
Now, take the webcam circuit having the camera and stick it in front of your head mounted display. This can be done by preparing a bridge using the sun board pieces. Stick the webcam circuit onto this bridge. I have used hot glue to stick it.
Putting It All Together to Make the "Smart Cap" Head-Mounted DisplayI had a hip hop cap lying around in my home, so I used it to attach my head mounted display. Using the rubber adhesive, I stuck the enclosure of the display onto the visor of the cap, after adequately positioning it for my right eye. The display is then powered using the 5V and GND pins on the Raspberry Pi. The composite video output of the pi is connected to the display via RCA connectors.
Next, I attached the microphone to the left side of the cap ensuring it to be ergonomic, again using the rubber glue. To attach the Raspberry Pi board onto the cap, I used velcro. I sewed some velcro strips on to the right side of the cap and used it to wrap the Raspberry Pi.
Now you have successfully prepared the hardware for the Smart Cap head mounted display. Try it on after connecting the raspberry pi to the display and ensure its comfortable.
Setting Up the Voice Recognition Software for Your DIY Head-Mounted Display
I have prepared an interactive voice response system that responds to certain voice commands and gives you appropriate results. In order to incorporate this system, you can use the image file for my operating system and prepare an SD card. This is the easiest method, as most of the complicated stuff is taken care of, you can start using the system as soon as you plug it in the Pi. First, unzip the downloaded file to extract the .img file. For instructions on how to install this image file onto your SD card, look at step 2 of the 'How to Backup Your Raspberry Pi Project Files' tutorial. To begin using the voice commands, just enter the command given below and start using the system like in the video at the bottom of this post:
Or, if you would like to build and customize your own voice recognition system, please go through the DIY hacking tutorial: Voice Recognition for Raspberry Pi. In this method, you have to make sure, that you change the screen resolution for the display. This is done by editing the file /boot/config.txt, edit it using the command
sudo nano /boot/config.txt
Uncomment the line saying: disable_overscan=1, by removing "#", also set the framebuffer_width=320 and framebuffer_height=240 and remove the "#" from both these lines. This will create a better visual appearance for the LCD display.
The video showing the Smart Cap - DIY Head Mounted Display in action: