Circuit Documentation
Summary
The circuit in question is designed around the ESP8266 NodeMCU microcontroller, which serves as the central processing unit. The circuit includes a variety of sensors: the VL53L0X and VL6180X for distance measurement, the BMP180 for pressure and temperature measurement, and a photodiode for light detection. Power regulation is managed by an AMS1117 3.3V voltage regulator, and the system is powered by a LiPoly Battery (1300mAh). The ESP8266 NodeMCU communicates with the sensors via I2C protocol and GPIO connections.
Component List
ESP8266 NodeMCU
- Microcontroller with WiFi capability.
- Provides GPIO pins for interfacing with sensors and other peripherals.
- Operates at 3.3V logic levels.
XP-G2
- A component with unspecified functionality in this context.
VL6180X
- A time-of-flight distance sensor with integrated ambient light sensing.
- Interfaces with the microcontroller via I2C.
Photodiode
- A light-sensitive component used to detect light levels.
- Consists of an anode and cathode for connection.
BMP180
- A digital barometric pressure sensor.
- Also provides temperature readings.
- Interfaces with the microcontroller via I2C.
VL53L0X
- A time-of-flight distance sensor.
- Interfaces with the microcontroller via I2C.
AMS1117 3.3
- A voltage regulator that outputs a stable 3.3V from a higher voltage input.
- Used to regulate power from the LiPoly battery to the microcontroller and sensors.
LiPoly Battery (1300mAh)
- A rechargeable lithium polymer battery.
- Provides power to the circuit.
Wiring Details
ESP8266 NodeMCU
D1connected to VL53L0Xscl.D2connected to VL53L0Xsda.D3connected to BMP180SCL.D4connected to BMP180SDA.D5andD6connected to VL6180X (functionality unspecified).3V3connected to VL53L0Xvinand BMP180VCC.GNDconnected to VL53L0Xgnd, BMP180GND, and AMS1117 3.3GND.VINconnected to AMS1117 3.3OUT.
XP-G2
- No wiring details provided.
VL6180X
- Connected to ESP8266 NodeMCU
D5andD6(functionality unspecified).
Photodiode
- No wiring details provided.
BMP180
SCLconnected to ESP8266 NodeMCUD3.SDAconnected to ESP8266 NodeMCUD4.GNDconnected to AMS1117 3.3GND.VCCconnected to AMS1117 3.3VIN.
VL53L0X
sclconnected to ESP8266 NodeMCUD1.sdaconnected to ESP8266 NodeMCUD2.gndconnected to ESP8266 NodeMCUGND.vinconnected to ESP8266 NodeMCU3V3.
AMS1117 3.3
VINconnected to LiPoly Batterypositive.OUTconnected to ESP8266 NodeMCUVIN.GNDconnected to LiPoly Batterynegative.
LiPoly Battery (1300mAh)
positiveconnected to AMS1117 3.3VIN.negativeconnected to AMS1117 3.3GND.
Documented Code
ESP8266 NodeMCU Code
#include <Wire.h>
#include <Adafruit_VL53L0X.h>
#include <Adafruit_BMP085.h>
#include <Adafruit_VL6180X.h>
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
Adafruit_BMP085 bmp;
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup() {
Serial.begin(115200);
Wire.begin();
if (!lox.begin()) {
Serial.println(F("Failed to boot VL53L0X"));
while (1);
}
Serial.println(F("VL53L0X ready"));
if (!bmp.begin()) {
Serial.println(F("Failed to boot BMP180"));
while (1);
}
Serial.println(F("BMP180 ready"));
if (!vl.begin()) {
Serial.println(F("Failed to boot VL6180X"));
while (1);
}
Serial.println(F("VL6180X ready"));
}
void loop() {
// VL53L0X Eye Pressure Measurement
VL53L0X_RangingMeasurementData_t measure;
lox.rangingTest(&measure, false);
if (measure.RangeStatus != 4) { // phase failures have incorrect data
float eyePressure = measure.RangeMilliMeter * 0.0075; // Convert to mmHg
Serial.print("Eye Pressure: ");
Serial.print(eyePressure);
Serial.println(" mmHg");
if (eyePressure > 21) {
Serial.println("Status: High");
} else if (eyePressure < 10) {
Serial.println("Status: Low");
} else {
Serial.println("Status: Normal");
}
} else {
Serial.println("VL53L0X Out of range");
}
// BMP180 Pressure and Temperature Measurement
float temperature = bmp.readTemperature();
float pressure = bmp.readPressure() / 100.0F; // Convert to hPa
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" *C");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" hPa");
// VL6180X Distance Measurement
uint8_t range = vl.readRange();
uint8_t status = vl.readRangeStatus();
if (status == VL6180X_ERROR_NONE) {
Serial.print("Distance: ");
Serial.print(range);
Serial.println(" mm");
} else {
Serial.println("VL6180X Out of range");
}
delay(1000); // Wait for 1 second before next measurement
}
VL6180X Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
(Note: The code for the VL6180X microcontroller instance is minimal and does not include any functionality. It may be a placeholder or require further development.)
