Avatar for thedamos


Member since Dec 2016 • Last active Jan 2020
  • 0 conversations

Most recent activity

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

    @allObjects @Ron

    My guess is that the sensor works as described in this article by measuring current induced by the photodiode when exposed to light. From that article:

    As a photodiode, an LED is sensitive to wavelengths equal to or
    shorter than the predominant wavelength it emits.

    That would explain the choice of the red LED - it detects more of the spectrum than the other LEDs. The article also notes the following:

    To use the LED as an optical detector, do not forward bias the LED
    into quadrant #1 of the current-voltage (I-V) curve. (Quadrant 1 is
    when the operating voltage and current are both positive.)

    So, there you go. Don't turn it on.

    For the simple night light project, I ended up using a second Puck as the ambient light sensor to turn the puck acting as the night light on and off. This is a decent work-around but certainly could be less than ideal for many projects.

    It is unfortunate that maintaining accurate light sensor readings looks like it requires sacrificing physical feedback on the puck, at least using whats on board. One possible solution in some situations could be to use the load function, which restarts the puck and reloads the script from flash. According to the docs load() does not perform a full hardware reset, but it might reset the light sensor readings.

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

    For anyone who is interested, I've updated my night light project to support a second puck as a remote control: https://github.com/somacdivad/puckjs-nig­htlight.

    I started to work on adding support for automatic night light activation based on low ambient light, but have had some problems with some funky reading from my Puck after the LEDs have been turned on and off again.

    Once I have that figured out, I have a few other more advanced project ideas I will post here once they come to fruition :).

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

    @Gordon: I think there is still something going on. I had been banging my head against my table trying to get one of my pucks controlling the other via bluetooth and kept getting the unhandled promise rejection error. Then I found this thread and updated the firmware to 1v90.5. However, that didn't solve my problem.

    To make sure it wasn't something dumb on my part, I copied and pasted the code from the Controlling Other Pucks example (from the "Making it Faster" section). After pressing the button roughly 25 - 30 times I either get the error or no error displays in the console but the master puck stops controlling the other puck. The puck itself is still responsive to console commands, so it doesn't appear to be freezing or anything strange like that. My best guess is that the busy variable gets set to true and never reset when the error occurs so the code in the body of the sendToggle function is never executed. That doesn't help understand the error, though.

    For completeness, the console looks like this once the error occurs:

    Uncaught error: Unhandled promise rejection: undefined
     at line 34 col 47
    ...tic.writeValue("toggle()\n").then(fun­ction() {
    in function called from system
  • in Puck.js, Pixl.js and MDBT42
    Avatar for thedamos

    Very nice. I wish it were brighter, but it does work quite well!

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

    A color changing night light I made for my daughter: https://github.com/somacdivad/puckjs-nig­htlight.

    We found that the night light looks best when the silicon cover is removed and then just set on top of the Puck in order to better diffuse the light from the LEDs. This makes turning the night light on and off a little bit more difficult, so I will update the project soon with code for using a second Puck as a remote control.

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

    I am also having some issues with NFC. I got 2 pucks. On one the NFC URL works just fine. The other stopped working after a few hours of fooling around with it. For example, if write something like:


    and upload to both pucks, it works fine on one and not on the other. That said, I can not get the following code to work on either of my pucks:

    NRF.on('NFCon', function() {
      digitalPulse(LED1, 1, 250);

    I was hoping to use NFC to be able to tap one puck on the other and pass some information. I have tried resetting the troublesome puck, but haven't had any luck. All other functions tested on the pucks have worked fine so far (bluetooth, mag, temp, etc.)