Objective
This experiment uses an ambient light and proximity sensor to measure the surrounding light intensity and the proximity of an object.
Required Components
- Ambient Light and Proximity Sensor (e.g., TCS3200)
- Arduino Board (e.g., Arduino Uno)
- Jumper wires
- Breadboard
Working Principle
The TCS3200 sensor detects light intensity and proximity by converting light into frequency, which is then processed by the Arduino.
Circuit Wiring
To connect the TCS3200 sensor to the Arduino, follow the steps below:
- Connect the VCC pin of the TCS3200 sensor to the 5V pin on the Arduino board.
- Connect the GND pin of the sensor to the GND pin on the Arduino.
- Connect the OUT pin of the sensor to a digital pin on the Arduino (e.g., pin 7).
- Connect the S0 and S1 pins to digital pins (e.g., pins 8 and 9) on the Arduino to select the frequency scaling output.
- Connect the S2 and S3 pins to digital pins (e.g., pins 10 and 11) on the Arduino to select the photodiode filter.
- Optionally, if your module has an OE (Output Enable) pin, connect it to GND to enable the output permanently, or to a digital pin if you want to control it via code.
Ensure all connections are tight and double-check for errors before powering up the circuit.
Arduino Code
/*
* Ambient Light and Proximity Measurement
* This code measures light intensity and proximity using the TCS3200 sensor.
*/
int lightPin = A0; // Light sensor connected to analog pin A0
int proxPin = A1; // Proximity sensor connected to analog pin A1
void setup() {
Serial.begin(9600);
}
void loop() {
int lightValue = analogRead(lightPin);
int proxValue = analogRead(proxPin);
Serial.print("Light Intensity: ");
Serial.print(lightValue);
Serial.print(" Proximity: ");
Serial.println(proxValue);
delay(1000);
}
Results
The serial monitor will display the measured light intensity and proximity data.
Applications
- Smart lighting systems
- Automated door openers
- Security and surveillance systems
Conclusion
The TCS3200 sensor is an effective tool for measuring light intensity and proximity, with applications in lighting systems, security, and automation.