Hobbybotics CNZ1120 Photo Interrupter V1.0




Build It

Use It

Related Links



The Hobbybotics Photo Interrupter is based on the Panasonic CNZ1120.  A photo interrupter sensor is composed of an infrared emitter on one side and a shielded infrared detector on the other.  By emitting a beam of infrared light from one side to the other, the sensor can detect when an object passes between them, breaking the beam.  Such sensors are used as optical limit switches for CNC applications or RPM sensors in robotics, for example.

Take a look at the “Build It” section below for a more detailed explanation of the circuit.


  • Panasonic CNZ1120
  • Input voltage 5V
  • Output voltage 0V or 5V on the signal line
  • Size: .75W” x 2L”


  • Schematic – PDF
  • PCB – PDF
  • Schematic – SCH
  • PCB – PCB
  • Mechanical Drawing – DXF
  • Bill of Materials – TXT

The schematic and PCB was developed with the freely available ExpressPCB software.

Build It

** NOTE ** The schematic and board files uploaded for the project are slightly different than the posted pictures.  After I designed the board I noticed that I routed the indicator LED incorrectly.  I also noticed that I flipped the pins for the interrupter when I created the component in ExpressPCB.  No big deal as I fixed it by removing the LED from the PCB when I soldered the components onto the board.  Resistor R3 on the PCB in the pictures should have been omitted also.  The interrupter wound up being on the opposite side of the board but, it worked out better this way as it separated it from the rest of the components.  In the end, it all worked as expected!

The photo interrupter circuit includes a current limiting resistor on the infrared LED side and a pullup resistor on the photo transistor side.  The photo transistor is similar in operation to a NPN transistor.  When the beam of light between the infrared LED and photo transistor is not blocked, current flows through the pullup resistor through the collector/emitter to ground and the LED in the below circuit is off.  When an object interrupts the beam, the photo transistor does not allow current to flow and the LED lights.  If you are a little confused, remember that current will take the path of least resistance and, in the below circuit, will pass through the signal line when the path to ground is blocked (the transistor is not conducting current).  As a test, you can place an LED with a current limiting resistor on the signal pin and see that the LED only lights when an object obstructs the beam between the infrared LED and the photo transistor.

Reference the B.O.M above for a list of the parts necessary to complete the Hobbybotics Photo Interrupter.

Only basic soldering skills are needed to put this board together.  I recommend you start with the smaller components first such as the resistors.  The CNZ1120 Photo Interrupter should be the last component installed.  Ensure the interrupter is placed on the correct side of the board or it will not function correctly.

Reference the below schematic and layout file for component locations.

Use It

I recommend you look over your solder connections before you apply power to the board. This will give you an opportunity to detect and correct any bad solder joints or solder bridges that could possibly let the smoke out. Once that is complete there are a few tidbits we need to take care of before we can make stuff. We’ll need to get some software (free of course) and configure some settings.

1. Go here and download the latest version of the Arduino Ide.
2. Plug the FTDI Serial-to-USB adapter into an available USB port on your computer. The drivers will automatically be downloaded and installed.
3. Go to Device Manager on your computer and expand the Ports (COM & LPT) field. Right-click on the USB serial port and select -> properties -> port-settings tab -> advanced.  Set the baud-rate to the appropriate setting for your controller.
4. Extract the compressed file to a location on your computer and launch the “arduino.exe” file.
5. In the Arduino Ide, select Tools -> Board -> Arduino Duemilanove or Nano w/ ATmega328.
6. Ensure the correct serial port is selected in the Arduino Ide.

You are now ready to upload and test a sketch using the Hobbyduino Mini or an Arduino of your choosing.

  Optoisolater Test 1
  Reads a digital input on pin 2 and turns on/off LED attached
  to pin 3 based on state of input pin 
  This example code is in the public domain.

int END_STOP = 2;              //Optoisolater pin
int LED = 3;                   //Pin LED is attached to

void setup()
  pinMode(END_STOP, INPUT);    //Set pin as input
  pinMode(LED, OUTPUT);        //Set pin as output

void loop()
  if(digitalRead(END_STOP))    //If input is high
    digitalWrite(LED, HIGH);   //Turn on LED
    digitalWrite(LED, LOW);    //Turn off LED

1. Launch the Arduino Ide and either copy and paste the above code or download the file from here.
2.  Connect the signal pin of the interrupter board to digital pin 2 on the Hobbyduino and connect a LED/resistor to digital pin 3 on the Hobbyduino.
3. Connect VCC and GND pins on the interrupter board to the +5V and GND pins on the Hobbyduino.
4. Click the upload button and the sketch will be uploaded to the board. You’ll need to do a little troubleshooting if the sketch fails to upload. I recommend checking for the correct serial port and board within the Arduino Ide.
5. If all is successful, the LED attached to digital pin 3 will light whenever an object breaks the beam of the interrupter.

This completes the basic functionality test for the Hobbyduino Mini. Checkout the video to see it in action.

Related Links

Hobbybotics Photo Interrupter V1.0 Gallery


This example shows hardware and software used to implement the design. It is recommended the viewer use sound judgment in determining and/or implementing this example for any particular application. This example may include information from 3rd parties and/or information which may require further licensing or otherwise. Additional hardware or software may be required. Hobbybotics or any affiliates does not support or warrant this information for any purpose other than a design example and takes no responsibility for any mishaps (none being implied).


3 thoughts on “Hobbybotics CNZ1120 Photo Interrupter V1.0

  1. Hi.
    I have an IR interrupter, which I got from an old printer. I would like to use it with arduino, but I do not know what the pins are, Is there any way to discover which pin is which?

  2. There is a way to figure out the pin arrangement but, you’ll need a digital multimeter that has a diode test function. On a (digital) DMM, there will usually be a diode test mode. Using this, the LED (Which is essentially a diode) should read between .4 to .8 V in the forward direction and open in reverse. This should tell you which pins are the LED portion. Once you figure out which pins are the LED, you can set your meter to the voltage range, wire up the circuit like I have it in the above schematic and measure the output across the remaining pins. The output should be +5V. That’ll give you the pin arrangement for the photo-transistor side. Hope this helps.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Connecting to %s