Isolating Circuits From Your Arduino With Optocouplers
An Optocoupler also called a photocoupler, optical isolator or opto-isolator is a small chip that transmits signals between two isolated circuits using light. A basic optocoupler uses a led and a phototransistor, the brighter the led the more current is allowed to pass through the phototransistor. For more info on how optocouplers work check out this link ( OPTOCOUPLER )...
In this instructable I will show you how to isolate and control the speed of a 12v PC fan with your ARDUINO board, this circuit could be used to control many things with minor modifications to the circuit.
The first 220 Ω resistor is connected between pin 9 on the arduino board and the positive side of the optocouplers led in the chip, this resistor cuts down the voltage from the board so it does not overpower the led and burn it out. If you use a different optocoupler than the SHARP PC817 you may need to adjust this resistor to compensate, the PC817 has a Max led input voltage of 1.4 volts and the resistor brings the arduino 5 volts down to 1.25 volts..
The second 220 Ω resistor limits the current flow through the phototransistor in the chip, the SHARP PC817 will handle 35 volts at 50mA but it will get very hot and not last long under those conditions so I put a current limiting resistor in the circuit to keep it way under those conditions.
The transistor I recommend for this instructable is a 2N2222 but any transistor that will handle the voltage and amps of your fan or motor will work fine, If you are going to be using a motor or device that has high current pull I suggest using a Darlington transistor like the TIP120.
If you are using a big fan or motor you might want to place a diode between the positive and negative of your device so if the power gets cut the power generated by the fan or motor does not exceed the reverse voltage of your transistor (if the power is cut and your motor is still spinning it will act like a generator until it stops spinning). Just use a rectifier diode with the positive end connected to the negative of the fan or motor and the negative side of the diode to the positive side of your device..
Now that you have the circuit built lets upload the code and try it out, just copy the code below and paste it into your Arduino ide.
Now that you have the code load it onto your arduino then open the serial monitor, Type in a number between 0 & 255 and hit enter. If everything is working properly your fan or motor should be spinning, just remember if your starting from zero (fan off) you will probably need to enter a number of 20 or higher to get the device spinning.
Isolating Circuits From Your Arduino With Optocouplers
An Optocoupler also called a photocoupler, optical isolator or opto-isolator is a small chip that transmits signals between two isolated circuits using light. A basic optocoupler uses a led and a phototransistor, the brighter the led the more current is allowed to pass through the phototransistor. For more info on how optocouplers work check out this link ( OPTOCOUPLER )...
In this instructable I will show you how to isolate and control the speed of a 12v PC fan with your ARDUINO board, this circuit could be used to control many things with minor modifications to the circuit.
The first 220 Ω resistor is connected between pin 9 on the arduino board and the positive side of the optocouplers led in the chip, this resistor cuts down the voltage from the board so it does not overpower the led and burn it out. If you use a different optocoupler than the SHARP PC817 you may need to adjust this resistor to compensate, the PC817 has a Max led input voltage of 1.4 volts and the resistor brings the arduino 5 volts down to 1.25 volts..
The second 220 Ω resistor limits the current flow through the phototransistor in the chip, the SHARP PC817 will handle 35 volts at 50mA but it will get very hot and not last long under those conditions so I put a current limiting resistor in the circuit to keep it way under those conditions.
The transistor I recommend for this instructable is a 2N2222 but any transistor that will handle the voltage and amps of your fan or motor will work fine, If you are going to be using a motor or device that has high current pull I suggest using a Darlington transistor like the TIP120.
If you are using a big fan or motor you might want to place a diode between the positive and negative of your device so if the power gets cut the power generated by the fan or motor does not exceed the reverse voltage of your transistor (if the power is cut and your motor is still spinning it will act like a generator until it stops spinning). Just use a rectifier diode with the positive end connected to the negative of the fan or motor and the negative side of the diode to the positive side of your device..
Now that you have the circuit built lets upload the code and try it out, just copy the code below and paste it into your Arduino ide.
Now that you have the code load it onto your arduino then open the serial monitor, Type in a number between 0 & 255 and hit enter. If everything is working properly your fan or motor should be spinning, just remember if your starting from zero (fan off) you will probably need to enter a number of 20 or higher to get the device spinning.
No comments:
Post a Comment