Date: Mon, 22 Feb 2016 18:25:07 -0800
From: Toby Schachman
Subject: Re: Programming Imagination Jam
I elaborated my idea of the DIY PCR machine.

A PCR machine is a unit that heats and cools your samples to precise temperatures with precise timings. This thermocycling enables a reaction to take place that replicates DNA. It's a standard process used frequently in bio labs.

Inline image 1
Inline image 2

My imagined PCR machine is based on some instructables designs I found:

Inline image 3

My model:

Inline image 5

There's 1 sensor (thermistor), 2 actuators (heating unit, cpu fan), 2 seven-segment displays. Also note the retroreflective markers that enable the tracking system (multiple cameras like a mocap studio) to localize the box in space.

I can inspect an object, for instance the thermistor, by lasering the object while holding a blank inspector card in my hand:

Inline image 6

The inspector's markings are implemented via projections. It shows all of the object's properties. In this case, the thermistor only has a Value property, showing its temperature reading and plotting this value over the past several minutes.

I go ahead and inspect the other objects on separate inspector cards:

Inline image 7

I can then create relationships between cards. For example, I set the Red Digital Read Out (Current Temperature)'s Value to a "computed property" referencing the Thermistor's Value, the way you would in e.g. Apparatus. Some of the values are "Set internally" (Thermistor's Value) which means that the object sets this value and I can't change it nor can other objects. Other values are settable, for example the Heater's and the CPU Fan's Value (On or Off) and the digital readouts' values. Anything that's settable shows its current value and also how it came to have that value, what object or process set it to that value.

I've written a program for controlling the PCR machine by laying out cards and drawing on a placemat:

Inline image 2

On the left is a state machine of sorts which sets the target temperature in the desired sequence and then waits for the desired amounts of time. Projection is used to highlight which state the state machine is on. Also there is a loop and projection shows which iteration of the loop we're on. You start the machine going by lasering a state and saying "Start!"

On the right is the control algorithm (essentially a thermostat!) that turns the Heater and the Fan on and off appropriately to reach the target temperature.

This is a pretty naive control algorithm. For example it will oscillate the heater and fan on and off when it reaches the target temperature. There needs to be a way to e.g. add hysteresis. Bret suggested that there could be hysteresis modifier stickers that can be added to any "when" clause that would keep them from oscillating.

The implementation of the control system with words works but is not ideal I think. I had to think about "if this is less than that, then I need to do this..." I think if the programming representation was spatial/graphical ("I need the temperature to go up") then writing the rules and seeing that they were correct would be easier.

It would also be nice to implement a fancier control mechanism, e.g. PID. The nice thing is that another control mechanism could be swapped in for this one and everything else (the state machine) could be left the same.

One thing that worked out really successfully was putting the digital read outs on the machine. This effectively reified the Target Temperature which otherwise would have needed to be a disembodied variable. Once this was a thing that could be pointed at, it was easy to see how to program the machine. In Paula's words: "Things we want to refer to have to exist in the world."

Bret asked how the cards would be programmed. I don't have a clear vision of this. Some options might be: select a card and then type on a wireless keyboard, select a card and speak, some sort of "tile based" interface like magnet poetry.