• 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.

About

Avatar for DrAzzy @DrAzzy started