Hobbybotics CNZ1120 Photo Interrupter V2.0




Build It

Use It

Related Links



Here is an updated version of the Hobbybotics Photo Interruptor based on the Panasonic CNZ1120. You can checkout the previous version here.  The board is a lot smaller and use SMD components.

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

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 Hobbybotics Photo Interrupter V2.0. Checkout the video to see it in action.

I need to update the video for the latest version.  However, version 1 and 2 are functionally the same.

Related Links

Hobbybotics Photo Interrupter V2.0 Gallery

Hobbybotics Photo Interrupter V1.0

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).


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 )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s