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.
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
/* 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?