Determine power consumption on lopy4

  • Is there a way to determine power consumption of cryptographic operations in lopy4, such as AES and hashing? Thanks

  • @jjbarriga you just make a loop around whatever bit of code you want to test.

    If you want to measure power (which is instantaneous, measured in W), you just read the power drawn while that loop executed (you can use an infinite loop as long as you have a way to get out of it of course).

    If you want to measure energy (which is the integral of the power used of a time period, measured in Ws or Wh or whatever power * time unit), you read the power drawn while the loop is executed, and measure the time it takes to execute the loop, which needs to have a set number of executions. Dividing the total time by the number of iterations will give you the time per execution, multiply that by the power and you have the associated energy.

  • @jjbarriga If you want to do a fine measurement, like for side channel analysis of the crypto oprations, you have to go the ususal way. Eiter:
    a) insert a small resistor into the ESP32 GND connection and pick up the current profile with a fast and precise instrument like an oscilloscope, or
    b) use a micro ESD probe to pick up the radiation from the crypto unit.

    Both requires substantial investment, but should be doable. I do not expect the ESP32 to be resistant against side channel attacks, but did not make any tests yet myself. No need to do so.

  • @kjm Thanks for the answer. Do you know any python code to perform such measure? Thanks again for your help.

  • This post is deleted!

  • You could use one of those inline USB power meters & check what happens when you run encryption code. Although I have to say my lopy4 current when a program is running is not much different to when the module is just idling, contemplating it's navel & flashing it's blue light every 4s

Log in to reply

Pycom on Twitter