Exemple #1
0
    def __init__(self):
        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.tca = TCA9548A(self.i2c)
        self.sensor1 = HTU21D(self.tca[2])
        self.sensor2 = HTU21D(self.tca[4])
        self.sensor3 = HTU21D(self.tca[6])
        self.sensor4 = HTU21D(self.tca[7])

        self.loadCalibration()
Exemple #2
0
    def __init__(self):
        self.i2c_bus = busio.I2C(scl=board.SCL, sda=board.SDA)
        self.i2c_mux = TCA9548A(i2c=self.i2c_bus, address=0x70)

        self.adc = ADS1115(i2c=self.i2c_mux[3], address=0x56)
        self.volt_gain = 1
        # Measures for standard lear batteries with nominal 12V
        self.full = 12.65  # V
        self.empty = 11.99  # V
Exemple #3
0
    def __init__(self):
        self.i2c_bus = busio.I2C(scl=board.SCL, sda=board.SDA)
        self.i2c_mux = TCA9548A(i2c=self.i2c_bus, address=0x70)
        self.wired_sensors = dict()

        self.bmp280_1 = Adafruit_BMP280_I2C(i2c=self.i2c_mux[0], address=0x76)
        self.bmp388 = BMP3XX_I2C(i2c=self.i2c_mux[1], address=0x77)
        self.bmp280_2 = Adafruit_BMP280_I2C(i2c=self.i2c_mux[2], address=0x76)

        self.bmp280_1.sea_level_pressure = 1013.25
        self.bmp388.sea_level_pressure = 1013.25
        self.bmp280_2.sea_level_pressure = 1013.25

        self.air_density = 1.204  # kg/m2
        self.dynamic_pressure = 0  # Pa (!)
        self.tek_pressure = 1013.25  # hPa
        self.IAS = 0  # kph
        self.QNH = 1013.25  # hPa
        self.altitude = 0  # MSL
        self.temperature = 21  # °C
Exemple #4
0
eventlet.monkey_patch()

from datetime import datetime
import numpy as np

import board
import busio
import RPi.GPIO as GPIO
from adafruit_tca9548a import TCA9548A

# Create the I2C Bus for the RaspberryPi
i2c_bus = busio.I2C(board.SCL, board.SDA)

# Create the TCA9548A multiplexer object and give it the I2C bus.
tca_i2c_multiplexer = TCA9548A(i2c_bus)

# Setup the GPIO pins for the relay outputs.
# Set BCM GPIO numbering
GPIO.setmode(GPIO.BCM)
# Set pins as outputs
GPIO.setup(26, GPIO.OUT)
GPIO.setup(20, GPIO.OUT)
GPIO.setup(21, GPIO.OUT)

sensor_db = Sensor.query.filter(Sensor.model == 'AMG8833', Sensor.isEnabled == 1).all()
sensors = []

for i in sensor_db:
    try:
        sensors.append(AMG8833(tca_i2c_multiplexer[i.i2c_channel], i.id))
Exemple #5
0
 def __init__(self):
     self.i2c = busio.I2C(scl=board.SCL, sda=board.SDA)
     self.mux = TCA9548A(
         i2c=self.i2c,
         address=0x70)  # 0x70 is the standard byte address of the TCA9548a.
Exemple #6
0
 def __init__(self):
     self.i2c = busio.I2C(scl=board.SCL, sda=board.SDA)
     self.i2c_mux = TCA9548A(i2c=self.i2c, address=0x70)
     self.sens_channels = [0x76, 0x77]
Exemple #7
0
INDEX_OFFSET = len(PACKET_SIGNATURE)

PITCH_FORWARD_MIN = -10
PITCH_FORWARD_MAX = -15

PITCH_REVERSE_MIN = 10
PITCH_REVERSE_MAX = 15

#initialize bno085s
from adafruit_bno08x import (BNO_REPORT_ACCELEROMETER, BNO_REPORT_GYROSCOPE,
                             BNO_REPORT_MAGNETOMETER,
                             BNO_REPORT_ROTATION_VECTOR,
                             BNO_REPORT_GAME_ROTATION_VECTOR)
from adafruit_bno08x.i2c import BNO08X_I2C
i2c = busio.I2C(board.SCL, board.SDA)  #, frequency=10000)
tca = TCA9548A(i2c)
#left arm i2c bus plugged into tca channel 0
bno_chest = BNO08X_I2C(tca[0])
bno_chest.enable_feature(BNO_REPORT_GAME_ROTATION_VECTOR)
bno_head = BNO08X_I2C(tca[7], address=0x4B)
bno_head.enable_feature(BNO_REPORT_GAME_ROTATION_VECTOR)
bno_left_shoulder = BNO08X_I2C(tca[1])
bno_left_shoulder.enable_feature(BNO_REPORT_GAME_ROTATION_VECTOR)
bno_left_wrist = BNO08X_I2C(tca[1], address=0x4B)
bno_left_wrist.enable_feature(BNO_REPORT_GAME_ROTATION_VECTOR)
#initialize rfm95
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.A5)
reset = digitalio.DigitalInOut(board.A4)
import adafruit_rfm9x
rfm9x = adafruit_rfm9x.RFM9x(spi, cs, reset, 915.0)