Industrial simulation with Arduino and Unity


This time I want­ed to share a lit­tle exper­i­ment I did using Blender, Uni­ty and Arduino. The sim­u­la­tion of an indus­tri­al process using 3D mod­els made in Blender and mak­ing a scene in Unity. 

Here in the Alto Valle of Patag­o­nia fruit grow­ing is prac­ticed and as I work doing indus­tri­al automa­tion I have the oppor­tu­ni­ty to observe how the pack­ing sheds work and the treat­ment of the fruit.

The indus­tri­al process I try to sim­u­late is a fruit grind­ing line. The fruit arrives through a water cir­cuit to a fruit ele­va­tor that lifts the fruit to a sort­ing table, where peo­ple man­u­al­ly dis­card the bad fruit. Then the fruit con­tin­ues its ascent to a mill where it's trans­formed into pulp and deposit­ed in a tank. This is where the sim­u­la­tion comes in.





The idea of this exper­i­ment com­bin­ing Uni­ty and Arduino arose because I need­ed an idea for the final work of a sub­ject of my career. The sub­ject is PLC (pro­gram­ma­ble log­ic controllers).

I want­ed to take advan­tage of every­thing I've learned from pro­gram­ming and 3D design, design­ing a com­put­er sim­u­la­tion to test the pro­grams we load into the PLC.

Description of the experiment

The idea is to use an Arduino Mega board to con­trol the sim­u­la­tion in Uni­ty. This is done using RS-232 com­mu­ni­ca­tion. The Arduino board is inside a 3D print­ed box with a pair of Switch­es on the lid.

With the Arduino Mega you read the sta­tus of the switch­es and with this infor­ma­tion you can cre­ate a word that is then sent via RS-232. The phys­i­cal con­nec­tion is made with the Arduino's USB port.

In Uni­ty the mes­sages of the COM port are read.

The video shows that there are syn­chro­niza­tion prob­lems. This is because the COM port read­ing is done in the Update method of a class that inher­its MonoBe­hav­iour. An alter­na­tive to this is to use a dif­fer­ent Thread to do the reading.


We haven't decid­ed yet what we're going to do for the final work, how­ev­er, this idea of an Arduino-Uni­ty hybrid project is very inter­est­ing to me and I'll prob­a­bly make a series of videos for the chan­nel. I think it might be fun.

Scroll to Top
Secured By miniOrange