==== Power measurement tutorial with Hard Kernel power meter ==== === PARTS NEEDED === {{:ixc2025:powermeter_parts.png?nolink&400|}} * A. Hardkernel SmartPower power meter * B. Power supply * C. PC computer * D. ESP32 Plus controller board * E. Special USB-C cable to connect board to the power meter * F. Two regular USB-C / USB-A cables After connected together the setup should look like this: {{:ixc2025:powermeter_setup.jpg?nolink&400|}} === HARDKERNEL SMARTPOWER LAYOUT === {{:ixc2025:smartpower3_layout.png?nolink&400|}} * A. Screen * B. Options menu * C. Power LED * D. Alive LED * E. Output channel 0 (left) on / off * F. Output channel 1 (right) on/off * G. UI selector, push to select * H. USB-C connector to PC * I. Channel 1 power connectors * J. Channel 0 power connectors * K. Power supply connector === PREPARATIONS FOR THE POWER METER === - Connect the power supply to the meter - Connect the meter to a PC machine via USB-C cable (should be seen as "CP2102N USB to UART Bridge Controller" in Windows machines) - Download and install CP210x driver for virtual COM port from: https://www.silabs.com/developer-tools/usb-to-uart-bridge-vcp-drivers?tab=downloads - Download and install PuTTY SSH and Telnet client from: https://www.putty.org/ - Check the virtual COM port from the Windows device settings - Open PuTTY and setup the connection - Session -> Connection type: Serial - Session -> Serial line: COMX (X = the number of the virtual serial port) - Session -> Speed: 115200 - SSH -> Serial -> Flow control: None - Session -> Logging -> Session logging: All session output - Session -> Logging -> Log file name -> Browse button: Select suitable output folder for log file, set file name as Measurements&D&T - Session -> Saved sessions: Input name for your setting and click "Save" to use store the settings - Click "Open" - If everything is working correctly, you should now see measurement data coming from the meter in the PuTTY terminal window === PREPARATIONS FOR THE ARDUINO ENVIRONMENT === - Connect the ESP32 Plus board to a PC via USB-C cable (detach the power meter cable if needed) - Follow the installation instructions: https://docs.keyestudio.com/projects/KS5009/en/latest/docs/Arduino/arduino.html#esp32-plus-development-board === GATHERING THE MEASUREMENT DATA === - Have a stopwatch, pen and paper ready! - Connect the power supply to the meter - Adjust output channel 0 (left connectors) settings to USB 2.0 values (5.0V, 0.5A) - Connect the ESP32 Plus board to the power meter via modified USB-C cable - Connect the power meter to a PC via normal USB-C cable - Open PuTTY, load the setting stored in the preparations stage and open the terminal connection to the meter - Activate the left output channel (channel 0) from the power meter - Use the stopwatch, pen and paper to manually log the key events during the testing (activation / de-activation time of the board, trigger times for the sensors etc.)! This helps you later to analyze the results - When the testing session is done, de-activate the left output channel - Close PuTTY window - If everything went well, you should now have a new log file (e.g. MeasurementsXX) in the folder you selected in the PuTTY settings === ANALYZING THE MEASUREMENT DATA === {{:ixc2025:naeyttoekuva_2025-01-18_111409.png?nolink&400|}} - Open the log file in a text editor - Delete non-data rows from the beginning and the end of the file manually - Import the file into Excel as csv / text file - Replace the header with the following information: Time (ms), In (mV), In (mA). In (mW), In (on/off), C0 Out (mV), C0 Out (mA), C0 Out (mW), C0 Out (on/off), C0 Out Intr, C1 Out (mV), C1 Out (mA), C1 Out (mW), C1 Out (on/off), C1 Out Intr, Checksum8 S2, Checksum8 XOR - It might be a good idea to add one more column where you calculate the elapsed time from the start of the measurement in seconds - Now you can play with the data! Create at least the following scatter plots: 1) Time (ms) vs. C0 Out (mV), 2) Time (ms) vs. C0 Out (mA), 3) Time (ms) vs. C0 Out (mW) - You can now analyze the plots by using the event times from the manual test log === READ MORE === * Hardkernel SmartPower power meter reference guide: https://wiki.odroid.com/accessory/power_supply_battery/smartpower3 * KS5009 smart home set / ESP32 Plus controller board reference guide: https://docs.keyestudio.com/projects/KS5009/en/latest/docs/Arduino/arduino.html#esp32-plus-development-board