Using Espruino with the Nordic Thingy52 nrf52832

Posted on
  • Dear Espruino, (source)

    I'm not much of an embedded engineer myself but I found your product and might need it to get the power usage levels from the Thingy52. I have a few questions.

    Is the setup of your firmware as simple as putting it on the Thingy52 and all the sensor data becomes available through your web bluetooth implementation or do I have to put more code on the Thingy myself?

    I am also wondering about the getBattery() function. It says the function returns voltage as a number. Will this number go up and down depending on how many sensors are sending data or is it a static number independent of the amount of sensors running?

    Best regards :)

  • Wed 2020.02.26

    'I am also wondering about the getBattery() function'

    Hi @svansomeren, while I don't have practical experience with the Nordic Thingy52 device,

    // Returns the state of the battery (immediately, or via callback) as { charging : bool, voltage : number }
    Thingy.getBattery = function(callback) { ... }

    which closely mimics the response provided by nRF devices with batteries:

    'In devices that come with batteries, this function returns the battery charge percentage as an integer between 0 and 100'­tBattery

    I'm trying to locate a user response that I read recently that seemed to imply this value is reliable down to around ~30%, which most likely is the point the manufacturer defines the point where battery voltage falls off. I also thought/felt this was for all nRF devices, although the internal docs imply otherwise. Still searching. . . . see notes to Gordon below

    EDIT: Found it!
    'currently we just convert the voltage linearly into battery percent, which works over most of the life of the battery'­343166/#comment15099263
    The limitation on discharge was specifically for a LiPo

    'and all the sensor data becomes available through your web bluetooth implementation'

    There are six onboard sensors listed below the 'Features' heading and the corresponding functions to access them are listed below the 'On-board peripherals' heading. Any external sensor would need additional code that may be obtained by searching the tutorials for a specific sensor.

    Note to @Gordon


    The GitHub link currently points to an old offset­b/master/src/jswrap_espruino.c#L1726

    and should be ~1929­b/master/src/jswrap_espruino.c#L1929

    I'm not entirely sure how to make the documentation suggestion positively at the GitHub site.

    Is there a reference page for the 'Thingy' library, or is it's instantiation and that limited documentation at the following link all that was intended?

    'On-board peripherals are exposed via the Thingy library'

  • Thanks Robin :)

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

Using Espruino with the Nordic Thingy52 nrf52832

Posted by Avatar for svansomeren @svansomeren