Coder Social home page Coder Social logo

ina219_monitor's Introduction

ina219_monitor

This is a small program that lets you use your raspberry pi and an ina219 module to monitor voltage, current, and mAhs realtime as well as create a log file.

ina219_monitor

Setup and Installation

Hardware setup

You can skip this if your hardware is already working

First you need to have a raspberry pi and ina219 modules. You can buy both at adafruit as well as many other vendors. You will need to wire it up, enable i2c on your raspberry pi and test out the connections work.

Raspberry Pi INA 219 Module
Pin 1 (3.3V) | VCC
Pin 6 (GND) | GND
Pin 4 (SCL) | SCL
Pin 3 (SDA) | SDA

VIN+ and VIN- on the module connect to the high side of your load. You can connect either via the header or the 2 pin screw terminal. Adafruit has an excellent tutorial.

Example setup with test load
Example setup with test load

Once you have wired it up it's a good idea to test it. Again Adafruit has an excellent tutorial here on how to install and use i2cdetect to make sure you setup is correct. If it's working correctly you should see something like this

sudo i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Software depedencies

You will need to install the pi-ina219 python library as well as urwid.

sudo pip install pi-ina219

And then the urwid python library

sudo pip install urwid

Usage

python ina219_monitor.py

Settings

There are a few constants in the code you might want to change depending upon your application.

  • UPDATE_INTERVAL Screen refreshes in seconds. Defaults to 10 hz (0.1)
  • LOGGING_INTERVAL Interval at which logs are written in second. Defaults to once a minute (60)
  • SHUNT_OHMS Hardware configuration of your current sense resistor on your board. Defaults to 0.1 ohms
  • LOGFILE name of the logfile, defaults to "logfile.log"
  • MAX_EXPECTED_AMPS Maximum current expected in Amperes. Used by pi_ina219 to configure hardware. Defaults to 500mA (0.5)

ina219_monitor's People

Contributors

mcshicks avatar

Watchers

James Cloos avatar  avatar

ina219_monitor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.