Introduction: Arduino Light Blocking Sensor (Photo Interrupter Module) - Keeping Your Cards Safe (Prototype)

About: I am interested in Arduino and looking forward to discover more.

This project is a prototype and in this project I will be discussing about how your cards - such as credit cards, debit cards, gift cards - can be kept safe. Take a look at the pictures above to see how this project works.

Let me give you a glimpse of this project. When I press the push button, the colour of the two-colour LED module changes colour from Orange to Green. The light blocking sensor is activated and when the card is kept within its U-shaped gap, the sensor senses that there is an object within the gap which is blocking the light. This sends a HIGH signal. When the card is displaced, the light is not blocked and the sensor sends a LOW signal and according to my codes, this triggers a buzzer alarm and the two-colour LED module changes colour from Green to Red.

To see further details about how this project works, please watch the YouTube video which I have embedded in the 'Final Look' section of this page.


  1. Arduino Uno R3/ Arduino Nano
  2. Solderless Breadboard - Full size
  3. Jumpers
  4. Jumper wires - [Male-to-Male] 30cm and 10cm (x7 each)
  5. 9V battery
  6. 9V battery terminal
  7. Active buzzer (KY-012)
  8. Light blocking sensor - also known as Photo Interrupter module (KY-010)
  9. Push button - also known as Key switch module (KY-004)
  10. Two colour LED module (KY-011)

Step 1: Setting Up Your Hardware

Your hardware setup must look similar to the that shown in the picture above. For more guidance on setting up your hardware, please watch the YouTube video found at the last section of this page.

Step 2: Connections

  1. Buzzer - D3
  2. Light blocking sensor - D4
  3. Green LED - D5
  4. Red LED - D6
  5. Common cathode (Two-colour LED module) - GND (Ground)
  6. Push-button - D7

Step 3: Coding

*Note: The codes are incomplete. To get the full version of codes, please contact me at

Step 4: Final Look

For more Arduino projects, please visit my blog:

If you have further questions regarding this project, please contact me at