How to measure the power and temp of Hailo-8 M.2 async

The Raspberry PI Ai kit doesn’t have the INA component, and so it cannot measure the power drawn by the device. But, it still has the temperature sensor, and so you can measure the temperature of the chip periodically like this:

#!/usr/bin/env python3

import time
from hailo_platform import Device

def _run_periodic(delay=1):
    target = Device()
    try:
        while True:
            temp = target.control.get_chip_temperature().ts0_temperature
            print(f'{temp:.2f} C', end='\r')
            time.sleep(delay)
    except KeyboardInterrupt:
        print('-I- Received keyboard intterupt, exiting')

if __name__ == "__main__":
    _run_periodic()

2 Likes