LoPy4 power consumption

  • This post is deleted!

  • @robert-hh

    Thank you very much for your answers! I will go with average then.

  • @StefanG For the deepsleep current you can get a fixed number by measuring. That number should be more or less constant, unless you change the set-up. A 1 MOhm resistor between 3.3V and GND will for instance increase the current by 3.3 µA.
    But even then. If you look into the data sheet for currents, you see a Min, Typical and Max value, derived from testing at the manufacturer. This value changes from device to device and with the temperature.
    For the runtime current that is even more fuzzy, because it depends on things like network availability, HF noise, clock skews, etc.... Many factors internal and external to the device. But since you want to run the device for a long time, average values are fine.
    You miss a correct answer. You have it, but it is not a single number, but a probability distribution. For that there might be a precise mathematical definition, but practically not one cares. An estimated value is in this case as good as a precisely calculated one.
    And to make things even more uncertain: you also do not know exactly the capacity of the battery. The value printed on it is a typical value +/- x%. It varies with the temperature and charging history, and it will degrade over time.

  • This post is deleted!

  • @StefanG You do not have to take the DS18B20 into account, unless you pull it's Datapin low during the sleep phase. The largest amount of power consumption comes from the LoPy4. But that one is hard to predict. Looking at my LoPy4 here, it has a start-up current of about 45mA, then a few short peaks during WiFi connection of about 200mA, and then about 90 mA average. Since your code consist of a short start-up + connect, measuring and sending, you should start assuming 100mA as consumption. The largest uncertainty come from the time it need to connect to WiFi. In my set-up, that takes about 5 seconds most of the time. So if you make a worst case assumption of 10 seconds total time, you end up with 1000 mAs charge per cycle. A 2000mAh=7.200.000mAs battery will allow ~7200 measuring cycles. At one cycle every 300 seconds that would last for 25 days.

  • This post is deleted!

  • This post is deleted!

  • @StefanG calculating the average power consumption is a simple formula:

    (Time awake * current awake + time sleeping * current sleeping) / (time awake + time sleeping)

    The trouble is estimating many of the variables, which in turn depend on what you have wired, the modes various components are in (both when awake and during sleep), connection details, etc.

    It is difficult to have a very very short awake cycle. IIRC a LoPy takes a good 2 seconds to boot, possibly a lot more if you load a lot of code, especially if not frozen.

    Wi-Fi connection times can be quite slow, and depend a lot on your network. IIRC you can save a good second if you switch to static addressing rather than relying on DHCP. Then you have your TCP and TLS setup time, very dependent on latency to the server.

    Don’t know how long it takes to get an accurate reading on your sensor, but all in all, your awake time probably won’t be less than 5 seconds, possibly up to 10.

    Power consumption during the awake time is very variable (there’s a baseline current even when the ESP32 is perfectly idle, and there are spikes during initial boot, code execution, WiFi TX and RX...). You’ll have to measure that in your specific scenario to get any sort of accurate figure. The average will probably be somewhere between 50 and 100 mA, possibly a bit more.

    During deep sleep, the LoPy4 should draw somewhere between 10 and 20 uA if all goes well. Add to that your sensor and anything else you have around.

    So with 5 seconds awake, 295 seconds sleeping, 50 mA awake and 20 uA sleeping, the average would be about 850 uA. You can see that the awake component accounts for the vast majority of it. That means you could have a battery lifetime counted in months if those parameters are accurate.

    Now if you go up to 10 seconds awake at 100 mA, you are suddenly at 3.35 mA. That drops your battery life to weeks.

    If you want any sort of decent battery life, you’ll have to reduce your consumption as much as possible:

    • reduce the awake time
    • reduce power while awake
    • wake up less often

  • Use DeepSleep for 5 mins, start wifi, get temperature, send, Deep Sleep

    Deep Sleep restart Lopy4
    Write you code to enable wifi, read and send data
    and deep sleep
    after deep sleep board restart and do it again

Log in to reply

Pycom on Twitter