Sensor Array Graphs

In this post I will be expanding on the torus example of the previous post to show some practical application of point-clouds.

This example takes a sensor array (in this case of four sensors) and plots a height-map of the readings, allowing a visual cue to how the sensors interact.

The sensors can read from anything – a thermister for example to show temperature difference. For simplicity of this article we use four potentiometers.

The first thing we need to do is set up the height-map. This is done by writing X Y and Z data to arrays. The X and Y form the position of each point in a grid, and Z we set to zero for now as this will form the height of the map.

Pic1

The routine presented in this example also sets the colour up, but this is a nicety that simply helps when orientating the graph.

The final stage is to create the grid object based on the X Y and Z arrays. First the X and Y are ‘normalized’ so no point lies out of the range -1 to 1, and then these are given to Flowcode to create a point-cloud from, that will sit on top of an existing shape.

Pic2

Reading in the sensor data

Our sensors will exist overlaying the grid. We are to place each of our four sensors evenly on the grid so their values weight the position we can assume they exist in on the actual array.

Pic3

These are read into a sensor array using ADC components and the values read are used to ‘pull’ the height of that map position to reflect the sensor value.

Once the Z values at the appropriate point on the grid are set from our sensors, it remains to average the grid out using a smoothing function. All we do here is, for every point on the grid, average that point with its neighbours and write the result back to Z. This is the basis for all cellular automations.

Pic4

Pic5

For each point, the average of 5 height values is written back into the centre point.

When the array is adjusted the point-cloud is updated with the new array values.

Pic6

The result is the height-map appears to be a solid sheet with each point connected to its neighbours. When one of the points is pulled in a certain direction, all the points are pulled in that direction.

Pic7

Real-world use

This method can be easily used to visualise data streamed from live sources. The downloadable examples here include a MIAC USB Slave reading four inputs in real-time that can be viewed on the grid. You can view details of the MIAC USB Slave here: http://www.matrixmultimedia.com/wiki/index.php?title=Component:_MIAC_USB_Slave_%28MIAC_Module%29

Making it into a finished component

This code is only the start of a potential component, which ideally should be able to take a series of inputs from any source and display them on a grid with scales and markings on. But this may be a topic for another time!

Click here for the source files for this example: Source Files – SGA’s

16,721 total views, 4 views today

Leave a Reply