Go Down

Topic: Help with driving an electromagnetic shutter (Read 571 times) previous topic - next topic

Quoll

Hi,

I am building an elecromagnetic shutter from an old hard drive and need to control it via an attiny85. Basically I need to be able to have a 2 minute loop that holds my camera shutter open, resetting it to close the shutter at the end of the 2 minutes and starting over.

If the attiny receives a signal from the sensor, it needs to interrupt the loop and trigger the shutter to open (it will shut again by itself instantly) and enable the flash at the same time. After that, it will need to reset and go back to the loop.

Below is the order of desired operations:

void loop()

{


Connect to camera

if 2 mins passes with no activity, reset connection to camera by disconnecting for 1 second

}

{

else

if input goes HIGH

open shutter

Pulse flash x 1

close shutter (should close automatically)

Disconnect camera for 1 second

}


I imagine this should be fairly easy and have put the code below together. Can anyone see any issues with this?

Code: [Select]

const int SHUTTER = 0;
const int IN = 2;
const int FLASH = 3;
const int CAMERA = 1;


 int val=0;

void setup()
{
  pinMode(SHUTTER, OUTPUT);
  pinMode(CAMERA, OUTPUT);
  pinMode(IN, INPUT);
  pinMode(FLASH, OUTPUT);
  }

 void loop() //2 mins
 {
   val=digitalRead(IN);
if(val==0)
{

digitalWrite(CAMERA,HIGH);
delay(millis,120000) //2 mins
digitalWrite(CAMERA,LOW)
delay(millis,1000)

}
else

if(val==1)
{
digitalWrite(SHUTTER,HIGH);
digitalWrite(FLASH,HIGH);
digitalWrite(SHUTTER,LOW);
digitalWrite(CAMERA,LOW);
delay(millis,1000)

}
 }


Any help would be awesome. Thanks
Nathan Litjens

Quoll

Basically this electromagnetic shutter goes in front of the lens of the camera to enable fast responses for insect photography as no camera is fast enough on its own. It is triggered by a laser oscillating at 38KHz that is aimed into the focal point from one side of the camera and the receiver is aimed at the focal point from the other side. When something hits the focal point a signal is sent to the attiny to do the rest.
Nathan Litjens

Quoll

Here is the schematic. I am having trouble as I cannot figure out what the attiny is doing.

As soon as the circuit is powered ON, the shutter activates, locked in the active position. I don't know what to do about it, and if the sketch is any good at all anyway...
Nathan Litjens

Quoll

So, been trying it all out and it seems I need an interrupt. Is this correct or would this code do the job?
Nathan Litjens

Go Up