Arduino MKR WiFi 1010 Multi-Sensor Environmental Monitoring System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed using an Arduino MKR WiFi 1010 microcontroller. The circuit includes various sensors such as a water level sensor, gas sensor, light sensor, steam sensor, and a DHT11 temperature and humidity sensor. Additionally, a rotary encoder is used for user input. The Arduino reads data from these sensors and outputs the readings via serial communication.
Component List
Arduino MKR WiFi 1010
- Description: A microcontroller board based on the SAMD21 Cortex-M0+ 32-bit ARM processor with built-in WiFi.
- Pins: A0, A1, A2, A3, A4, A5, A6, D0, D1, D2, D3, D4, D5, D6, D7, MOSI, SCK, MISO, SDA, SCL, RX, TX, RESET, GND, VCC, VIN, 5V
Water Level Sensor
- Description: A sensor used to measure the level of water.
- Pins: SIG, VCC, GND
MKE-S08 MQ-2 Sensor
- Description: A gas sensor used to detect gas levels.
- Pins: GND, 5V, SIG
TEMT6000
- Description: A light sensor used to measure ambient light levels.
- Pins: Signal, GND, 5V
Steam Sensor
- Description: A sensor used to detect steam levels.
- Pins: S, 5V, GND
KY-015 DHT11
- Description: A temperature and humidity sensor.
- Pins: 5V, S, GND
Rotary Encoder
- Description: A device used to measure the rotation angle and direction.
- Pins: clk, dt, sw, gnd, +
Wiring Details
Arduino MKR WiFi 1010
- 5V: Connected to 5V pins of KY-015 DHT11, Rotary Encoder, Steam Sensor, TEMT6000, MKE-S08 MQ-2 Sensor, and VCC pin of Water Level Sensor.
- GND: Connected to GND pins of Rotary Encoder, KY-015 DHT11, Steam Sensor, TEMT6000, MKE-S08 MQ-2 Sensor, and Water Level Sensor.
- A0: Connected to SIG pin of Water Level Sensor.
- A1: Connected to SIG pin of MKE-S08 MQ-2 Sensor.
- A2: Connected to Signal pin of TEMT6000.
- A3: Connected to S pin of Steam Sensor.
- D4: Connected to S pin of KY-015 DHT11.
- D5: Connected to dt pin of Rotary Encoder.
- D6: Connected to sw pin of Rotary Encoder.
- D7: Connected to clk pin of Rotary Encoder.
Water Level Sensor
- SIG: Connected to A0 pin of Arduino MKR WiFi 1010.
- VCC: Connected to 5V pin of Arduino MKR WiFi 1010.
- GND: Connected to GND pin of Arduino MKR WiFi 1010.
MKE-S08 MQ-2 Sensor
- SIG: Connected to A1 pin of Arduino MKR WiFi 1010.
- 5V: Connected to 5V pin of Arduino MKR WiFi 1010.
- GND: Connected to GND pin of Arduino MKR WiFi 1010.
TEMT6000
- Signal: Connected to A2 pin of Arduino MKR WiFi 1010.
- 5V: Connected to 5V pin of Arduino MKR WiFi 1010.
- GND: Connected to GND pin of Arduino MKR WiFi 1010.
Steam Sensor
- S: Connected to A3 pin of Arduino MKR WiFi 1010.
- 5V: Connected to 5V pin of Arduino MKR WiFi 1010.
- GND: Connected to GND pin of Arduino MKR WiFi 1010.
KY-015 DHT11
- S: Connected to D4 pin of Arduino MKR WiFi 1010.
- 5V: Connected to 5V pin of Arduino MKR WiFi 1010.
- GND: Connected to GND pin of Arduino MKR WiFi 1010.
Rotary Encoder
- dt: Connected to D5 pin of Arduino MKR WiFi 1010.
- sw: Connected to D6 pin of Arduino MKR WiFi 1010.
- clk: Connected to D7 pin of Arduino MKR WiFi 1010.
- +: Connected to 5V pin of Arduino MKR WiFi 1010.
- gnd: Connected to GND pin of Arduino MKR WiFi 1010.
Documented Code
// Pin definitions
const int waterLevelSensorPin = A0;
const int gasSensorPin = A1;
const int lightSensorPin = A2;
const int steamSensorPin = A3;
const int dht11Pin = 4;
const int rotaryEncoderDtPin = 5;
const int rotaryEncoderSwPin = 6;
const int rotaryEncoderClkPin = 7;
// Include necessary libraries
#include <DHT.h>
// DHT11 sensor setup
#define DHTTYPE DHT11
DHT dht(dht11Pin, DHTTYPE);
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize DHT11 sensor
dht.begin();
// Set pin modes
pinMode(waterLevelSensorPin, INPUT);
pinMode(gasSensorPin, INPUT);
pinMode(lightSensorPin, INPUT);
pinMode(steamSensorPin, INPUT);
pinMode(dht11Pin, INPUT);
pinMode(rotaryEncoderDtPin, INPUT);
pinMode(rotaryEncoderSwPin, INPUT);
pinMode(rotaryEncoderClkPin, INPUT);
}
void loop() {
// Read water level sensor
int waterLevel = analogRead(waterLevelSensorPin);
Serial.print("Water Level: ");
Serial.println(waterLevel);
// Read gas sensor
int gasLevel = analogRead(gasSensorPin);
Serial.print("Gas Level: ");
Serial.println(gasLevel);
// Read light sensor
int lightLevel = analogRead(lightSensorPin);
Serial.print("Light Level: ");
Serial.println(lightLevel);
// Read steam sensor
int steamLevel = analogRead(steamSensorPin);
Serial.print("Steam Level: ");
Serial.println(steamLevel);
// Read DHT11 sensor
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" *C");
// Read rotary encoder
int dtValue = digitalRead(rotaryEncoderDtPin);
int swValue = digitalRead(rotaryEncoderSwPin);
int clkValue = digitalRead(rotaryEncoderClkPin);
Serial.print("Rotary Encoder - DT: ");
Serial.print(dtValue);
Serial.print(", SW: ");
Serial.print(swValue);
Serial.print(", CLK: ");
Serial.println(clkValue);
// Delay for a short period before the next loop
delay(1000);
}