Git Product home page Git Product logo

pibatterygague's Introduction

PiBatteryGauge

It is a battery gauge integrated charging function. Becareful of the position. Pi Battery Gauge must be connected with Pin(3~8). Any size of 3.7V Li-battery is OK, it could also work as a small UPS.

Raspberry Pi Installation

1.Open the I2C interface of the Raspberry Pi.If it is already open, skip this step. Open Terminal, type the following command, and press Enter:

 pi@raspberrypi:~ $ sudo raspi-config

Then use the up and down keys to select “5 Interfacing Options” -> “P5 I2C” and press Enter to confirm “YES”. Reboot the Raspberry Pi.
2.Installing Python libraries and git (networking required). If it is already installed, skip this step. In the Terminal, type the following commands, and press Enter:

pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install build-essential python-dev python-smbus git

3.Download the driver library and run it. In Terminal, type the following commands, and press Enter:

pi@raspberrypi:~ $ git clone https://github.com/DFRobot/DFRobot_MAX17043.git
pi@raspberrypi:~ $ cd ~/DFRobot_MAX17043/RaspberryPi/python
pi@raspberrypi:~/DFRobot_MAX17043/RaspberryPi/python $ python DFRobot_MAX17043.py

Read Battery Voltage, Remaining Power and Set Low Power Interrupt Alert

pi@raspberrypi:~/DFRobot_MAX17043/RaspberryPi/python $ cd readAndInt
pi@raspberrypi:~/DFRobot_MAX17043/RaspbeeryPi/python/readAndInt $ python readAndInt.py

Results

  • RaspberryPi prints the current voltage (voltage), remaining power (percentage), and interrupt alert information (if any) every 2 seconds.
  • The default value of the battery low power interrupt alert threshold is 32%. That is, when the remaining power is lower than 32%, a falling edge interrupt is generated on the ALR pin. This threshold can be set to any integer between 1-32 (corresponding to 1%-32%, respectively) with the function setInterrupt().
  • When the battery's initial remaining power is higher than interrupt alert threshold, the ALR pin is set high. If it falls below the threshold (due to discharge) , the ALR pin is pulled to low. The controller is triggered to print ”Low power alert interrupt!”, and then clear interrupt through clearInterrupt(), which causes ALR back to high immediately.
  • When the battery's initial remaining power is below interrupt alert threshold, the ALR pin will generate an interrupt at the beginning.
  • After the battery remaining power grows higher than interrupt alert threshold (due to discharge) , another interrupt will be generated when the power again falls below the threshold (due to discharge). If the clearInterrupt() is not called after the interrupt is occurred, the ALR pin will remain low regardless of the statue of the battery.

NodeMCU(NodeMCU-07) Installation

  1. Install Arduino core for ESP8266: https://github.com/spacehuhn/esp8266_deauther/wiki/Installation#compiling-using-arduino-ide
  2. Install OLED library for esp8266: https://github.com/squix78/esp8266-oled-ssd1306
  3. Install Max17043 library for arduino: http://playground.arduino.cc/Main/MAX17043
  4. Select board DSTIKE by Travis Lin.
  5. Connect your board, select the correct COM port and click upload "NodeMCUTest.ino" of this page.

Results

Arduino Installation and other application

https://www.dfrobot.com/wiki/index.php/Gravity:_3.7V_Li_Battery_Fuel_Gauge_SKU:_DFR0563 https://www.sparkfun.com/products/10617

pibatterygague's People

Contributors

lspoplove avatar

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.