DIY Nikon Remote Hack Part II – light sensitive trigger release

The next level of functionality we will add to our Nikon ML-L3 Remote Hack is the ability to respond to changes in ambient light (such as during a flash of lightning). The goal will be to design a threshold detector that fires the shutter release mechanism whenever lightning/ some other light is incident on a light sensitive sensor.

To begin, We need to design a sensor whose output is proportional to the amount of light incident on it. A Photoresistor, also called an LDR or Light Dependent Resistor is ideal for such an application.

Photoresistor or LDR

Photoresistor or LDR

An LDR exhibits the property that the resistance across its leads is inversely proportional to the amount of light incident on its face. If we call this resistance R(LDR), we can say that R(LDR) is low (almost zero) in bright light and very high (>100Kohms) in darkness. We can sense this change in resistance and determine if the sensor is in  light or in darkness, and then act on this input in any way we desire.

According to Ohm’s law, as the resistance increases, the current flow decreases. Theoretically we could measure the resistance across the LDR or even the current flowing through it to sense light or darkness, but it is not easy or convienient to measure either of these in a live circuit. Instead, we use a voltage divider…

Voltage Divider Formula

Voltage Divider Formula

As can be seen from the formula above, if we know the value of R1 (or R2) and we know Vin, we can easily measure Vout and calculate R2 (or R1). If we replace one of these resistors with an LDR, changes in ambient light would induce changes in R(LDR) which would in turn directly affect Vout and we could sense these changes by measuring Vout. In the calculations below, I use one LDR and one fixed resistor RFixed, in the voltage divider.

Voltage Divider Spreadsheet

Voltage Divider Spreadsheet

Look at the spreadsheet above. Using a multimeter, I measured the values of my LDR in darkness and in light (250 ohms and 85 Kohms). Using these values, I calculated the values of Vout using the voltage divider formula shown above, and Vin = 5V. As you can see, I did two sets of calculations….first with the LDR “ON TOP” (connected to Vin) and with the LDR “ON THE BOTTOM” (Connected to Ground). Looking at the results of Vout, we can see that the effect of placing the LDR on the “TOP” or the “BOTTOM” reverses the results, more or less. But irrespective of the position of the LDR, if we calculate Vdiff (the difference between the maximum and minimum Vout values), we see that it is the same in both cases.

But how do we choose a good value for the Fixed resistor in the voltage divider? Will all resistors provide us with equally good results? By using different values of RFixed, and using the same LDR I had used earlier, I calculated what Vdiff would be and graphed VDiff versus RFixed.

Range of Response Graph

Range of Response Graph

We can see from the graph that we get the best “Range of Response” if we use RFixed with values between 5K to 7K. A large “Range of Response” gives us better resolution to to work with, making our sensing of the changing environment much more accurate. In my voltage divider circuit, I used RFixed = 6700 ohms. Depending on your LDR’s reaction to light intensity, you may need to use a different value of RFixed for optimal results. But as you can see above, its just a question of creating a small spreadsheet and then graphing the results.

Now to react to this changing environment (light intensity in our case), we need to set a threshold level to determine a boundary which we can use to automatically react to the light level on the sensor. We do this by setting up a new voltage divider circuit with a potentiometer that will decide our threshold level.

Voltage Divider Application in Light Sensitive Trigger

Threshold and Sensor Voltage Dividers : Arduino Sketch

By comparing Vout from the LDR voltage divider and Vout from the potentiometer, we can check if our threshold has been exceeded and act on this by triggering a shutter release. Thus, manual adjustments to the potentiometer serve to change the sensitivity of our light sensing apparatus. A low threshold will cause the sensor to trigger a shutter release with very little ambient light incident on it and a higher threshold will allow the sensor to fire only if a huge burst of lightning occurs.

All that remains is to write the Arduino Code to realise this concept. We simply measure the voltage levels at the Threshold and Sensor Pins, compare them, and trigger a shutter release signal (by calling DoPhotoLoop() from Part 1) if the sensor reading exceeds the threshold level. If we find that our device is firing the shutter too often or not at all, we simply adjust the potentiometer to change the sensitivity of our device. In the Arduino code below, DoPhotoLoop() simply blinks an LED instead of actually triggering the shutter release signal that we created in Part 1.

Here is the Arduino Code…..

 int sensorPin = 0;// The pin connected to the centre of the voltage divider using the LDR
 int thresholdPin = 3;//Operator selectable threshold level

 void setup(){
 pinMode(13,OUTPUT);//LED Pin to simulate the sending of signal to release the camera shutter
 digitalWrite(13,LOW);//put the LED off

void DoPhotoLoop(int reps, int timeInterval)
 digitalWrite(13,HIGH);//Just blink the LED instead of generating an actual signal for
 Serial.println("LED is ON");
 delay(10*timeInterval);//the camera remote control

void loop()
 int sensorVal = analogRead(sensorPin);
 int thresholdVal = analogRead(thresholdPin);

 Serial.print("Light Sensor Reading:");
 Serial.print(",Threshold Level:");

 DoPhotoLoop(1,10);//If threshold level is met, blink the LED
 Serial.println("LED is OFF");


2 thoughts on “DIY Nikon Remote Hack Part II – light sensitive trigger release

  1. Pingback: LDR Lightning Detector : Trials and Demonstration | Bayesian Adventures

  2. Pingback: DIY Nikon ML-L3 Remote Control Part 4: Completed Schematic | Bayesian Adventures

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s