Puck.IR() definition clarification needed

Posted on
  • Wed 2017.08.02

    I wish to send a slow pulse train via the onboard IR diode, say [500ms on, 500ms off] repeat three times.

    From page: http://www.espruino.com/Puck.js#ir-infrared

    "IR / Infrared

    To transmit an IR signal, you just need to call Puck.IR([...]) with an array of times in milliseconds. They alternate between the time the signal should be on and off - eg. [on, off, on, off, on, etc].
    For example the command to turn on a cheap IR lightbulb is:"


    From page: http://www.espruino.com/Reference#l_Puck_IR

    Parameters: 'data - An array of pulse lengths, in milliseconds'



    The declaration is missing some detail.

    Q1: What is the range (width) in msec that each pulse may be? For instance min 0.5msec max 500msec

    Q2: Does the array have to specify an exact count 'n' (on, off) cycles? For instance 'n' must equal 20

    Q3: Does the tutorial at '(a tutorial on this will be added soon)' exist?


    Sidebar:
    The link at 'For example the command to turn on a cheap IR lightbulb is:' produces a 404 error

    Thank you for your input,
    Robin

  • I wish to send a slow pulse train via the onboard IR diode, say [500ms on, 500ms off] repeat three times.

    Just Puck.IR([500,500,500,500,500])...

    What is the range (width) in msec that each pulse may be? For instance min 0.5msec max 500msec

    It's large and small enough that you shouldn't have to worry. The minimum is going to be around 1/20000 (because the pulses are 40kHz) and the max is possibly even hours.

    Q2: Does the array have to specify an exact count 'n' (on, off) cycles? For instance 'n' must equal 20

    No, but ideally it'd be an odd number because of 'on...off...on' - a 'off' on the end wouldn't make sense

    Q3: Does the tutorial at '(a tutorial on this will be added soon)' exist?

    I don't understand the question - do you have a link to where it says that? The reference page mentions http://www.espruino.com/Puck.js+Infrared - which works.

    However for some reason it's not turning URLs in to links properly - I'll see if I can fix that.

  • Thr 2017.08.03

    Thank you @Gordon for the clarification. That was the snippet I was using.

    Puck.IR([500,500,500,500,500])

    Now for the tough part. How to troubleshoot IR detection, when one is unable to see infrared output. Sorry, only born with super human strength and X-Ray vision.

    Have an IR pair circuit with three inches separating the detector and emitter, as in a beam break circuit. When the beam is broken, a colored LED illuminates. This works as expected.

    However, when I substitute the Puck for the emitter, [Puck visible LED side facing detector] there isn't any apparent detection.



    ahhh ha!! . . . Forgot the old cell phone video mode trick. That device does make the IR LED transmission visible.

    Wondering what the Puck IR emitter range is? In my circuit, I seem to need to be quite close. e.g. One inch. Are you able to point me to a spec sheet? Any experience with an expected transmission distance?




    re: "I don't understand the question - do you have a link to where it says that?"

    From page: http://www.espruino.com/Puck.js#ir-infrared

    Fifth line below the heading "IR / Infrared"

    "You can sometimes work this information . . . (a tutorial on this will be added soon)."


    Re:

    "The reference page mentions http://www.espruino.com/Puck.js+Infrared­ - which works."

    Should your click event 'turn on a cheap IR lightbulb is' be different, than when clicked I get:

    http://www.espruino.com/www.ebay.com/sch/i.html?_nkw=ir+rgb+light+bulb&_sacat=0

    This is the link that is returned in the browser, which indicates 404

    Should your link be working, I wonder if browser caching is partly a cause. I'm using Chrome Version 59.0.3071.115

    or, . . . as we suspect here in the States that all web traffic is intercepted and stored in the massive Zettabyte storage site in Utah USA, https://en.wikipedia.org/wiki/Utah_Data_Center
    and the returned link became corrupt from their tampering somehow.

    https://www.forensicmag.com/article/2013/09/data-storage-issues
    "1 Zettabyte (ZB) – is equal to 1 billion Terabytes and represents approximately 36 million years of stored HD video. Recently it was reported that the National Security Agency facility located in Utah will be able to store 5 Zettabytes of information."


    'The truth is out there' . . . [fade to familiar sound byte] . . . . and . . . . . cut

  • Wondering what the Puck IR emitter range is?

    With up to date firmware, I've had about 1.5 meters. However, Puck.IR output an IR remote control style signal (which is pulsed at 40kHz). You would probably have more success using one of these types of detectors for it: http://www.espruino.com/IRReceiver

    It's possible the TX/RX pair you have are even using a different wavelength of light as well.

    a tutorial on this will be added soon

    Aha, thanks! I was looking on the reference page. I'll get that fixed.

    http://www.espruino.com/www.ebay.com

    It's much less exciting I'm afraid. It's the fault of the webpage (not putting http on the front of the link). That's fixed now, I just have to upload the changed page.

  • Thr 2017.08.03

    Thank you @Gordon. Also had wondered if that might have been an issue. Ref wavelength:

    It's possible the TX/RX pair you have are even using a different wavelength of light as well.

    It does appear my detector is very directional. Will have to play some more.

  • Got today my first Puck.js... already tried IR on my Yamaha Receiver.
    All works but from 1 meter distance only.

    I've tried one from a cheap remote control and another from Arduino dev.kit (black LED).
    I did not suceed :(

    1) It can be also I did wrong wiring (ground Cathode, D2 Anode) - the IR LED was connected between gnd and D2.
    2) or even wrong usage of Puck.IR(array,D28,D2) .... D28 is to put something.

    Robin did you try successfully an external IR? Any hint which one to buy ?

    Thanks.

  • You need to connect the LED across two data pins, and supply them both - that could be your problem?

    Polarity will also matter, but you could just swap it around in software

  • I found a right LED (from Arduino remote-control).
    It is working when connected as Puke.IR(arr, D1, D2);

    But... unfortunately same distance - maximum 60-80 sm.
    Any hint? The remote control I used is also powered by CR3032 coin.

    Txs.

  • Are you using an up to date firmware? The firmwares that came pre-installed on the Pucks didn't output quite as much power as the chip could manage.

    Otherwise I think most likely you'd need to use an external transistor to increase the output power - which can get a little tricky with the two outputs. Probably an 'Opto-FET' like http://www.mouser.com/ds/2/408/TLP240D_datasheet_en_20171013-1075474.pdf would be a good easy option.

  • I still have Puck with original 1.92 and was not able to make an upgrade .... On my Android phone the nRF Connect and nRF Toolbox did connect to Puck only for 10 secs and disconnect homehow. No firmware upgrade possible so far :-(

    1) If firmware can bring better results I will give one more "harder" try :-)
    2) In case I have to use transistor (1 input leg only), should I use 2 transistors ? each one for Cathode and Anode pins?

  • nRF Connect and nRF Toolbox did connect to Puck only for 10 secs and disconnect somehow

    It might be worth trying to change the battery in your Puck? A nearly flat battery can cause problems sometimes.

    If firmware can bring better results I will give one more "harder" try :-)

    Actually from the changelog it looks like 1v92 had the 'higher power' output already - but you get loads of extra features in 1v94 anyway :) http://www.espruino.com/ChangeLog

    2) In case I have to use transistor (1 input leg only), should I use 2 transistors ?

    Yes - you'd need one NPN and one PNP - and the resistors for them. Honestly I'd just use the TLP240D linked above - it's a really nice easy little component to use (and won't require resistors/etc since the LED can take as much power as the nRF52 can supply). It's also totally isolated, so you can use a bigger battery for the IR LED if you need to.

  • Honestly I'd just use the TLP240D linked above - it's a really nice easy little component to use

    Hm, I understand electronics but to me seams I will still need 2 TLP240D.
    One for Cathode and other for Anode.


    1 Attachment

    • Puck.js IR1 connect.jpg
  • No, it's fine - connect:

    • D28 -> TPL pin 1
    • D2 -> TPL pin 2
    • IR LED anode -> VCC
    • IR LED cathode-> TPL pin 4
    • TPL pin 3 -> GND
  • Great!!! I will find one :-)

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

Puck.IR() definition clarification needed

Posted by Avatar for Robin @Robin

Actions