This week we will talk about the second construction phase of Vitruvian VR*:
The IoT Phase
We'll be going to deepen two fundamental aspects:
1) The connection between the joystick and the engines that let the player to manage the movements of the game. To make this we used an Arduino* board.
2) The connection between the Intel tinyTILE board and the accelerometer, to change the color of the colored LEDs according to the position of the player.
The joisticks can move in 8 position and have a button on the top, which is used for safety: only if both buttons are pressed, the signal is transferred to the PLC, otherwise not. This because it is important that every player put both hands on the joystick, for security reasons.
But nevertheless, we only use four directions: up, down, left, right and therefore we have 16 combinations.
These combinations are inserted into the Arduino board inputs and, through a very simple processing, each combination is converted into a high output signal transmitted to the PLC.
As we have seen from the previous video, inside the PLC there are inputs that activate specific movement procedures. There are three enginesand each engine can be:
- Stop (state stop)
- Go Ahead (state up)
- Go Back (state down)
To understand this, we call Memory the movement procedure in the PLC, so there are nine memories that can be operated by putting High in Arduino pins, connected to the corresponding PLC memory.
In the Arduino setup we put the input pins of the joisticks and the output pins connected to the PLC.
So, for example, if J1 goes on and J2 goes on it means that pin six and pin ten are high on Arduino.
There is a condition in the loop: if pin six and pin ten are high then put the output pin zero high. This pin drives the engines one that goes on.
So it is possible to decide to manage:
- each combination of the joystick
- the state of the engines coordinated of the movement
The Visual Aspect
Around the big metallic circles of Vitruvian VR, we have chosen to add some colored LEDs, that change color depending on the position of the player. If the player is vertical they are green, if it goes horizontally they are red.
To determine the position of the player, we use the gyroscope inside the tinyTILE. The board is positioned on the seat back of the gamer and connected to the LEDs.
Here is some codes that shows the use of the gyroscope. Obviously, each position determines a shade of color from green to red.
For more information please visit Vitruvian VR website.