Puck.js as power meter logger

Posted on
  • Hi everyone
    I am trying to follow the puck.js power meter example. Have a question about LDRs and battery life.
    I have the below LDRs available at the local store. Which one would be the best for battery life?
    Also, how to estimate, how long will the battery last for? Is the main power usage during the transmission?

    Light resistance: 450K-1.2M
    Dark resistance: 10MΩ

    Light resistance: 135K-420K
    Dark resistance: 10MΩ

    Light resistance: 45kΩ - 140kΩ
    Dark resistance: 10MΩ

    Light resistance: 5kΩ-10kΩ
    Dark resistance: 0.5MΩ

  • Sat 2021.06.19

    'I am trying to follow the puck.js power meter example'

    Although I found this Pixl reference:

    http://www.espruino.com/Power+Meter

    I never acquired the telepathic skill. Please provide your link so we may follow along.


    I found the specific answer for Puck by taking a peek at the presentation page:

    http://www.espruino.com/Puck.js

    Below the Power Consumption heading are the measured current draw values.

    See the following section on how to calculate an estimated duration with a brand new battery.

    post #2   Battery life of Bangle J.s - in real world situations

    Also understand that advertising interval, transmit power output and sleep durations need to be taken into account, along with number of times polling the LDR sensor is performed.

    See: Puck tips - increasing battery life


    'Which one would be the best for battery life?'

    What additional parts make up the total support circuitry? A schematic would assist here.


    'Is the main power usage during the transmission?'

    See heading Power Consumption as current draw is displayed in common units.

    Full running JS with LED's, BLE, and Mag in that order consume the most, shortening battery life.

  • Hi and thank you for great links!
    There is only one puck.js smart meter example https://www.espruino.com/Smart+Meter that I found.

    Apart from the LDR, there are no other components. The idea is that it will wake up to send out a reading every hour (as a baseline)

  • Sun 2021.06.20

    Thank you @user130485 for the link which assists in locating the appropriate datasheets.
    Following the 'Light Dependent Resistor' link takes us to:

    https://www.espruino.com/LDR
    https://www.espruino.com/datasheets/GL5537.pdf
    https://datasheetspdf.com/datasheet/GL5537.html
    https://datasheetspdf.com/pdf-file/756912/ETC/GL5537/1

    As all show a wide range of voltages permissible, we will mainly be concerned with the power rating, which is 100mW max.

    As there are no other parts in the circuitry, we will mainly be concerned with the resistive value. Since from Ohm's law E = I * R we may deduce the the formula for current,
    I = E / R and using the values provided in post #1, we learn that the higher the resistance, the lower the current draw and thus a lower power consumption. P = I * E


    Light resistance: 450K-1.2M
    Dark resistance: 10MΩ
    
    E=IR  I=E/R  3/450K = 6.67 e-6
    P=IE  *3 = 0.000 020
    
    Light resistance: 5kΩ-10kΩ
    Dark resistance: 0.5MΩ
    
    I=E/R  3/5000 = 0.000 600
    P=IE   *3 = 0.001 800
    



    The lowest resistive component is nearly 100 times worse in power consumption.

    In conclusion it can be observed that from the values given, the LDR with the highest resistance will consume the least amount of power, but for those characteristics, will most likely be the highest cost.

    Even the worst case part will only consume 2ma for a fraction of a second, every few seconds. So compared with every thing else going on, is a negligible loss.

    That said, it must also be known that the internal resistance that the LDR will be in circuit with is around 13K ohm.

    http://www.espruino.com/datasheets/nRF52832_PS_v1.0.pdf
    See: p.151 section 20.4.1 GPIO Electrical Specification

    Review the datasheets for best characteristics and then compare part cost.

  • Love your detailed replies!
    With an internal resister of "around 13k ohm" that you mentioned - is that in series or parallel?
    I know basic electronic concepts, but not really my field, so having a bit of a blank trying to picture it. Will it be like LDR and internal in series, thus making a voltage divider to an analog read pin (in this case between 2 digital pins with one set to 0)?
    I was asking about different LDRs as I do not know if the device will be able to register this micro voltage if too high resistance is chosen.
    I dont think it will really matter as you have said - I looked at the nRF power estimation and most of the power will be used in tramission of the data

  • Hi! I think you asked on YouTube as well?

    Will it be like LDR and internal in series, thus making a voltage divider to an analog read pin

    Yes, that's exactly it. In this case, we're not even using the pin as an analog input - we're just using it to detect a digital signal - a 1 or a 0.

    in this case between 2 digital pins with one set to 0

    Yes, this is just done for ease of wiring - one side is just GND

    power consumption

    The resistance of any LDR is less with more light - so really the biggest thing you can do to ensure low power consumption is to make sure that when you fit the Puck over the electrity meter, you try and cut out as much external light as possible.

  • Hi, let me pull this thread up again. I do have another question about the sensor. We have a newly installed electricity meter now and the LEDs are very much less bright as at the meter before. So the GL5537 doesn't seem to recognize the quick flashing anymore. Is there a more sensitive sensor? I see there are couple of others ... GL5539, G5549, GL5637D (spectral peak 560nm?!) - different Ohms but I dont see if they are more sensitive or not. Any help is appreciated.

  • Argh, that's a shame. Probably what you could do is use the same LDR but try an external resistor. If you added a variable resistor then you could actually tweak the value until it started recording the value reliably?

    The other thing you could try is to use the low power comparator built into the chip:

    https://www.espruino.com/NRF52LL#count-how-many-times-d31-crosses-vcc-2-in-10-seconds

    That could potentially be a software-only solution (although if you don't have an external pullup resistor, enabling the internal one when using the pin in analog mode could be a bit of a pain involving some register poking).

  • Well, maybe it's just a matter of the spectral ... the blinking LED is red, human visible. The GL5537 "aims" at 550 nm, which is rather green. The GL5637D is sensitive at 560 nm ... as far as I can see, 580-590nm would make sense ... dont you think?

  • Good point - it's worth a try. There's no specific reason I chose that LDR other than it being what I had in my desk. However my meter flashes red and it worked for me.

    Looks like you still get ~60% of the response for a red LED though so while maybe not as good it may be fine.


    1 Attachment

    • gl5337-wavelength.png
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Puck.js as power meter logger

Posted by Avatar for user130485 @user130485

Actions