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 joysticks 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 joysticks, for security reasons.
But nevertheless, we only use 4 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 3 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 9 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 6 and pin 10 are high on Arduino.
There is a condition in the loop: if pin 6 and pin 10 are high then put the output pin 0 high. This pin drives the engines 1 that goes on.
So it is possible to decide to manage:
- each combination of the Joysticks
- 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.
Enjoy the video!
...and if you are interested to deepen some aspects, please contact us at email@example.com.