Monsoon Power Monitor is commonly used by researchers and engineers to measure energy consumption at high frequency. However, the lack of support for Mac OS X and Linux is a big turnoff and inconvenient. The monsoon.py included in AOSP is problematic on Mac OS X. The serial port access over USB blocks indefinitely every so often until reboot. The official support for Windows only renders virtual machine and web service as alternatives. Unfortunately, accessing the device through a virtual machine is not guaranteed to work. For example, the device enumeration API may return nothing, unlike on a real Windows machine. Therefore, setting up the web service on real Windows for remote scripting would be the expedient solution.
The Monsoon PowerTool Web Service for scripting I created is hosted on GitHub. This project contains the server-side web service in C# and a Java client. There is also a setup subproject for installation on Windows. The Java client can be built with Gradle to test the remote web service and shows output as follows.
PowerToolServiceTest > testPowerToolServiceSampling STANDARD_OUT Found connected Monsoon monitor of serial 6325 Instant main channel: samples=14355, current=0.248630.2, voltage=3.690500.2 Instant main channel: samples=24255, current=0.218130.2, voltage=3.690500.2
View build.gradle for details to set the remote WSDL URL.
The Web Service APIs are based on PowerTool 184.108.40.206. while the client APIs depend on the actual stub code generation by Apache CXF. Refer to the official developer’s guide for the API overview.