Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

WiFi LoRa Environmental Monitoring System with INMP441 Mic and Multiple Sensors

View and Edit Project In Cirkit DesignerImage of WiFi LoRa Environmental Monitoring System with INMP441 Mic and Multiple Sensors

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to collect environmental data using various sensors and transmit the data via a LoRa module. The circuit includes a microphone, UV light sensor, air quality sensor, temperature/pressure/humidity sensor, and a solar power management system. The data is processed by a microcontroller and sent over a LoRa network.

Component List

  1. INMP441 FRONT MIC

    • Description: Digital MEMS microphone
    • Pins: L/R, WS, SCK, SD, VDD, GND
  2. WiFi Lora 32V3

    • Description: Microcontroller with WiFi and LoRa capabilities
    • Pins: pin 1 to pin 36
  3. CJMCU-811

    • Description: Air quality sensor
    • Pins: VCC, GND, SCL, WAK, INT, RST, ADD, SDA
  4. BME/BMP280

    • Description: Temperature, pressure, and humidity sensor
    • Pins: GND, SCL, SDA, VIN
  5. Adafruit LTR390 UV Light Sensor

    • Description: UV light sensor
    • Pins: VCC, 3.3V, GND, SCL, SDA, INT
  6. Solar Power Manager V5

    • Description: Solar power management module
    • Pins: Solar -, Solar +, Battery -, Battery +, USB -, USB +
  7. Solar Panel

    • Description: Solar panel for power generation
    • Pins: +, -
  8. Air Quality Sensor

    • Description: Air quality sensor
    • Pins: TX, 5V, GND, RX
  9. 18650 in Holder

    • Description: 18650 battery holder
    • Pins: GND, VCC
  10. Micro USB to Cable (2 Pin)

    • Description: Micro USB to 2-pin cable
    • Pins: Micro USB, +, -
  11. USB Power

    • Description: USB power source
    • Pins: +, -

Wiring Details

INMP441 FRONT MIC

WiFi Lora 32V3

CJMCU-811

BME/BMP280

Adafruit LTR390 UV Light Sensor

Solar Power Manager V5

Solar Panel

Air Quality Sensor

18650 in Holder

Micro USB to Cable (2 Pin)

USB Power

Code Documentation

Main Code

import time
from machine import Pin, SoftI2C, SoftSPI, I2S
from lib import ssd1306, sx127x
import bme280
import ltr390
import ccs811
import network
import array
import math

# --- LoRa Sender Konfiguration ---
device_config = {
    'miso': 19,
    'mosi': 27,
    'ss': 18,
    'sck': 5,
    'dio_0': 26,
    'reset': 14,
    'led': 25,
}

lora_params = {
    'frequency': 86965E4,
    'tx_power_level': 14,
    'signal_bandwidth': 125E3,
    'spreading_factor': 8,
    'coding_rate': 5,
    'preamble_length': 8,
    'implicit_header': False,
    'sync_word': 0x12,
    'enable_CRC': False,
    'invert_IQ': False,
}

device_spi = SoftSPI(
    baudrate=10000000,
    polarity=0, phase=0, bits=8, firstbit=SoftSPI.MSB,
    sck=Pin(device_config['sck'], Pin.OUT, Pin.PULL_DOWN),
    mosi=Pin(device_config['mosi'], Pin.OUT, Pin.PULL_UP),
    miso=Pin(device_config['miso'], Pin.IN, Pin.PULL_UP)
)

lora = sx127x.SX127x(device_spi, pins=device_config, parameters=lora_params)

# --- Sensor Konfiguration ---
i2c = SoftI2C(scl=Pin(22), sda=Pin(21))

bme = bme280.BME280(i2c=i2c)
ltr = ltr390.LTR390(i2c)
ccs = ccs811.CCS811(i2c)

# --- Mikrofon I2S Konfiguration ---
mic_sck_pin = Pin(12)
mic_ws_pin = Pin(25)
mic_sd_pin = Pin(32)

audio_in = I2S(
    0,
    sck=mic_sck_pin,
    ws=mic_ws_pin,
    sd=mic_sd_pin,
    mode=I2S.RX,
    bits