This time I wanted to share a little experiment I did using Blender, Unity and Arduino. The simulation of an industrial process using 3D models made in Blender and making a scene in Unity.
Here in the Alto Valle of Patagonia fruit growing is practiced and as I work doing industrial automation I have the opportunity to observe how the packing sheds work and the treatment of the fruit.
The industrial process I try to simulate is a fruit grinding line. The fruit arrives through a water circuit to a fruit elevator that lifts the fruit to a sorting table, where people manually discard the bad fruit. Then the fruit continues its ascent to a mill where it’s transformed into pulp and deposited in a tank. This is where the simulation comes in.
The idea of this experiment combining Unity and Arduino arose because I needed an idea for the final work of a subject of my career. The subject is PLC (programmable logic controllers).
I wanted to take advantage of everything I’ve learned from programming and 3D design, designing a computer simulation to test the programs we load into the PLC.
Description of the experiment
The idea is to use an Arduino Mega board to control the simulation in Unity. This is done using RS-232 communication. The Arduino board is inside a 3D printed box with a pair of Switches on the lid.
With the Arduino Mega you read the status of the switches and with this information you can create a word that is then sent via RS-232. The physical connection is made with the Arduino’s USB port.
In Unity the messages of the COM port are read.
The video shows that there are synchronization problems. This is because the COM port reading is done in the Update method of a class that inherits MonoBehaviour. An alternative to this is to use a different Thread to do the reading.
We haven’t decided yet what we’re going to do for the final work, however, this idea of an Arduino-Unity hybrid project is very interesting to me and I’ll probably make a series of videos for the channel. I think it might be fun.