Avatar for MattC

MattC

Member since Dec 2016 • Last active Dec 2019
  • 1 conversations
  • 13 comments

Most recent activity

  • started
    • 21 comments
    • 2,601 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    I did this so long ago i can't remember what i did, sorry not very helpful i know.

    Looking through my emails i did purchase these IR Led's from ebay so maybe worth a try

    https://www.ebay.co.uk/itm/SFH485-SFH-48­5-880nM-40-degree-IR-LEDs-Qty-5-NEW-Osra­m-parts/112424821596

  • ir

    in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    @Gordon finally got round to testing this properly and I can confirm it works great :)

  • ir

    in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    @Gordon I did a very quick test last night and couldn't get it to work with a pronto code, I was getting an error but I was using the WebBle app on an iPad which I've not used before.

    Will try a proper test when I get time.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    I too couldnt get much range from the IR on the puck

    In the end I decided not to use the puck for IR and went with an esp8266 wifi chip and external ir's, i get a few metres range with this
    https://create.arduino.cc/projecthub/Bud­dyC/wifi-ir-blaster-af6bca

    You could perhaps try the same approach as the link and use a transistor and external ir leds with the puck

  • in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    +1

  • ir

    in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    @Gordon on the irdb website once you pick your device there are tabs for Pronto Hex, Hex and Raw codes (which you probably saw) but for some reason not all codes on the site have raw times, my LG tv luckily had the raw times but for a sony TV they were blank so I had to calculate them from the pronto codes.

    There seems to be a few Arduino libraries which can send pronto hex codes, perhaps these could be converted for Espruino.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    Thanks for the video, i will check it out later :)

    My next issue is the limited range of the IR led. I'm getting approx 50cm range with the on-board IR led any way of boosting this?
    I can get about 2m with an external IR led (taken from a tv remote) which is better but I need it closer to 4m. I was going to try a transistor unless you have any better suggestions?

  • ir

    in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    This something I have done recently, check out the thread
    http://forum.espruino.com/conversations/­297428/#comment13372893

    The code below should get you started, you need to set the raw timings in the times array, this is the time in milliseconds the IR led will pulse on and off for. The timings can be worked out from the hex codes or try this website to find your device http://irdb.tk/

    Also if you want to convert hex to raw times this thread helped me http://www.remotecentral.com/cgi-bin/mbo­ard/everything_else/thread.cgi?325

    Also note that the in built IR doesn't have much range, maybe 50cm at most.

    var times = [];
    // on button press
    setWatch(function(e) {   
       Puck.IR(times);
    }, BTN, { repeat: true, edge: 'rising', debounce: 50 });
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for MattC

    I can confirm the new firmware fixes the issue :)

    The puck can now replay the IR pulses perfectly

    Code below if anyone is interested

    
    pinMode(D1,"input_pullup");
    var times = [];
    
    var currentWatch;
    function startWatching() {
      currentWatch = setWatch(function(e) {
        // work out how long the pulse was, in milliseconds
        var pulseLen = 1000 * (e.time - e.lastTime);
        // then save it, if it was less than 1 second
        if (pulseLen < 1000) {
          times.push(pulseLen);
        } else {
          times = [];
        }
      }, D1, {repeat:true});
    }
    
    startWatching();
    
    function stopWatching() {
      clearWatch(currentWatch);
      currentWatch = null;
    }
    
    setWatch(function(e) {
        
       stopWatching();
       Puck.IR(times);
       console.log(times);   
       startWatching();    
    }, BTN, { repeat: true, edge: 'rising', debounce: 50 });
    

    Thanks for your help.

Actions