Components and supplies
Resistor 10k ohm
RobotGeek Relay
Arduino UNO
Photo resistor
LilyPad Rainbow LED (strip of 7 colors)
LED Lamp
Tools and machines
Common Tools
Soldering iron (generic)
Apps and platforms
Movie
Project description
Code
Sketch for controlling multiple relays via selfmade NeoPixel Optocouplers
arduino
This sketch show how to control an number of relays via multiple optocouplers made with NeoPixels controlled from 1 ARDUINO output pin
Downloadable files
Fritzing Diagram NeoPixel Optocouplers with relays
Set up for controlling multiple relays or other actuators from a single Arduino pin
Fritzing Diagram NeoPixel Optocouplers with relays
Fritzing Diagram NeoPixel Optocouplers with relays
Set up for controlling multiple relays or other actuators from a single Arduino pin
Fritzing Diagram NeoPixel Optocouplers with relays
Comments
Only logged in users can leave comments
Anonymous user
2 years ago
Hi! I was trying to do something like this to my Christmas tree, expanding the coding in my external IoT Arduino based controller but I am limited to one output pin, so...... Problem solved!!! . Really smart the way You "home-made" the optocouplers!!!!! I made some years ago but using triacs and optocoupler chips.(copied from a solid state relay). Once, I used LDRs and LEDs, but put them into a short (1cm) black piece of drinking straw. Worked like a charm! Yours is a modern ,different an clever approach. Thanks a lot! And Merry Christmas, Happy New Year....and so on!
dougal
2 years ago
Very clever and very simple. Full marks for ingenuity
Anonymous user
2 years ago
Very clever, but this is a little costly. If I were you, I would like to use PCF8574 or some other ICs to expand my Pins, that will be cheap and less power consuming.
Anonymous user
2 years ago
Taking the labor time and isolation into account this ideal is brilliant.
Pedro52
2 years ago
Thank you very much for the hint, which is appreciated. To the costly, I would agree, if you include the labour time (smile) for putting the LDRs and the Neopixel LED's together. The cost of the LED strip with LDRs and resistor are low. Other than that, it is the cost of the relays, but those will also be needed in case of a PCF8574 solution to control 230V things. In case of using SCRs/Thyristors or TRIACs, an optocoupler for each output will be needed anyway to achieve the required galvanic isolation. This is precisely the reason for making the optocoupler construction with the Neopixel/LDR combinations. And as a good old Dutch saying: "roeien met de riemen die je hebt" or in English, using the available means: "make do with what you have". Of course the relays themselves already provide such galvanic isolation, so here in this example it is a double isolation.
Anonymous user
2 years ago
I assume you chose this method because you had these parts on hand and realized what you could do and the potential fun involved. Kudos to that and the ingenuity. It looks like you are using a resin encased strip (IP-67), I think that's why you were having the cross-talk issues. Try to find an IP-30 strip, you should be able to fix that problem. If you ever find yourself needing a custom opto-isolation solution like this for a permanent or large scale project, consider using a shift register or similar with low power LEDs attached to the parallel outputs. The practical limit will be much greater and the power consumption will be significantly reduced. Additionally, the form factor will be smaller and the memory allocation required in software will be reduced by a factor of 32 (I think), increasing your maximum refresh rate. The NeoPixels are memory hogs.
Pedro52
2 years ago
Dear Stauffski, thank you for your message, indeed I used the strip that I had available and yes you are right, it is the resin that is causing the optical cross-talk. I solved that by reducing the luminance of the LED's (strip.setPixelColor(RelaisNo, RelaisState*15, RelaisState*15, RelaisState*15); and that works perfectly. Using a shift register is another approach, that could be considered depending on the application.
Anonymous user
4 years ago
I'm really interested in this project, where did you connected the wires that are going from Relay (brown) and blue? Did you used Arduino Uno or just ESP32 for this project ?
Anonymous user
5 years ago
Hi! I was trying to do something like this to my Christmas tree, expanding the coding in my external IoT Arduino based controller but I am limited to one output pin, so...... Problem solved!!! . Really smart the way You "home-made" the optocouplers!!!!! I made some years ago but using triacs and optocoupler chips.(copied from a solid state relay). Once, I used LDRs and LEDs, but put them into a short (1cm) black piece of drinking straw. Worked like a charm! Yours is a modern ,different an clever approach. Thanks a lot! And Merry Christmas, Happy New Year....and so on!
stauffski
6 years ago
I assume you chose this method because you had these parts on hand and realized what you could do and the potential fun involved. Kudos to that and the ingenuity. It looks like you are using a resin encased strip (IP-67), I think that's why you were having the cross-talk issues. Try to find an IP-30 strip, you should be able to fix that problem. If you ever find yourself needing a custom opto-isolation solution like this for a permanent or large scale project, consider using a shift register or similar with low power LEDs attached to the parallel outputs. The practical limit will be much greater and the power consumption will be significantly reduced. Additionally, the form factor will be smaller and the memory allocation required in software will be reduced by a factor of 32 (I think), increasing your maximum refresh rate. The NeoPixels are memory hogs.
Pedro52
2 years ago
Dear Stauffski, thank you for your message, indeed I used the strip that I had available and yes you are right, it is the resin that is causing the optical cross-talk. I solved that by reducing the luminance of the LED's (strip.setPixelColor(RelaisNo, RelaisState*15, RelaisState*15, RelaisState*15); and that works perfectly. Using a shift register is another approach, that could be considered depending on the application.
Eyre53
6 years ago
Very clever, but this is a little costly. If I were you, I would like to use PCF8574 or some other ICs to expand my Pins, that will be cheap and less power consuming.
Eyre53
2 years ago
Taking the labor time and isolation into account this ideal is brilliant.
Pedro52
2 years ago
Thank you very much for the hint, which is appreciated. To the costly, I would agree, if you include the labour time (smile) for putting the LDRs and the Neopixel LED's together. The cost of the LED strip with LDRs and resistor are low. Other than that, it is the cost of the relays, but those will also be needed in case of a PCF8574 solution to control 230V things. In case of using SCRs/Thyristors or TRIACs, an optocoupler for each output will be needed anyway to achieve the required galvanic isolation. This is precisely the reason for making the optocoupler construction with the Neopixel/LDR combinations. And as a good old Dutch saying: "roeien met de riemen die je hebt" or in English, using the available means: "make do with what you have". Of course the relays themselves already provide such galvanic isolation, so here in this example it is a double isolation.
dougal
6 years ago
Very clever and very simple. Full marks for ingenuity
Pedro52
2 years ago
Thank you! Indeed, the number of things that can be controlled in parallel from 1 output pin is large and is not restricted to relays and lamps.
Arduino with NeoPixel Optocouplers Controlling Many Relays | Arduino Project Hub
Anonymous user
2 years ago
I'm really interested in this project, where did you connected the wires that are going from Relay (brown) and blue? Did you used Arduino Uno or just ESP32 for this project ?