Intro: How to Use MOC78XX, H206, GP1A57HRJ00F Opto-interrupter for Motor Speed, Direction, Detection Control on Arduino
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.
Step 1: Wiring Guide
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-outsMOC78XX / H206 / GP1A57HRJOOF Opto Interrupter or ModuleSolder Less Bread BoardJumper Wire / DuPont WireWiring Guide
Source Code & Datasheets
Can be found here >