• I am letting a program run for a long time on the Puck, but somehow it stopped after a day.

    It is showing light and magnet level in the bluetooth name, changing every 4 seconds.

    But it stopped after a day. Battery level was at 72 so ought to be fine.

    It did have a Console.log in it, does that get saved when not connected to the IDE and maybe did the memory get full? I couldn't connect at all anymore, had to do a hard reset where i insert the battery while holding the button, 5 green blinks.

    Something else that might be leaking memory or something? It is a pretty simple loop.

  • Are you using up to date firmware (1v93)? You could check process.memory().used and see if it's changing at all (which would indicate a memory leak).

    Also, you could try removing the console.log (or just setting console.log=function(){};) - I did fix some problems recently (which haven't made it into a release) which meant that if you printed a lot of data in one go while not connected it could cause some problems.

  • running it without the console now, see if it lasts.

    Up to date firmware, yes. I will look at the memory.
    thanks

  • Could the Puck run off of a LiPo by the way? Can it handle the 4.2V max?

    Just so I could run Puck and peripherals on a single battery while being able to use the Puck to read the voltage..

  • I'm afraid the maximum voltage is 3.6v - too low for a LiPo. You could drop 0.7v with a diode if needed though?

  • But would the voltage reading in the Puck still be meaningful, proportional to the voltage of the Lipo?

    You are saying diode right, not resistor?

    Is there another way to read a 4.2-3.2 voltage off two pins of the Puck?

  • LDO - ... A diode may not give you what you are looking for, especially when the current draw is as low as a puck in zzzzzzzzz mode. See conversation about: Power source, GPIO current output

  • Definitely a diode, not a resistor. However as @allObjects says, at small power draws diodes won't reliably drop 0.7v (it can be a bit less). While personally I'd say a diode was fine to power a Puck in this case (I've personally used one a few times), ideally you'd use a proper voltage regulator - and as you say the voltage reading won't be great.

    What I'd do instead for the voltage is to use a potential divider (in this case, just two equal value resistors) to halve the voltage from the battery, which you can then feed into an analog input on the Puck.

    The lower value the resistors the more accurate the reading but the more power draw - however you can also put a small capacitor between GND and the analog input, and then you can use high-value resistors (1 MOhm?) which will draw tiny amounts of power from the LiPo battery.

    So:

     Bat    +-------------+
    Voltage               |
                          |
                         +-+
                         |-|
                         |-|
                         |-|
                         +-+
                          |
                          +---------+--------------------------+  Analog input
                          |         |
                          |         |
                         +-+        |
                         |-|     +--+---+
                         |-|
                         |-|     +--+---+
                         +-+        |
                          |         |
                          |         |
      GND   +-------------+---------+---------------­-----------+   GND
    
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

A long running Puck that shows sensor values in the name, why could it stop after a day?

Posted by Avatar for user79451 @user79451

Actions