Light intensity sensors are essential components in various applications, such as automatic lighting systems, photography, and environmental monitoring. These sensors detect the amount of light in the environment and provide data that can be used to adjust lighting or trigger other responses. In this project, we’ll guide you through creating a simple light intensity sensor using TinkerCAD. This project is ideal for learning about analog sensors, microcontroller inputs, and basic data visualization using LEDs.
Components Required for Light Intensity Sensor using TinkerCAD
To build this project in TinkerCAD, you’ll need the following components:
Breadboard (Small)
3 LEDs (to represent different light levels)
Building the Light Intensity Sensor Project
Step 1: Setting Up the Breadboard and Arduino
Open TinkerCAD: Log in to your TinkerCAD account and navigate to the "Circuits" section.
Create a New Circuit: Click "Create new Circuit" to open the workspace where you’ll build the light intensity sensor.
Place the Breadboard and Arduino: Drag a small breadboard and an Arduino Uno R3 onto the workspace. Position them next to each other for easy wiring.
Step 2: Connecting the Photoresistor (LDR)
Place the LDR: Drag a photoresistor onto the breadboard. A photoresistor changes its resistance based on the amount of light it receives, with resistance decreasing as light intensity increases.
Create a Voltage Divider: Connect one terminal of the LDR to the 5V rail on the breadboard. Connect the other terminal to both an empty row on the breadboard and one end of a 10k-ohm resistor.
Connect the Resistor: Connect the other end of the 10k-ohm resistor to the ground (GND) rail. The point between the LDR and the resistor forms a voltage divider, which is connected to the analog input pin A0 on the Arduino.
Analog Output Connection: Use a jumper wire to connect the row between the LDR and the resistor to the analog input pin A0 on the Arduino.
Step 3: Connecting the LEDs for Visual Indication
Place the LEDs: Place three LEDs on the breadboard, representing different light intensity levels (low, medium, high). Connect the longer leg (anode) of each LED to an empty row, and the shorter leg (cathode) to the ground rail.
Add Resistors: Connect a 220-ohm resistor in series with each LED’s anode. Connect the other end of each resistor to digital pins 8, 9, and 10 on the Arduino, respectively.
Connect Ground: Use a jumper wire to connect the ground (GND) rail of the breadboard to one of the GND pins on the Arduino.
Step 4: Writing the Code
Open the Code Editor: Click on the "Code" button at the top right of the TinkerCAD interface to open the code editor.
Choose Text-Based Coding: Switch to "Text" mode to write code in Arduino’s C/C++ language.
Write the Code:
int sensorPin = A0; // LDR sensor connected to A0
int ledPin1 = 8; // LED 1 connected to pin 8 (low level)
int ledPin2 = 9; // LED 2 connected to pin 9 (medium level)
int ledPin3 = 10; // LED 3 connected to pin 10 (high level)
int sensorValue = 0; // Variable to store sensor value
void setup() {
pinMode(ledPin1, OUTPUT); // Set LED pins as outputs
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
Serial.begin(9600); // Start serial communication for debugging
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the LDR sensor value
// Print the sensor value to the Serial Monitor
Serial.print("Light Intensity: ");
Serial.println(sensorValue);
// Turn on LEDs based on light intensity
if (sensorValue < 200) {
digitalWrite(ledPin1, HIGH); // Low light level
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
} else if (sensorValue < 500) {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH); // Medium light level
digitalWrite(ledPin3, LOW);
} else {
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, HIGH); // High light level
}
delay(100); // Short delay before next reading
}
This code reads the light intensity from the photoresistor and lights up different LEDs based on the amount of light detected. The sensor value is also printed to the Serial Monitor for real-time monitoring.
Step 5: Simulating the Circuit
Start Simulation: Click on the "Start Simulation" button to test your light intensity sensor. In the Serial Monitor, you can see the real-time light intensity levels. As the light changes, different combinations of LEDs will light up to indicate low, medium, or high light levels.
Testing Light Levels: You can simulate different light levels by adjusting the light in your environment or manually adjusting the sensor value in the Serial Monitor to see how the LEDs respond.
Step 6: Interpreting the Results
Light Intensity Levels: The sensor value ranges from 0 to 1023, with higher values indicating more light.
LED Indication: The LEDs provide a visual representation of the light intensity. You can adjust the thresholds in the code to change how sensitive the system is to different light levels.
Troubleshooting Tips
LEDs Not Lighting Up? Double-check your wiring, especially the connections to the Arduino pins and the ground rail. Ensure the LEDs are correctly oriented, with the longer leg connected to the positive side.
Incorrect Sensor Readings? Verify the connections to the photoresistor and ensure that the analog pin is correctly reading the sensor’s output. Adjust the thresholds in the code if needed.
Simulation Issues? Ensure all components are placed correctly in TinkerCAD and that there are no loose or incorrect connections.
Conclusion
Congratulations! You’ve successfully built a simple light intensity sensor using TinkerCAD. This project introduces you to key concepts such as using analog sensors to measure environmental data, processing sensor data with a microcontroller, and displaying results using LEDs. These principles are foundational for creating more advanced projects, such as automatic lighting systems, smart home solutions, and environmental monitoring tools.
TinkerCAD’s user-friendly interface allows you to experiment with different components and configurations, making it a valuable tool for both learning and prototyping.
With this basic setup, you can expand your project by adding more LEDs for finer light level granularity, integrating a display for numerical light intensity readings, or even connecting the system to a cloud platform for remote monitoring.
Happy tinkering!
Order Electronics Projects
Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607
You can -
Order Basic Electronics Projects
Order Embedded Systems Projects
Order IoT Projects
Order FPGA Projects
Order VLSI Projects
Order Image Processing Projects
Order Matlab Projects
Order TinkerCAD Projects
Order Proteus Projects
Click on the button below to fill out the project inquiry form -
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Follow us -
Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.
Comments