Self Illuminating Responsive Tintype Frame

Art, Atoms, Electrons

The area of a tintype image that gets exposed to the most light essentially becomes a pure silver coating. While the reflective properties of silver make the final image a bit darker than traditional photographic prints, it also gives it a really compelling silvery metallic reflective feel. As a way to highlight those unique qualities, I decided to experiment with hiding LEDs in a box frame to illuminate the image from inside. I also wanted to find a way to intensify the lighting and make the image come alive as viewers got close to it.

Framed!

I inherited some antique oak wood floor pieces and made quick work of it on the old chop saw.

I built some walls behind the front of the frame and attached some LED string lights on it.

I mounted an 8×10 tintype on a black backing board cut to fit at the bottom of the frame’s walls.

Lights OFF / Lights ON

Controls

The next step was to figure out the kind of sensor needed to make the lights come on as a viewer approached the frame. I figured the sensor required would need a range of at least a few meters and be able to return the specific distance to the closest obstructing object. I am not a distance sensor expert so I used the internet to help. In the end, I settled for a Maxsonar EZ0 LV. It’s cheap, it’s got a range of a few meters and it’s got both serial, analog and PWM outputs. I hooked it up to a teensy board and confirmed the sensor was returning appropriate distance values. On the lighting front, I was planning on controlling the brightness of the LED string with the teensy, but since the LED string requires a 12V supply and the teensy outputs only 5V, I used a MOSFET driven by the teensy’s output to modulate the LED’s power supply.

The electronically savvy amongst you will notice that I’m currently using 2 power plugs: a 12V one for the LED and a 5V USB supply for the teensy, which is stupid. I tried to use a voltage regulator to convert the 12V to a 5V supply but somehow it created much noisier reading on the distance sensor… I must have missed a capacitor somewhere. I will try using an Arduino Nano which can take a 12V supply directly.

Code

God, I love the internet!!! I read somewhere that the sensor’s PWM signal was much cleaner so I started with that but I eventually found out that it also is much much slower and wasn’t able to keep up with the rate of change I was looking for. In the end, I used the analog signal and tried to filter it as best I could.

/*
Using the Analog signal from a Maxsonar LV EZ0 to drive a 
12V LED strip through a MOSFET. 
Take 20 samples, sort and select the median value.
*/

const int anPin = 9;
int anVolt, cm;
const int samples = 20;
int ranges[samples];
int highestReading;

float time;
float previousIntensity;
float maxDist;
float minDist;
int minVal, maxVal;

int mosfetPin = 9;           // the pin that the MOSFET is attached to

void setup()  { 
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  time = 0;
  maxDist = 450;
  minDist = 10;
  minVal = 5;
  maxVal = 255;
  previousIntensity = 0;
} 

void loop(){
  // print time spent since last loop
  Serial.println(millis()-time);
  time = millis(); 
  
  // sample sensor value
  for(int i = 0; i < samples ; i++)
  {
    anVolt = analogRead(anPin)/2;
    ranges[i] = anVolt;
    delayMicroseconds(50);
  }
  isort(ranges,samples);
  
  // convert to centimeters
  Serial.println(samples/2);
  cm = 2.54 * ranges[samples/2];

  // shape the curve of the result
  float intensity = (cm - minDist)/(maxDist - minDist);
  intensity = 1-constrain(intensity,0,1);
  intensity = intensity*intensity;
  intensity = previousIntensity*.995 + intensity*.005;
  previousIntensity = intensity;

  // set the brightness of pin 9:
  float val= intensity*(maxVal-minVal)+minVal;
  analogWrite(mosfetPin, val);
}

//Sorting function
void isort(int *a, int n){
// *a is an array pointer function
  for (int i = 1; i < n; ++i)
  {
    int j = a[i];
    int k;
    for (k = i - 1; (k >= 0) && (j < a[k]); k--)
    {
      a[k + 1] = a[k];
    }
    a[k + 1] = j;
  }
}

Next Steps

Once I get my paws on that Arduino Nano board, I can rework my circuit and get the soldering iron out to make my electronics more permanent. I have also ordered a HC-SR04 Distance Sensor to see how it compares to the Maxsonar in terms of accuracy, speed and noise. Also, I need to make the frame a little bit deeper so the light can spread out a bit further across the image.

Which one is cooler?

The ominous cyclopean look or the cute and friendly Wall-E look?

Leave a Reply

Your email address will not be published. Required fields are marked *