Driving roller shutters

Driving roller shutters

It seems that when it comes to installing accessories such as electrically powered roller shutters or lights built into a house, the tendency is to avoid pulling cables but to stick on the walls switches which are actually battery-powered radio controls. We are not very convinced of the ecological balance sheet of such a shortcut, but it opens up interesting prospects in terms of DIY.



We couldn't resist the temptation and we got one roller shutter command. Inside of this remote control disguised as a wall switch, there is a simple PCB, powered by a CR2032 battery, an antenna, a dozen components, and above all three little SMD switches.


Sunny side up  Easy over
We are going to use this remote control for rolling shutters


The idea is obviously to take control of this remote with relays and to drive these relays through the network. In other terms, we are going to simulate pushing on the up and down buttons with a Yocto-Relay driven by a YoctoHub-Ethernet.

DIY concept
DIY concept



Hardware

The hardware part is rather easy:

  • We mounted the PCB of the remote control on a plexiglass plate.
  • We mounted the Yocto-Relay directly on the YoctoHub-Ethernet with Fix-2.5mm and a Board2Board-127.
  • We soldered wires on the pins of the remote buttons, which we then connected to the Yocto-Relay.
  • We screwed everything together to make a nice and clean small block.
  • Finally, we installed everything in a cute little enclosure built especially.


The remote electronics, button side  The remote electronics, battery side
We mounted the remote electronics on a plexiglass plate
We mounted the Yocto-Relay directly on the Yocto-Hub-Ethernet
Connecting the remote to the relay  Putting everything inside the enclosure
The completed box


As YoctoHub-Ethernet is PoE compatible, we only need to connect the box to a PoE network cable for it to be both powered and accessible through the network.

Software

To test the concept, we wrote a short HTML page using the EcmaScript API to drive the relay. Nothing very original, apart perhaps the use of SVG embedded in the code to create icons which can resize without pixelizing.

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Roller Shutter Control</title>
  <script src="yocto_api.js"></script>
  <script src="yocto_relay.js"></script>
  <script>
    let UpRelay = null;
    let DownRelay = null;
    // Creates simple vector images for UP and down buttons
    let upIcon='<svg height="sz" width="sz" viewBox="0 0 16 16"><title>UP</title>'
    +'<polygon points="2,14 14,14 8,4" style="fill:#B0B0B0;stroke:#808080;'
    +'stroke-width:1;stroke-linecap:round;stroke-linejoin:round"/></svg>'
    let downIcon='<svg height="sz" width="sz" viewBox="0 0 16 16"><title>'
    +'UP</title><polygon points="2,2 14,2 8,12" style="fill:#B0B0B0;'
    +'stroke:#808080;stroke-width:1;stroke-linecap:round;stroke-linejoin:round"'
    +'/></svg>'
    async function init()
    { let addr =  location.host;
      await YAPI.LogUnhandledPromiseRejections();
      await YAPI.DisableExceptions();
      // Sets up the API to use the hosting Yoctohub-Ethernet
      let errmsg = new YErrorMsg();
      if(await YAPI.RegisterHub(addr, errmsg) != YAPI.SUCCESS)
      {  document.getElementById("UP").innerHTML =
        '<b>Cannot contact Hub on '+addr+': '+errmsg.msg+'</b>';
        return;
      }
      // finds the relays, we expect to find two relays
      // named "UP" and "DOWN"
      let anyRelay = YRelay.FirstRelay();
      if(anyRelay) {
          let module = await anyRelay.module();
          serial = await module.get_serialNumber();
          UpRelay= YRelay.FindRelay(serial+".UP");
          DownRelay= YRelay.FindRelay(serial+".DOWN");
      }
      else
      {document.getElementById("UP").innerHTML = "<b>No Relay available</b>";
       return;
      }
      // updates the UI with UP and DOWN arrow buttons
      let size =  Math.floor(Math.min(window.innerWidth/2,window.innerHeight/2));
      document.getElementById("UP").innerHTML =
      "<a href='javascript:shutterUp();'>"+upIcon.replace(/sz/g,size)+"</a>";
      document.getElementById("DOWN").innerHTML =
      "<a href='javascript:shutterDown();'>"+downIcon.replace(/sz/g,size)+"</a>";
    }
    // Up button call back
    window.shutterUp = async function()
    { if  ( await UpRelay.isOnline())
        UpRelay.pulse(250);
      else
         Alert("UP Relay is offline");
    }
    // DOWN button call back
    window.shutterDown = async function()
    { if  ( await  DownRelay.isOnline())
        DownRelay.pulse(250);
          else
        Alert("DOWN Relay is offline");
    }
    init();
  </script>
</head>
<body>
<table style="width:100%;height:100%;text-align:center;font-family: Sans-Serif;">
<tr><td>
<span id="UP"></span><br>
Roller shutter control<br>
<span id="DOWN"></span>
</tr></td></table>
</body>
</html>


We put this page as well as the yocto_api.js and yocto_relay.js files of the EcmaScript API directly on the YoctoHub-Ethernet file system and we configured the latter to use this page as start page.

Configuring the start page of the YoctoHub-Ethernet
Configuring the start page of the YoctoHub-Ethernet


Thus, as soon as we connect to the IP address of the YoctoHub with a web browser, we obtain a rolling shutter command interface. It works rather well, we filmed a short video to show you:

  



Possible improvements

In fact, the system having a power source thanks to PoE, we don't really need a battery for the remote. The voltage at the terminals of a CR2032 battery without charge can reach up to 3.4V, we could probably take some 3.3V directly from the Yocto-Relay to power the remote and thus get rid of the battery. We won't fail to try this as soon as the said battery dies.

Controlling one's rolling shutters from a web page on a smart phone might be quite useful, but as long as you can drive this rolling shutter through Ethernet, all kinds of scenarios become possible: such as opening and closing the shutter at predetermined times, or automatically closing them when there is a lot of sun and thus avoiding coming back home from work in an overheated flat. You could even imagine a system which would allow you to drive them from anywhere in the world with a simple email.

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.