Lightning Drought
Back in September, I created a simple Arduino-based lightning trigger (original article). I’ve been waiting since then for the chance to test the circuit in the field. Yesterday provided the first real chance to test the circuit; unfortunately, I missed it.
Improving the Program
Even though I missed the event, I did decide to improve the program a little. The major change, if it can be called major, addresses a weakness in the original program. Originally, every event would attempt to trigger the shutter twice (once when the lightning occured and again when the brightness returned to normal). To fix this I am removing the absolute value function from the brightness test. Now, it will only trigger if the new brightness is brighter than the previous.
#include <multiCameraIrControl.h>
int shutterPin = 13;
int triggerPin = 0;
int threshold = 10;
int savedLightningValue = 0;
int currentLightningValue = 0;
int delayBetweenShots = 1000;
Nikon shutter(shutterPin);
void setup() {
Serial.begin(9600);
pinMode(shutterPin, OUTPUT);
digitalWrite(shutterPin, LOW);
savedLightningValue = currentLightningValue = analogRead(triggerPin);
}
void loop() {
currentLightningValue = analogRead(triggerPin);
Serial.println(savedLightningValue, DEC);
if((currentLightningValue - savedLightningValue) > threshold) {
Serial.println("Triggering shutter");
shutter.shutterNow();
delay(delayBetweenShots);
}
savedLightningValue = currentLightningValue;
}
Resources:
Other Posts in this series: