Introduction: DIY VR Treadmill- Basys3 FPGA-Digilent Contest
Do you want to build a VR Treadmill on which you can run your desktop applications and games? Then you have come to the right place!
In conventional games you use the mouse and keyboard to interact with the environment. Therefore, we need to send the same kind of signals as a mouse and keyboard so that there will be no compatibility issues between our Treadmill and the game. Rather than taking these devices apart, we shall create our own device which can simulate them as close as possible.
For the mouse inputs we will use a disk with alternating conductive and non-conductive slices, on which two wires, with a small offset, will slide. The board will read the signals coming from the wires, giving us one of four combinations: 00,11,10,01, which we can directly translate in left-right movement.
For the up-down movement, instead of a disk, we will use a plate with the same pattern of 0's and 1's.
As inputs for the module that simulates the keyboard, we will have switches placed on the joint of a rod that will hold the harness. When you step in any direction, the rod will bend slightly, thus opening the switch.
(Keep in mind that the project is still in progress and can be improved, so I'm waiting for any advice that can make it better)
Step 1: Base
The base should have a low center of gravity, thus a heavy material needs be used. In my case, I used plaster and an antenna disk to make a concave mold, but other means can be used (ex. yoga ball). After the mold dries, it will be placed on two disks of the same diameter made out of MDF or a similar material. A spacer will be introduced between the two MDF disks. In between these disks, a triangle profile will be placed,which has bearings on the edges. Another set of bearings will be placed perpendicular to the vertexes of the triangle and tangent to the disk, on the top. For better precision, more bearings can be used. A rod will be placed on one of the vertexes, as shown in the third picture. This rod holds the harness in which the player will be placed.
Another fixed exterior rod is used to support the wires and also as a reference point for the rotational movement.
Step 2: 2 Input Management
From a black-box point of view, the device will have the following inputs: 4 connections for the x,y mouse counters, 2 connections for the mouse buttons and 4 connections for the arrow keys. The output is represented by 4 pins: 2 for the mouse PS2 connection and another 2 for the keyboard PS2 connection.
For a more detailed description of the PS2 protocol, you can check the following site: http://www.computer-engineering.org/ps2protocol/
As inputs for the board, I chose JB(1 downto 0) digital pins. Considering the sequence ...11001100..., read on the two inputs, we can distinguish between three states of the counters :
3. Save the current value;
The Count_Type module does exactly that. If there is a change in the input, then the module sends an appropriate message to the 8 bit counter( implemented in the 8_bit_count.vhd file), which adds or substracts from the current value, unless a reset signal is received.
The same idea is used for the up-down movement of the head, but instead of a disk, a sliding linear profile with the same alternating 0&1 pattern shall be used.
Step 3: VHDL Implementation
Attached to the presentation are the following modules:
1.Count_Type: this module handles the decoding of the two input wires from the disk or the profile, described in the second step;
2. 8bit_count: this module interprets the decoded message from Count_Type and increments or decrements the counters;
3. 3bytepacket: this module manages the status of the left and right buttons and formats the data so it can be introduced in the 3 byte data packet used in the PS2 protocol;
4.clk12khz: this module gives a clock of 12khz specific to the PS2 protocol on which certain components and processes work on;
5. MessageManager: this module sends the 3 byte data packet, interprets it and gives the appropriate response, as reply to a message from the PC.
6. PS2Interface: this module interfaces the communication protocol between the device and host(PC) (this module needs some debugging and a thorough reevaluation in order to work properly).
We have a be nice policy.
Please be positive and constructive.