Run your Pi remotely with a 18650 Lithium Ion battery.
What is the Pi18650 HAT?
The Pi18650 is an add-on HAT which plugs into the 40-pin connector on the Raspberry Pi. This HAT allows you to operate your Raspberry Pi without a power cable and can use various capacity 18650 Lithium Ion batteries. On board is a 1A battery charging circuit for charging the battery. This is an integrated unit, so no dangling batteries and perfect for on-the-go users. It also includes a header for connecting a low-cost WiFi ESP8266 module, so you can monitor your Pi from a distance and get battery status and other sensor data connected to your Pi. Lithium Ion is the new craze for battery options as they pack a punch and retain it for quite some time without loss.
find out more at,
How Long Can The Pi Last?
The Raspberry Pi Zero uses approximately 87mA with no USB dongle and around 103mA with the USB dongle. With a fully charged 3000mAh battery, the Pi would last 34.5 hrs with nothing attached. You can add larger capacity batteries for longer run times or connect a solar panel to the USB port for ongoing charge.
How Does It Work?
The Pi18650 holds a single cell lithium Ion 18650 form factor battery which should have an integrated battery protection circuit. The boost circuit maintains the voltage to the Pi at 5.1V for battery voltages of 3.7V to 4.2V. The jumper allows you to disable power to the Pi and isolate the battery circuit or start the Pi. It also includes a charging IC which can charge up to 1A from the USB micro connector and has a battery monitoring IC which communicates to the Pi via I2C. We have coded a Python script using I2C SMBUS for you to read the battery status. Charging LEDs show the status of the charging process. The Pi18650 can also be used with other development and SBC boards, robots and other remote operated devices. Any power source up to 20V DC max can be used with the charger.
def fuelguage_check_volt(self): #voltage is 14bit (reg's I and J) and temperature 10bit (reg's M and N)resolution #convert I and J to 16bit variable, then (value / 65535) x 6V = Voltage #read registers I and J (8 and 9 sequentially) voltage_msb = float(0.0) voltage_lsb = float(0.0) temp_msb = float(0.0) temp_lsb = float(0.0) all_regs = bus.read_i2c_block_data(FUELGUAGE_ADDR, FUELGUAGE_REG_ADDR_08, 16) status, control, acc_msb, acc_lsb, chrgthhi_msb, chrgethhi_lsb, chrgthlow_msb, chrgthlow_lsb, voltage_msb, voltage_lsb, voltth_msb, voltth_lsb, temp_msb, temp_lsb, tempth_msb, tempth_lsb = all_regs #print "all regs1: ", all_regs #(voltage_reg_I_J) = bus.read_i2c_block_data(FUELGUAGE_ADDR, FUELGUAGE_REG_ADDR_08, 2) #voltage_msb = bus.read_byte_data(FUELGUAGE_ADDR, FUELGUAGE_REG_ADDR_08) #voltage_lsb = bus.read_byte_data(FUELGUAGE_ADDR, FUELGUAGE_REG_ADDR_09) #print "voltage_reg_I_J: ", voltage_reg_I_J #voltage_msb, voltage_lsb = voltage_reg_I_J #print "voltage_msb: ", voltage_msb #print "voltage_lsb: ", voltage_lsb voltage_16bit = float(0.0) voltage_msb = voltage_msb << 8 #print "voltage_msb: ", hex(voltage_msb) #print "voltage_lsb: ", hex(voltage_lsb) voltage_16bit = float(voltage_msb | voltage_lsb) #print "voltage_16bit: ", voltage_16bit #voltage at battery battery_volt = float(0.0) divisor = float(65535.0) multiplier = float(6.0) battery_volt = ( voltage_16bit / divisor ) * multiplier print "battery_volt: ", battery_volt battery_capacity_percent = 0 #battery capacity reference table if battery_volt >= 4.20: battery_capacity_percent = 100 elif battery_volt < 4.20 and battery_volt >= 4.15: battery_capacity_percent = 98 elif battery_volt < 4.15 and battery_volt >= 4.10: battery_capacity_percent = 95 elif battery_volt < 4.10 and battery_volt >= 4.00: battery_capacity_percent = 85 elif battery_volt < 4.00 and battery_volt >= 3.95: battery_capacity_percent = 75 elif battery_volt < 3.95 and battery_volt >= 3.90: battery_capacity_percent = 65 elif battery_volt < 3.90 and battery_volt >= 3.85: battery_capacity_percent = 55 elif battery_volt < 3.85 and battery_volt >= 3.80: battery_capacity_percent = 50 elif battery_volt < 3.80 and battery_volt >= 3.75: battery_capacity_percent = 48 elif battery_volt < 3.75 and battery_volt >= 3.70: battery_capacity_percent = 44 elif battery_volt < 3.70 and battery_volt >= 3.65: battery_capacity_percent = 38 elif battery_volt < 3.65 and battery_volt >= 3.60: battery_capacity_percent = 36 elif battery_volt < 3.60 and battery_volt >= 3.55: battery_capacity_percent = 34 elif battery_volt < 3.55 and battery_volt >= 3.50: battery_capacity_percent = 31 elif battery_volt < 3.50 and battery_volt >= 3.45: battery_capacity_percent = 29 elif battery_volt < 3.45 and battery_volt >= 3.40: battery_capacity_percent = 26 elif battery_volt < 3.40 and battery_volt >= 3.35: battery_capacity_percent = 24 elif battery_volt < 3.35 and battery_volt >= 3.30: battery_capacity_percent = 23 elif battery_volt < 3.30 and battery_volt >= 3.25: battery_capacity_percent = 21 elif battery_volt < 3.25 and battery_volt >= 3.20: battery_capacity_percent = 18 elif battery_volt < 3.20 and battery_volt >= 3.15: battery_capacity_percent = 16 elif battery_volt < 3.15 and battery_volt >= 3.10: battery_capacity_percent = 15 elif battery_volt < 3.10 and battery_volt >= 3.05: battery_capacity_percent = 11 elif battery_volt < 3.05 and battery_volt >= 3.00: battery_capacity_percent = 10 else: battery_capacity_percent = 0 print "battery_capacity_percent: ", battery_capacity_percent #temperature conversion to celcius ------------------------------------------------ #print "temp_msb: ", temp_msb #print "temp_lsb: ", temp_lsb temperature_16bit = float(0.0) temp_msb = temp_msb << 8 #print "temp_msb: ", hex(temp_msb) temperature_16bit = float(temp_msb | temp_lsb) #print "temperature_16bit: ", temperature_16bit #voltage at battery temperature_kelvin = float(0.0) temperature_multiplier = float(600.0) temperature_kelvin = ( temperature_16bit / divisor ) * temperature_multiplier print "temperature_kelvin: ", temperature_kelvin temperature_celcius = float(0.0) temperature_celcius = temperature_kelvin - 273.0 print "temperature_celcius: ", temperature_celcius return battery_capacity_percent, temperature_celcius, battery_volt