ArduinoGeneral

UPS HAT Raspberry Pi Zero DFR0528 How to get Firmware Version?

userHead sarnus33 2021-01-29 02:57:01 833 Views4 Replies
Hey guys,
can u tell me how to get the Firmware Version from die I2C.

I tried this.
Code: Select all
import smbus
addr=0x10 #ups i2c address
bus=smbus.SMBus(1) #i2c-1
firmware=bus.read_byte_data(addr,0x02)
vcellH=bus.read_byte_data(addr,0x03)
vcellL=bus.read_byte_data(addr,0x04)
socH=bus.read_byte_data(addr,0x05)
socL=bus.read_byte_data(addr,0x06)

capacity=(((vcellH&0x0F)<<8)+vcellL)*1.25 #capacity
electricity=((socH<<8)+socL)*0.003906 #current electric quantity percentage


print("firmware=", firmware)
print("capacity=%dmV"%capacity)
print("electricity percentage=%.2f"%electricity)
But im kinda missing something.

Thanks for your help :)
2022-01-28 22:44:38 A use of the string and its branch is filed for the offers. Paths of the https://australianwritings.net/our-services/thesis/ are implied for the shows. The team is skilful for the end for the stories for the mid of the patterns in the ambit for all usages for the offers. userHeadPic sashyuki
2021-02-01 15:15:41 Of course it's wrong. 223 is 0xDF, that's should be the value in 0x01.
I suggest you use
Code: Select all
list = bus.read_i2c_block_data(addr, 0x00) 
print(list)
This instruction will get a list, including the data of 0x00, 0x01, 0x02 and so on
userHeadPic 347945801
2021-01-29 18:09:05 The returnvalue is 223. Is that right ? How i interpret this then?

Ty for your help :)
userHeadPic sarnus33
2021-01-29 13:48:30 There is no problem with the method you use, but I don’t know what the value you return is, and I don’t know why you think it’s wrong userHeadPic 347945801