enesbcs / rpieasy

Easy MultiSensor device based on Raspberry PI
GNU General Public License v3.0
157 stars 33 forks source link

request plugin: LM75A #55

Closed haraldtux closed 5 years ago

haraldtux commented 5 years ago

Hello Alexander Can you make a LM75 I2C temperature sensor plugin

https://nl.aliexpress.com/item/LM75A-Temperature-Sensor-I2C-Interface-Temperature-Module/32685410585.html

Working Python3 code :

#!/usr/bin/env python3 import sys import smbus address = 0x48 if 1 < len(sys.argv): address = int(sys.argv[1], 16) bus = smbus.SMBus(1) raw = bus.read_word_data(address, 0) & 0xFFFF raw = ((raw << 8) & 0xFF00) + (raw >> 8) temperature = (raw / 32.0) / 8.0+ -1.3 print ('LM75 Temperature: {0:0.2f} *C'.format(temperature))

enesbcs commented 5 years ago

I can surely do it, but this device has a +-2Celsius precision which is very low. I can not imagine why anyone choose this type instead of HTU21D/Si7021/DHT22/AM2320/BME280...

haraldtux commented 5 years ago

Indeed, there you have also equal... I was thinking that the LM75 also in a USB TEMPer Gold and X are and they are cheap.

is also but one question, If you think it has no added value, it is good, then we close this issues :+1:

enesbcs commented 5 years ago

The Temper is unique as it can be used in a normal PC on USB port. But as you added the necessarry Python code above i can do the LM75 plugin with minimal work. :) Do you have this device to test the plugin when i implement it?

haraldtux commented 5 years ago

yes, I have a few of the LM75 device (see url) so I would the plugin be able to test

enesbcs commented 5 years ago

Hi Harald! Your code is now embedded in commit https://github.com/enesbcs/rpieasy/commit/d0f2b637346773b099e7016c1621f6f47118405a. Please test it. :)

haraldtux commented 5 years ago

the LM75 plugin work very well ! :+1: log : 09:18:03 Event: LM75#Temperature=20.0 09:18:04 Event: LM75#Temperature=19.9 09:18:05 Event: System_info#Uptime=10374.0 09:18:05 Event: LM75#Temperature=20.0 09:18:05 Event: System_info#Wifi_RSSI=-47.0 09:18:05 Event: System_info#System_load=5.6 09:18:05 Event: System_info#CPU_Temp=39.7 09:18:06 Event: LM75#Temperature=19.9 09:18:07 Event: DHT22#Temperature=19.8 09:18:07 Event: DHT22#Humidity=41.8 09:18:08 Event: LM75#Temperature=20.0 09:18:09 Event: LM75#Temperature=20.0

Thank you Alexander

haraldtux commented 5 years ago

would you be able to fit the file _P069_LM75A.py in line 61 from 2 to 8 , so that you can choose from 8 addresses (have a LM75 module with the 4F address from : webserver.addFormSelector("Address","plugin_069_addr",2,options,optionvalues,None,int(choice1)) to : webserver.addFormSelector("Address","plugin_069_addr",8,options,optionvalues,None,int(choice1))

has no hurry, may best for next update ;-)

enesbcs commented 5 years ago

Ehm.. source is copied from the AM2320 plugin. :) Fixed in commit https://github.com/enesbcs/rpieasy/commit/6d8961bf6591dbd879ea3d6ac803196dae139896

haraldtux commented 5 years ago

Thank you :+1:

can be closed !