HELp with Optocoupler 4N26

Hi =)
This is my first time dealing with Arduino.
I'm working on a camera trap project I've found on the internet:

Got all the bit and parts. No problem in programming the Arduino or setting the system. Got all working.

The system works really well. When the IR is blocked, the Arduino works perfectly. Checked with a voltmeter.

The thing is that the system doesn't trig the camera. I believe that it's something wrong with the Optocoupler.

I'm 100% new in electronics, but from what I've learned on the internet, the Opto isolates the two systems: my camera and the Arduino circuit. Once the Arduino sent the pulses (the IR is blocked) it would activate the Opto, that would close the camera circuit and trig the camera

To check it the Opto was working, I set a system with a 1.5V battery. On my understanding, once the IR beam is blocked, the Arduino would trig the system. The Opto would get, and close my other system; in this case a voltmeter and a 1.5V Bat. If this "test" makes sense, seems that the Opto is not working...

Any suggestions?
Am I missing some stuff?

Sorry. just got into this stuff

Thanks a lot for all the HELP =D! would be great appreciate.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.

Please post you code using code tags as shown in the above link.

Have you got the polarity of the output pins correct?

If you have a DMM, use the Diode test function across pins 4 and 5.
See if the DMM responds when you activate the sensor.
You positive probe should go to pin5 and the negative probe go to pin4 on the opto.

Thanks.. Tom.. :slight_smile:

Hi Tom,
Thanks a lot =D
yes, it's all good in the setting. I used the DMM and yes, I see the arduino working the routine.

 The code:
/*
 * Active IR Camera Trap - 5/3/2017
 *
 *  
 *  Active IR Sensor DSLR Camera Trap using E18-8MNK transmitter/Receiver pair.
 *
 * The IR output pin goes to LOW if motion is present.
 * 
 */
 
/*-----( Declare Constants )-----*/
#define IRsensor 9    // Active IR Sensor
#define opto 2        // 4n26 optocoupler

/*-----( Declare Variables )-----*/
int  detector_state;  /* Holds the last state of the switch */
int trigger = 4;

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  detector_state = 0;                 
  pinMode (IRsensor, INPUT );
  pinMode (opto, OUTPUT );
   
  Serial.begin(9600);

  Serial.println ("DSLR CritterMaster 1.0b1 - Active IR");
  delay(5000);
  Serial.println ("Ready ");
  
}/*--(end setup)---*/

void  loop ()  /*----( LOOP: RUNS CONSTANTLY )----*/
{
  detector_state = digitalRead (IRsensor);
  if ( HIGH == detector_state) 
  {
   
    digitalWrite (opto, LOW );
     
  } 
  else 
  {
    for (int x = 0; x < 4; x++) {
    digitalWrite (opto, HIGH );
    delay (200);
    digitalWrite (opto, LOW);
    delay (1000);
    Serial.println("Motion detected ");
    }
  }
  delay (100);
}/* --(end main loop )-- *

* ( THE END ) */

Will test again.
I tried (again, it's my first time..) the DMM. It's all good in the Arduino side. From the " camera side" (using pin 4 and 5 of the Opto), I couldn't get much:

Based on what I understand of how an opto works, I tried to make a circuit with a 1.5v battery and the DMM, connected to the pin 4 and 5 - need do this again, just in case I used the wrong polarity. From my understanding, once the IR sensor is active, the DMM should register 1.5v current running. AM I right?

Any suggestion??
Really stuck =D

Hi,
How do you mean a 1.5V battery and DMM across pins 4 and 5?

If you have the battery connected directly to pins 4 and 5, without a current limit resistor, you will possibly damage the Opto output.

Tom... :slight_smile:

There are a few common issues with optocouplers.

  1. too high a value for the resistor between the Arduino and the opto LED. Your schematic doesn't give the value, the colour code in the Fritzing, red-red-red, is 2200 Ohm which is too high a value and it will not switch on properly. Of course it being a Fritzing image there's not necessarily a close relationship with your actual circuit
  2. the input is wired the wrong way around. It's an LED, so polarity matters.
  3. the output is wired the wrong way around. It's a transistor, so polarity matters.

Ooo..
Problems =)
just in case, will get a new opto.
So, how can I try and see if the new opto works?

I don't see how that going to work looks like you need to switches one to focus and one the photo

If you look at the pic there 3 wires
1 is ground 1 is focus and 1 photo

Test them with a dvm and post what you get.

Hi!
it's just two contacts: the "ground" and focus.
My cables are different colors than this one in the picture.
How can I test if I'm getting the cables right?
I mean, with a DMM, can I check that?
Will update pictures of the project today

tks a lot guys =D

Hi,
If your camera button has OFF, light press to AUTOFOCUS and full press to SHOOT.
Then that button will not be a simple ON/OFF switch.
I will possibly be two switches in ONE.

One switch GND to FOCUS.
One switch GND to PHOTO.

One comes on before the other as you press.

Tom.. :slight_smile:

You need to find the ground and positive if you meter show -4.00 its has the black lead on the positive
The 4.00 is just sample it maybe less or more.
you need to hook the lead to you meter so you don't get a - XXX volts and mark the wire with the back meter lead ground

TomGeorge:
Hi,
If your camera button has OFF, light press to AUTOFOCUS and full press to SHOOT.
Then that button will not be a simple ON/OFF switch.
I will possibly be two switches in ONE.

One switch GND to FOCUS.
One switch GND to PHOTO.

One comes on before the other as you press.

Tom.. :slight_smile:

I said that don't look as easy as there showing them
not always that good

Hi,
To test your opto, use this simple test circuit.
The DMM should read 0V until the the opto is fed signal from the controller.
Snapshot_20180119.jpg

Tom.. :slight_smile: