This is the photo interrupter also known as photogate, photodiode, or phototransistor. Phototransistors are specially designed transistors with the base region exposed these transistors are light sensitive, especially when an infrared source of light is being used. Phototransistors it has two leads a collector and emitter. When the light is absent the phototransistor is closed and does not allow a collector-emitter current to pass through the phototransistor open only with the presence of sufficient light.

On this illustration, we will demonstrate using a dc motor with flat slotted disk attach to the motor when the motor spins the slotted disk interfere with the beam from the led to the phototransistor. The width blade affects the efficiency of the motor as it determines how long the electromagnet stays on. If you want to make your own slotted disk keep in mind that it should be dense as paper or cardboard might be semi-transparent for infrared light. Opto interrupter is a small U-shaped black plastic package which has four pins two for infrared LED on one side pin for light sensitive transistor and external connection is required. The infrared light and the photo diode are in a single package the photo-interrupter employs trans missive technology to sense obstacles existence, act as on/off switch or sense a low-resolution rotary or linear motions. The principle states that object opaque to the infrared will interrupt the transmission of light between an infrared emitting diode and a photo sensor switching from the output of HIGH state to LOW state.

Required Components 

  • Arduino Microcontroller, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, WeMos, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. If your using other MCU please refer to the respective pin-outs
  • MOC78XX / H206 / GP1A57HRJOOF Opto Interrupter or  Module
  • Solder Less Bread Board
  • Jumper Wire / DuPont Wire

Wiring Guide

Source Code for Digital IO

Source Code for Analog IO

Source Code for Speed Detection

Source Code for Direction Detection

In order to detect the speed of the motor, the time must be taken into account if time is recorded at each pulse from the photo-interrupter then compared to the time of the previous pulse, the motor revolutions per minute can be calculated.

Source Code for Interrupts

Downloads 

  • Download MOC78XX Datasheet | PDF
  • Download H206 Datasheet | PDF
  • Download GP1A57HRJOOF | PDF
Wiring MOC78XX, H206, GP1A57HRJ00F Opto-interrupter for Motor Speed, Direction, Detection Control
Facebooktwitterredditpinterestmail
Tagged on:             

JLCPCBPCBgogoPCBway4pcb

Leave a Reply

Your email address will not be published. Required fields are marked *