How To Make an Optocoupler

 by mgingerich
      While building a stepper motor driver board, I ran into the problem that my motors would draw so much power away from the microcontroller I was using to switch them that the microcontroller would shut down. When I did get it to work, spikes in the power supply were large enough to destroy my expensive microcontroller. I realized that I needed to isolate my control circuits from the high power supply that they were switching to protect the controller and to ensure proper power distribution. Optocouplers seemed perfect, but I decided it would be more fun to make them myself instead of buying them in integrated circuits. This is also way cheaper, since my local Radioshack has ridiculous prices per chip. Before we build one, however, let's go over what an optocoupler actually is.
      An optocoupler is basically a light and a light sensor used to communicate between two circuits. This is desirable in situations where you need complete isolation from a load and very fast communication. A simple transistor will give you that fast switching speed without the isolation. Relays give you the isolation you need, but don't have a switching speed anywhere near fast enough to handle the pulses used to drive a stepper motor. Optocouplers are the solution, since they provide total isolation and have a very fast switching speed. My homemade ones will handle about 300 hertz, but fancy ones used in industry can be switched at kilohertz. In my version, the light is an LED, the sensor is a photoresistor, and a MOSFET transistor switches the actual current through the load.  
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Required

1 LED- Super-bright ones work the best. I used a green one.

1 Photoresistor- These are cheap little components that conduct electricity in the presence of light.

1 NPN transistor- I used a 3904 from Mouser. Almost any brand will do.

1 N- channel MOSFET transistor- I used one labeled IRFZ44N that I got in bulk on eBay.

2 resistors, with values 10,000 Ohms and 100 Ohms, respectively. If your microcontroller supplies more than 5 volts, you should substitute a 470 Ohm resistor for the 100 ohm one.

1 ordinary diode

Electrical tape or a small enclosure that light will not penetrate
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!