Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Using optocoupler as actuator in node

Using optocoupler as actuator in node

Scheduled Pinned Locked Moved Hardware
22 Posts 9 Posters 12.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ferpandoF Offline
    ferpandoF Offline
    ferpando
    Hero Member
    wrote on last edited by ferpando
    #6

    If I use only one optocoupler it works, but as soon as I put 2 of them, neither work any more.
    I can see the led on the arduino blink as it receives the RF signal but nothing happens.
    I changed the code like this:

    ...
    #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 2 
    #define RELAY_ON 1
    #define RELAY_OFF 0
    
    Sensor gw;
    ...
    
    hekH 1 Reply Last reply
    0
    • ferpandoF ferpando

      If I use only one optocoupler it works, but as soon as I put 2 of them, neither work any more.
      I can see the led on the arduino blink as it receives the RF signal but nothing happens.
      I changed the code like this:

      ...
      #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 2 
      #define RELAY_ON 1
      #define RELAY_OFF 0
      
      Sensor gw;
      ...
      
      hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #7

      @ferpando

      Are they power hungry? Possible to feed them separately?

      1 Reply Last reply
      0
      • ferpandoF Offline
        ferpandoF Offline
        ferpando
        Hero Member
        wrote on last edited by
        #8

        according to specs 10ma each, and each is connected to one pin (3 and 4).
        I did nothing and just started to work.
        I had to reverse what's on and off though.

        One thing I noticed is there's only 3,7v on the pin when on. Shouldn't it be 5v?

        1 Reply Last reply
        0
        • DNKROZD Offline
          DNKROZD Offline
          DNKROZ
          wrote on last edited by DNKROZ
          #9

          Hi.

          I've tried to do exactly the same thing with the remotes for my roller blinds, I also started with relays (as they are the most obvious solution), but I found something that works just fine, no noise and low power:

          http://www.ti.com/lit/ds/symlink/cd4066b.pdf

          Just power it with 5V (I think it works from 3 to 18 V) and you have 4 "switches" using pairs from the IC and send a "high" state using a control Output from the arduino to the control pin on the IC, it doesn't really "connect" the two contacts, there is still an small resistance between them (about 500 ohms) but it works just fine with my remotes, they think the button has been pressed.
          And, as a bonus, they only are about 1.50 euros for 10 PCs, that is 40 switches for 1.50... try to do that with conventional relays and you are looking at about 45 euros at least.

          Regards.

          PS: Also, they work with the Relay example from the libraries, just changing the default value from #define RELAY_ON 0 and #define RELAY_OFF 1 to make they active HIGH, (#define RELAY_ON 1 #define RELAY_OFF 0)

          hekH 1 Reply Last reply
          1
          • DNKROZD DNKROZ

            Hi.

            I've tried to do exactly the same thing with the remotes for my roller blinds, I also started with relays (as they are the most obvious solution), but I found something that works just fine, no noise and low power:

            http://www.ti.com/lit/ds/symlink/cd4066b.pdf

            Just power it with 5V (I think it works from 3 to 18 V) and you have 4 "switches" using pairs from the IC and send a "high" state using a control Output from the arduino to the control pin on the IC, it doesn't really "connect" the two contacts, there is still an small resistance between them (about 500 ohms) but it works just fine with my remotes, they think the button has been pressed.
            And, as a bonus, they only are about 1.50 euros for 10 PCs, that is 40 switches for 1.50... try to do that with conventional relays and you are looking at about 45 euros at least.

            Regards.

            PS: Also, they work with the Relay example from the libraries, just changing the default value from #define RELAY_ON 0 and #define RELAY_OFF 1 to make they active HIGH, (#define RELAY_ON 1 #define RELAY_OFF 0)

            hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #10

            @DNKROZ

            Great input, thanks!

            1 Reply Last reply
            0
            • ferpandoF Offline
              ferpandoF Offline
              ferpando
              Hero Member
              wrote on last edited by
              #11

              @DNKROZ said:

              http://www.ti.com/lit/ds/symlink/cd4066b.pdf

              Thank you.
              I finally made it work.
              I changes the 330 Ohms resistor I was using for the optocoupler for a 220 Ohms and it started to work.
              Anyway your approach is really nice and more compact.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jackpot
                wrote on last edited by
                #12

                This is what I have been using TLP222.

                TOSHIBA Photocoupler Photorelay
                The Toshiba TLP222G TLP222G-2 consist of a gallium arsenide infrared Emitting Diode optically coupled to a photo-MOSFET in a DIP package The TLP222G series are a bi-directional Switch which CAN replace mechanical relays in many applications. By Toshiba Semiconductor.

                1 Reply Last reply
                0
                • ferpandoF ferpando

                  Hi,
                  If I use some optocoupler like the 4N35, will the actuator sketch work as if it was a relay?
                  Thanks in advance

                  ferpandoF Offline
                  ferpandoF Offline
                  ferpando
                  Hero Member
                  wrote on last edited by
                  #13

                  I have now the hardware part working with 9 optocuoplers driven by an Arduino micro, using a couple shift registers.
                  The problem now is from the software point of view.
                  How to address the optos.
                  When using relays or opts directly, the sketch uses digitalWrite to have the pin HIGH or LOW.
                  When I set the number of relays, VERA creates that number of light switches.

                  Now with the shit registers, I use only pins 4, 6 and 7 of the arduino.
                  I don't know if this will work just by telling the sketch I have now 9 relays, and then change a bit the program to address the shift register correctly.
                  Will the pins I use (4,6,7) conflict with the ones used by the sketch for the relays? (3, 4, 5, 6, 7, 8,.... 9,10,11 for the 9 relays) The mini only has 3-8 free pins.
                  I don't know how to start with this.

                  BulldogLowellB 1 Reply Last reply
                  0
                  • ferpandoF ferpando

                    I have now the hardware part working with 9 optocuoplers driven by an Arduino micro, using a couple shift registers.
                    The problem now is from the software point of view.
                    How to address the optos.
                    When using relays or opts directly, the sketch uses digitalWrite to have the pin HIGH or LOW.
                    When I set the number of relays, VERA creates that number of light switches.

                    Now with the shit registers, I use only pins 4, 6 and 7 of the arduino.
                    I don't know if this will work just by telling the sketch I have now 9 relays, and then change a bit the program to address the shift register correctly.
                    Will the pins I use (4,6,7) conflict with the ones used by the sketch for the relays? (3, 4, 5, 6, 7, 8,.... 9,10,11 for the 9 relays) The mini only has 3-8 free pins.
                    I don't know how to start with this.

                    BulldogLowellB Offline
                    BulldogLowellB Offline
                    BulldogLowell
                    Contest Winner
                    wrote on last edited by
                    #14

                    @ferpando

                    the key is mapping the bit in your register to a device you create.

                    you can use your bitwise operators to determine if you should toggle a device's status.

                    which shift register are u using?

                    ferpandoF 1 Reply Last reply
                    0
                    • BulldogLowellB BulldogLowell

                      @ferpando

                      the key is mapping the bit in your register to a device you create.

                      you can use your bitwise operators to determine if you should toggle a device's status.

                      which shift register are u using?

                      ferpandoF Offline
                      ferpandoF Offline
                      ferpando
                      Hero Member
                      wrote on last edited by
                      #15

                      @BulldogLowell
                      I'm using 74HC595.
                      I solved it changing the sketch from relay to servo, and them making some modifications to it.
                      It works very nice now.

                      BulldogLowellB 1 Reply Last reply
                      1
                      • ferpandoF ferpando

                        @BulldogLowell
                        I'm using 74HC595.
                        I solved it changing the sketch from relay to servo, and them making some modifications to it.
                        It works very nice now.

                        BulldogLowellB Offline
                        BulldogLowellB Offline
                        BulldogLowell
                        Contest Winner
                        wrote on last edited by
                        #16

                        @ferpando said:

                        @BulldogLowell
                        I'm using 74HC595.
                        I solved it changing the sketch from relay to servo, and them making some modifications to it.
                        It works very nice now.

                        so, pulsing the optocoupler with 'pushbutton' front end on vera's UI, good idea.

                        ferpandoF 1 Reply Last reply
                        0
                        • BulldogLowellB BulldogLowell

                          @ferpando said:

                          @BulldogLowell
                          I'm using 74HC595.
                          I solved it changing the sketch from relay to servo, and them making some modifications to it.
                          It works very nice now.

                          so, pulsing the optocoupler with 'pushbutton' front end on vera's UI, good idea.

                          ferpandoF Offline
                          ferpandoF Offline
                          ferpando
                          Hero Member
                          wrote on last edited by
                          #17

                          @BulldogLowell
                          Works pretty well.
                          The servo sketch installs a blind control device on vera with allows me to control stop, up and down buttons with one device per blind.

                          1 Reply Last reply
                          0
                          • HoffanH Offline
                            HoffanH Offline
                            Hoffan
                            wrote on last edited by
                            #18

                            Please show us some photo of the Servo into the Blinds :)

                            ferpandoF 1 Reply Last reply
                            0
                            • HoffanH Hoffan

                              Please show us some photo of the Servo into the Blinds :)

                              ferpandoF Offline
                              ferpandoF Offline
                              ferpando
                              Hero Member
                              wrote on last edited by
                              #19

                              @Hoffan
                              No servo in the blinds.
                              The blinds have somfi motors.
                              I just use the sketch of a servo to control it.

                              1 Reply Last reply
                              0
                              • daulagariD Offline
                                daulagariD Offline
                                daulagari
                                Hero Member
                                wrote on last edited by
                                #20

                                Had this problem myself, controlling Somfy blinds using my computer/smartphone.

                                Did read in a forum on a Somfy RS-485 solution (way to expensive) and about somebody that took his remote control and replaced the buttons by relays and had those relays controlled by a zWave (dual) binary switch. Also quite expensive solution to my opinion and not that supported.

                                Recently, but before I knew mysensors, RFXCOM came with the RFXtrx433E so I went for that. Quite nice, you can pair the Somfy blinds with the RFXtrx433E and control everything.

                                Knowing mysensors, taking the remote control and replacing the buttons using relays controlled by an Arduino Pro Mini would also be a good option.

                                Z 1 Reply Last reply
                                0
                                • daulagariD daulagari

                                  Had this problem myself, controlling Somfy blinds using my computer/smartphone.

                                  Did read in a forum on a Somfy RS-485 solution (way to expensive) and about somebody that took his remote control and replaced the buttons by relays and had those relays controlled by a zWave (dual) binary switch. Also quite expensive solution to my opinion and not that supported.

                                  Recently, but before I knew mysensors, RFXCOM came with the RFXtrx433E so I went for that. Quite nice, you can pair the Somfy blinds with the RFXtrx433E and control everything.

                                  Knowing mysensors, taking the remote control and replacing the buttons using relays controlled by an Arduino Pro Mini would also be a good option.

                                  Z Offline
                                  Z Offline
                                  Zeph
                                  Hero Member
                                  wrote on last edited by
                                  #21

                                  @daulagari said:

                                  Knowing mysensors, taking the remote control and replacing the buttons using relays controlled by an Arduino Pro Mini would also be a good option.

                                  Or better still, optocouplers or an analog switch as described above...

                                  daulagariD 1 Reply Last reply
                                  0
                                  • Z Zeph

                                    @daulagari said:

                                    Knowing mysensors, taking the remote control and replacing the buttons using relays controlled by an Arduino Pro Mini would also be a good option.

                                    Or better still, optocouplers or an analog switch as described above...

                                    daulagariD Offline
                                    daulagariD Offline
                                    daulagari
                                    Hero Member
                                    wrote on last edited by
                                    #22

                                    @Zeph said:

                                    Or better still, optocouplers or an analog switch as described above...

                                    Yes, that's a better option as relays are quite power hungry and bulky.

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    11

                                    Online

                                    11.7k

                                    Users

                                    11.2k

                                    Topics

                                    113.1k

                                    Posts


                                    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • MySensors
                                    • OpenHardware.io
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular