# The simulator

A project log for Volumetric Display using Acoustically Trapped Ball

This project uses a phased arrray of ultrasonic transducers to levitate and move a 1mm foam ball to draw in mid-air using the POV effect.

Once I had a rough handle on the physics, I built a simulation of the system to see if it was even possible to do what I wanted.  The simulator calculates the phases for each of the transducers and then determines the pressure wave magnitude for every voxel in the 3D volume – each voxel in this case is 1mm^3 and the total simulation volume is 100x100x145 mm.

Since the calculation of the pressure wave involves calculating and summing the signals from each of the 200 transducers, it would take many seconds to run the math on the CPU.  To make the process a little less aggravating, I dusted off my CUDA skills and wrote some GPU kernals to do the math – this is such a highly parallel problem, the GPU is able to process all the math in under 10ms.   I then learned enough OpenGL to be able to draw the voxels on the screen fast enough to get some decent animations.  I probably would have been able to do all the math in an OpenGL vertex shader fragment rather than using both CUDA and OpenGL – live and learn.

The simulator also helped me figure out how to move the particle along a pre-programmed path.  Initially I thought it would be faster for the particle to never slow down and so I made each right angle corner slightly rounded but it turned out to be faster to bring the particle to a stop at each right angle and then change direction. If the shape didn’t have angles greater than 90 degrees, it probably would be faster to never stop it.

Here I’m showing how the resulting waveforms interact with each other for two 10x10 arrays of transducers – the focus point is in the middle of the volume. You can see how the waves reinforce each other and create standing waves where a ball object might sit. You can also see that there’s not one single of high pressure but a series of them stacked on top of each, about 2mm apart.  However, the further you get from the focus area, the weaker the high pressure area is.

This simulation looked about right to me – it showed all the standing waves as expected and it showed that it was possible to calculate the phases of the transducers to focus the sound and that it was possible to move the focus point.  With that validation I decided to build this thing

## Discussions 