I'm looking to build an Arduino-based "camera flash logger" to detect when a camera flash goes off, and maintain a log of those events. My thinking is to use a photoresistor to measure light level, and watch for sudden changes using a loop. Something like:

const int ldrPin = A0;

// no idea what this number would end up being
// just putting something here to start with
const int threshold = 10;
int currentLevel, lastLevel = 0;

void setup() {
    pinMode(ldrPin, INPUT);

void loop() {
    lastLevel = currentLevel;
    currentLevel = analogRead( ldrPin );

    // look for a sudden change
    if( abs( lastLevel - currentLevel ) > threshold ) {

        // serial out here to simplify the example.
        // I'll be logging outputs (with timestamps) to an SD card.
        Serial.println( currentLevel );

A couple of things I'm not sure of though:

  1. will the response time of a photoresistor be fast enough to respond to the very short (sometimes less than 1ms) burst from a camera flash?

  2. is a loop measuring level changes the best way to go about this, or would something like a state change interrupt be better? The ambient light level will vary depending on time of day, so it's an edge detection problem, as opposed to just reading a light level.

Apologies if this comes across as a "you haven't done your homework yet" question. I haven't started the project yet, so all I'm hoping for is a little direction on which way to proceed.

  • 2
    I would propose to use a phototransistor, reacts faster. And if you search for "Flash slave trigger schematics" you will find a lot of circuits (ex. learningelectronics.net/circuits/slave-flash-trigger.html) that could inspire you. – MatsK Jul 22 '18 at 7:19
  • 1
    This ATtiny-based camera trigger uses a photodiode and an op-amp to detect lightings. – Edgar Bonet Jul 22 '18 at 9:47
  • Thanks @MatsK. That circuit is more involved than, for example, the one shown in circuit 5 here. Is there a reason for that, or would the simpler circuit work for this purpose? – rosscova Jul 22 '18 at 23:41
  • Thanks @EdgarBonet. Is there a reason to go that way (photodiode + op-amp) over a phototransistor or photoresistor? – rosscova Jul 22 '18 at 23:44
  • Circuit 5 doesn't have a pulse filter, the circuit I refer to have C1 that will improve the detection of a pulse/fast changes of light and the darlington transistors for higher amplification. But you may need to modify the circuit to adopt it to your needs. – MatsK Jul 23 '18 at 2:15

A photo-resistor would not be recommended to detect a camera flash accurately. For example, the Jameco Part #202403 (Part PDF) has a response time of 50 to 75 milliseconds. Photo-resistors are more suitable for general light levels, for instance, like how bright it is in a room.
On the other hand, photo-transistors are suitable for very fast reaction times. The Jameco Part #2129385 (Part PDF) has a response time of 15 microseconds, which is more than 1000 times faster. A photo-resistor will be able to respond to the light change, but it will be nowhere as sensitive.

As with any product, however, search for the product PDF before buying it.

| improve this answer | |
  • I have used a photo-resistor to measure the light level of the surroundings during the solar eclipse of 2017, but that is better for general light levels. You would use a photo-transistor for laser applications, or optoisolators – Joshua Jul 22 '18 at 14:39
  • Thanks for the response. Would a phototransistor circuit (I've found an example in circuit 5 here work the same as a photoresistor? In other words, would the method I'm using (the script) work the same? – rosscova Jul 22 '18 at 21:59
  • I believe that it should work, because it is adjusting the resistance, and that is the only thing the Arduino analog input cares about. If it doesn't appear to work, add some delay timing to the loop. You might want to record a test run with the code similar to below. – Joshua Jul 24 '18 at 17:50
  • Here is a sketch that should work. drive.google.com/open?id=1XTAKTFROCUzBeI-EQkweJ2aMK_MSvMJX – Joshua Jul 24 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.