h o w > t o > m a k e :

sam calisch

cba

week twelve: interface programming




Because Thanksgiving was this week, we weren't in the shop at all. Instead we coded up interfaces for sensors and/or output devices. I was super busy this week with a sponsor visit, preparing to give Thursday's section, and putting my kayak in the water! So come Tuesday night, here's what I had time to do.





I wanted to get the multiplexing pressure sensor up and running this week, but that didn't happen. Instead I coded a simple visualization for it. I want to see my footstrike both in the deformation of a surface, as well as a change in color. To get this out quick, I went to Processing. But first, I needed a foot! After tracing one of mine physically, I traced the image in Rhino and wrote a script to find intercepts at regular intervals. The script spat these out to a file, to be picked up by Processing.




I also needed a temperature color map for areas of high pressure. A quick google search turns up how to construct a good one using pulses in R,G, and B across the input parameter. I illustrated the concept below with matplotlib before implementing it in Processing.

After that, I took the hello.txrx board I made a few weeks ago and reflashed Neil's original code onto it. Then I translated the functionality of Neil's python script into Processing to read in the values. Processing makes it pretty easy to build your own trackball for 3D navigation, as well as smoothly coloring surfaces. Here's a first test, using a simple grid with a sine function that responds to my pressure sensor:



Matt's page was a nice resource for using the serial library with Processing. I also experienced the TXRX version mismatch that he mentions, but the solution in the thread he links worked for me. One thing I learned was liberal checks if the port is available using the available() method. After some printf debugging, I realized I had been reading -1's for a while.


With this running, some minor tweaks brought in the foot and displayed the sensor input as the amplitude of a Gaussian bump.


Files:


MAS.863 2012