Help with the HomeEasy protocol (Chacon, DIO, )

Posted on
  • Hi,
    At first, I want to apologize for my english. (I'm French)

    I have bought a switch of the brand DIO by Chacon.

    I'm trying to get the code send by this switch to be able to repeat it.

    It works with the HomeEasy protocol :

    The data is encoded on the wire (aerial) as a Manchester code.

    A latch of 275us high, 2675us low is sent before the data.
    There is a gap of 10ms between each message.

    0 = holding the line high for 275us then low for 275us.
    1 = holding the line high for 275us then low for 1225us.

    The timings seem to vary quite noticably between devices. HE300 devices have a
    low for about 1300us for a 1 whereas HE303 devices seem to have a low of about
    1100us. If this script does not detect your signals try relaxing the timing
    conditions.

    Each actual bit of data is encoded as two bits on the wire as:
    Data 0 = Wire 01
    Data 1 = Wire 10

    The actual message is 32 bits of data (64 wire bits):
    bits 0-25: the group code - a 26bit number assigned to controllers.
    bit 26: group flag
    bit 27: on/off flag
    bits 28-31: the device code - a 4bit number.

    So, I was trying to adapte the "Remote Control Sockets" tutorial with this instructions :

    var t,n;
    
    // When the signal rises, check if it was after ~5ms of delay - if so (and if we have a code) display it.
    function sigOn(e) {
      var d = e.time-t;
      if (d>0.0025 && n>0) {
        console.log("0b"+n.toString(2));
        n=0;
      }
      t = e.time;
    }
    
    // When the signal falls, measure the length of our pulse. 
    // If it was within range, record a 1 or a 0 depending on the length. 
    // If it wasn't in range, zero it
    function sigOff(e) {
      var d = e.time-t;
      t = e.time;
      if (d>0.0002 && d<0.0012)
        n = (n<<1) | ((d>=0.0007)?1:0);
      else
        n=0;
    }
    
    setWatch(sigOn,A1,{repeat:true,edge:"ris­ing"});
    setWatch(sigOff,A1,{repeat:true,edge:"fa­lling"});
    

    And this is my output :

    0b1
    0b1100
    0b111
    0b101
    0b111
    0b111
    0b1
    0b1
    0b110
    0b1000001
    0b1111
    0b110000
    0b1
    0b11
    ...
    

    I have nothing to exploit here.

    Can you help me?

  • What kind of transmitter/receiver is this?

    There has been much discussion on those cheap 433 (and 315) mhz transmitters and receivers, and the difficulty of receiving the signals on the Espruino, due to the limited speed of the Espruino - it gets swamped by the noise very easily, making it difficult to do the development unless you know exactly what you're looking for, and can write JS like Gordon.

    Gordon has a way to use computer to do the decode, using magic and the microphone port: http://forum.espruino.com/conversations/­258645/

    His improvements with pre-compiled JS should make life easier on the Espruino as well for receiving. In the mean time, this code is better (ofc, you'll need to change the times), because it needs only one callback to execute per bit - Gordon suggested it in my RF comms thread.

    
    var z = 32; //expected bit length - you'll likely want to change this. 
    
    function startListen() {
      wf=setWatch(sigOff,C6,{repeat:true,debou­nce:0.35,edge:"falling"});
      console.log("Listening started");
    }
    function stopListen() {
      if (wf) {clearWatch(wf);}
      wf=0;
      n="";
    }
    
    function sigOff(e) {
      var d=e.time-e.lastTime;
      if (d>0.0005 && d<0.0013) n+=d>0.0008?1:0;
      else{
        n="";
      }
      if (n.length==z)  parseRx(n); 
    }
    
    

    If you look through the most recent 2-3 pages of the interfacing section, there are like 3-4 threads on the subject of 433mhz comms (applies equally to 315), which is what I think you're working with. These all involve us facing much the same problems as you are.

    In my experiments, I concluded that I need to do more rigorous testing and optimization of the bit lengths and timing, but I haven't had a chance to get that all set up - I've got TX and RX modules taped to sticks on opposite ends of my room, but I haven't gone farther than that. I had things mostly working with my custom protocol, but it was still really flaky.

  • Thanks @DrAzzy,

    I think that basically covers everything :) Hopefully you'll have some luck using @DrAzzy's code - however you may want to change the values in the if statement so that they better match the pulse widths that you're expecting.

    Hopefully the 'compiled' JS code (which will be coming soon) will really improve the handling of radio coming in, but in the mean time the PC+Audio solution would be good for prototyping with JS. There's also some code in there to handle the decoding of Manchester code.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Help with the HomeEasy protocol (Chacon, DIO, )

Posted by Avatar for motoi @motoi

Actions