433MHz Receiver

Posted on
  • Hi!

    I'm playing around with a pair of 433MHz receiver/transmitters and while everything works great on the transmitting part, I was trying to pair two espruinos (as test-replacement while waiting for my NRF24L01+).

    The problem I ran into is that when I set watches for the receiver it seems to put too much load on the board, making it nearly impossible to run anything else.

    Is there a trick to handle the receiving part with less processing power or is this a waste of time and I shouldn't even try?
    As soon as I pull the plug from A0 (data line), the terminal becomes responsive again.

    I just used one of the example snippets:

    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.005 && 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.0001 && d<0.001)
        n = (n<<1) | ((d>=0.0004)?1:0);
      else
        n=0;
    }
    
    setWatch(sigOn,A0,{repeat:true,edge:"ris­ing"});
    setWatch(sigOff,A0,{repeat:true,edge:"fa­lling"});
    
    

    Thanks for any advice!
    Mario

  • Yeah, it pretty much floors the receiver. Right now, an Espruino can't receive unless it knows a message is coming (like I do in my test code in the thread linked below).

    See my thread (page 2 has some better receive code than you're using):
    http://forum.espruino.com/conversations/­255528/

    Gordon's thread talking about possible improvements - so this is hopefully going to be fixed:
    http://forum.espruino.com/conversations/­257663/

    My thread about this locking up the espruino:
    http://forum.espruino.com/conversations/­258248/newest/

  • Thank you for the links @DrAzzy, they seem to shed some light on it. I'm going to read everything in there tomorrow :)

  • I should really create a module for 433Mhz with basically the fastest JS code I can get for the receiver. The impression I get is that with debounce on the setWatch it should be just about usable (although it could miss the occasional transmit).

    With careful forming of the signals you send (eg. a long (4ms?) pulse of radio at the start, which will give Espruino a noiseless period in which to chew through all the data it buffered up) it should still be pretty reliable though.

    I will be fixing the issue with Espruino being overwhelmed in version 1v72 of the firmware, so at least that shouldn't be such an issue any more - however USB/Serial share the same buffer as interrupts, so if the buffer gets full you'll still have trouble communicating with Espruino.

    Hopefully when I get time to implement this 'native code in interrupts' thing the problem will be totally solved though.

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

433MHz Receiver

Posted by Avatar for favo @favo

Actions