Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
[Addon] UPS PIco
#2
Klingt nicht verkehrt dein vorhaben , 

sowas wie eine Prozent anzeige zum Thema Akkustand wäre nicht verkehrt.

Es gibt auch von Haus aus ein Pythonskript worüber man Infos abgreifen kann wie RPi-Spannnug,
Akku-Spannung (Daraus kann man ja vielleicht eine % abfrage machen) 

Spoiler!
 
Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# improved and completed by PiModules Version 1.0 29.08.2015
# picoStatus-v3.py by KTB is based on upisStatus.py by Kyriakos Naziris
# Kyriakos Naziris / University of Portsmouth / kyriakos@naziris.co.uk


import smbus
import time
import datetime

# You can install psutil using: sudo pip install psutil
#import psutil

i2c = smbus.SMBus(1)

def pwr_mode():
  data = i2c.read_byte_data(0x69, 0x00)
  data = data & ~(1 << 7)
  if (data == 1):
     return "RPi"
  elif (data == 2):
     return "BAT"
  else:
     return "ERR"

def bat_level():
  time.sleep(0.1)
  data = i2c.read_word_data(0x69, 0x01)
  data = format(data,"02x")
  return (float(data) / 100)

def rpi_level():
  time.sleep(0.1)
  data = i2c.read_word_data(0x69, 0x03)
  data = format(data,"02x")
  return (float(data) / 100)

def fw_version():
  time.sleep(0.1)
  data = i2c.read_byte_data(0x6b, 0x00)
  data = format(data,"02x")
  return data

def sot23_temp():
  time.sleep(0.1)
  data = i2c.read_byte_data(0x69, 0x0C)
  data = format(data,"02x")
  return data

def to92_temp():
  time.sleep(0.1)
  data = i2c.read_byte_data(0x69, 0x0d)
  data = format(data,"02x")
  return data

def ad1_read():
  time.sleep(0.1)
  data = i2c.read_word_data(0x69, 0x05)
  data = format(data,"02x")
  return (float(data) / 100)

def ad2_read():
  time.sleep(0.1)
  data = i2c.read_word_data(0x69, 0x07)
  data = format(data,"02x")
  return (float(data) / 100)

print " "
print "        pico status V1.0"
print "***********************************"
print " ","UPS PIco Firmware:",fw_version()
print " ","Powering Mode:",pwr_mode()
print " ","BAT Volatge:", bat_level(),"V"
print " ","RPi Voltage:" , rpi_level(),"V"
print " ","SOT23 Temperature:" , sot23_temp(),"C"
print " ","TO-92 Temperature:" , to92_temp(),"C"
print " ","A/D1 Voltage:" , ad1_read(),"V"
print " ","A/D2 Voltage:" , ad2_read(),"V"
print "***********************************"
print " "


Oder suchst du was spezielleres ?

Mfg Andy
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
E39-525D
RaspberryPi 2 
Zitieren


Nachrichten in diesem Thema
[Addon] UPS PIco - von harryberlin - 06.12.2015, 23:07
RE: UPS PIco Addon für Kodi - von NeoRagnarok - 06.12.2015, 23:54
RE: UPS PIco Addon für Kodi - von harryberlin - 07.12.2015, 00:13
RE: UPS PIco Addon für Kodi - von NeoRagnarok - 07.12.2015, 00:25
RE: UPS PIco Addon für Kodi - von harryberlin - 07.12.2015, 00:28
RE: UPS PIco Addon für Kodi - von b3m3 - 07.12.2015, 10:40
RE: UPS PIco Addon für Kodi - von harryberlin - 07.12.2015, 11:30
RE: UPS PIco Addon für Kodi - von NeoRagnarok - 07.12.2015, 11:55
RE: UPS PIco Addon für Kodi - von b3m3 - 07.12.2015, 11:56
RE: UPS PIco Addon für Kodi - von harryberlin - 14.12.2015, 18:59
RE: UPS PIco Addon für Kodi - von b3m3 - 16.12.2015, 08:03
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 18:59
RE: [Addon] UPS PIco - von harryberlin - 22.12.2015, 19:02
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 19:10
RE: [Addon] UPS PIco - von harryberlin - 22.12.2015, 19:17
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 19:24
RE: [Addon] UPS PIco - von harryberlin - 22.12.2015, 19:27
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 19:40
RE: [Addon] UPS PIco - von harryberlin - 22.12.2015, 19:41
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 20:20
RE: [Addon] UPS PIco - von harryberlin - 22.12.2015, 20:23
RE: [Addon] UPS PIco - von NeoRagnarok - 22.12.2015, 20:33

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste