Browse Source

Brightness Sensor added, requirements.txt updated

master
Luis Waldhauser 1 year ago
parent
commit
60be6862b0
2 changed files with 35 additions and 7 deletions
  1. 20
    1
      requirements.txt
  2. 15
    6
      software/roboter/raspy/raspySensors.py

+ 20
- 1
requirements.txt View File

@@ -1,11 +1,30 @@
Adafruit-Blinka==8.16.1
adafruit-circuitpython-busdevice==5.2.4
adafruit-circuitpython-dht==3.7.8
adafruit-circuitpython-requests==1.13.1
adafruit-circuitpython-tsl2561==3.3.15
adafruit-circuitpython-typing==1.9.0
Adafruit-PlatformDetect==3.43.0
Adafruit-PureIO==1.1.10
certifi==2022.12.7
charset-normalizer==3.0.1
click==8.1.3
Flask==2.2.3
idna==3.4
importlib-metadata==6.1.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
paho-mqtt==1.6.1
pkg_resources==0.0.0
pyftdi==0.54.0
pyserial==3.5
pyusb==1.2.1
requests==2.28.2
rpi-ws281x==4.3.4
RPi.GPIO==0.7.1
sysv-ipc==1.1.0
typing_extensions==4.5.0
urllib3==1.26.14
paho-mqtt==1.6.1
Werkzeug==2.2.3
zipp==3.15.0

+ 15
- 6
software/roboter/raspy/raspySensors.py View File

@@ -1,5 +1,6 @@
#from picamera import PiCamera
import adafruit_dht
import adafruit_tsl2561
import board
import json

@@ -8,15 +9,20 @@ class RaspySensors:
def __init__(self) -> None:
'''Init all Sensors'''
#Message if Error

#Air Temperature & Humidity
self.dht22 = adafruit_dht.DHT22(board.D4, use_pulseio=False)

#Brightness
self.tsl2561 = adafruit_tsl2561.TSL2561(board.I2C())

#global Variables
self.sensorData ={
"Air Temperature" : 0,
"Air Humidity" : 0,
"Earth Humidity" : 0,
"Brightness" : 0
"Air Temperature [°C]" : 0,
"Air Humidity [%]" : 0,
"Earth Humidity [%]" : 0,
"Brightness [Lux]" : 0
}

def readSensors(self):
@@ -26,13 +32,16 @@ class RaspySensors:
#if Error reading Data try again
while True:
try:
self.sensorData["Air Temperature"] = self.dht22.temperature
self.sensorData["Air Humidity"] = self.dht22.humidity
self.sensorData["Air Temperature [°C]"] = self.dht22.temperature
self.sensorData["Air Humidity [%]"] = self.dht22.humidity
except:
continue
break

#read TSL2561
self.sensorData["Brightness [Lux]"] = round(self.tsl2561.lux, 2)

return self.sensorData
def takePicture(self):

Loading…
Cancel
Save