Little project that uses the Trinket and INA219 current sensor breakout from Adafruit to monitor the power consumption of a DC device, using up to 26V and 3.2A, and shows realtime lectures of voltage, current and power.
Communication is done via TrinketFakeUsbSerial which is explained in Adafruit Learning System.
You should have Python, PIP and libusb installed.
On Debian-based OSes, you can do:
sudo apt-get install python-dev python-pip libusb-1.0-0
Then install the PyUSB and docopt Python modules:
sudo pip install pyusb docopt
You will also need the Arduino IDE, correctly configured to use the Trinket, and with the TrinketFakeUsbSerial and TinyWireM libraries installed.
Now go on and use it!
You need a 5V Trinket working at 16MHz to use this. Upload the sketch and build the following circuit:
Connect the load and power supply, plug the Trinket via USB, and run the Python script:
python power-trinket.py
If everything goes well, the Trinket will be detected as soon as it boots the sketch and the script will start displaying realtime lectures at the console.
You can see which options it accepts with:
python power-trinket.py --help