Posts

Showing posts from October, 2024

2.Light-Controlled LED Using an LDR and Arduino

Image
Light-Controlled LED Using an LDR and Arduino Components Needed: Arduino board LDR (photoresistor) 10kΩ resistor LED 220Ω resistor Breadboard and jumper wires Circuit Connections: LDR Circuit : Connect one leg of the LDR to 5V on the Arduino. Connect the other leg of the LDR to an analog input pin (e.g., A0) and a 10kΩ resistor. Connect the other end of the 10kΩ resistor to GND. LED Circuit : Connect the anode (longer leg) of the LED to a digital pin (e.g., 13). Connect a 220Ω resistor in series with the cathode of the LED, and connect the other end of the resistor to GND. Example Code: C++ Code int ldrPin = A0; // Analog pin for LDR int ledPin = 13 ; // Digital pin for LED int threshold = 500 ; // Threshold value for light level void setup () { pinMode (ledPin, OUTPUT); // Set LED pin as output Serial. begin ( 9600 ); // Start serial communication } void loop () { int ldrValue = analogRead (ldrPin); // Read LDR value Serial. println (ldrValue); ...

1.Using an LDR (Light Dependent Resistor) with Arduino to Measure Light Intensity

Image
 Using an LDR (Light Dependent Resistor) with Arduino to Measure Light Intensity. Components Needed: Arduino board LDR (photoresistor) 10kΩ resistor Breadboard and jumper wires Circuit Connections: LDR : Connect one leg of the LDR to 5V on the Arduino, and the other leg to an analog input pin (e.g., A0). Resistor : Connect a 10kΩ resistor between the LDR leg (that goes to the analog pin) and GND. This forms a voltage divider. Explanation: When light falls on the LDR, its resistance changes, affecting the voltage at the analog pin. The analog pin reads a value between 0 and 1023 depending on the light intensity. Example Code: C++ Code int ldrPin = A0; // Analog pin to which LDR is connected int ldrValue; void setup () { Serial. begin ( 9600 ); // Start the serial communication to view the LDR value } void loop () { ldrValue = analogRead (ldrPin); // Read the LDR value Serial. println (ldrValue); // Print the value to the Serial Monitor delay ( 500 ); // Delay for...

10.Ultrasonic Distance Measurement Display Using I2C LCD with Arduino

Image
 Ultrasonic Distance Measurement Display Using I2C LCD with Arduino Materials Needed: Arduino board (e.g., Uno, Nano) Ultrasonic sensor (HC-SR04) I2C LCD (16x2) Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 on Arduino. ECHO pin → Pin 10 on Arduino. VCC pin → 5V on Arduino. GND pin → GND on Arduino. I2C LCD to Arduino: SDA → A4 on Arduino (for Uno). SCL → A5 on Arduino (for Uno). VCC → 5V on Arduino. GND → GND on Arduino. Procedure: Step 1: Set Up Arduino IDE Make sure the <Adafruit_LiquidCrystal.h> library is installed in your Arduino IDE. Step 2: Write the Code Copy and paste the following code into the Arduino IDE: C++ Code: #include <Wire.h> #include <Adafruit_LiquidCrystal.h> // Ultrasonic sensor pins const int trigPin = 9; const int echoPin = 10; // Set up the LCD for I2C communication Adafruit_LiquidCrystal lcd(0); void setup() {   // Initialize serial communication   Serial.begin(9600); ...

9.Distance Measurement System Using Ultrasonic Sensor and LCD Display with Arduino

Image
  Distance Measurement System Using Ultrasonic Sensor and LCD Display with Arduino                                                                    Circuit Diagram Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) LCD (16x2) with I2C interface Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND LCD to Arduino: RS → Pin 8 E → Pin 7 D4 → Pin 6 D5 → Pin 5 D6 → Pin 4 D7 → Pin 3 Procedure: Connect the Components: Use jumper wires to connect the ultrasonic sensor and the LCD as described above. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code #include <Adafruit_LiquidCrystal.h> // Ultrasonic sensor pins const int trigPin = 9; const int echoPin = 10; // Initializ...

8.Ultrasonic with servo

Ultrasonic with servo Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) Servo motor Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND Servo Motor to Arduino: Signal pin → Pin 11 VCC → 5V GND → GND Procedure: Connect the Components: Use jumper wires to connect the ultrasonic sensor and the servo motor as described above. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code #include <Servo.h> const int trigPin = 9; const int echoPin = 10; const int servoPin = 11; int thresholdDistance = 20;  // Set the distance threshold in centimeters Servo myServo; void setup() {   Serial.begin(9600);  // Start the serial communication at 9600 baud rate   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   myServo.attach(servoPin);   myServo.write(0);  // Set servo to initial position (0 degrees) } void loop(...

7.Ultrasonic DC motor Driver

 Ultrasonic DC motor Driver Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) DC motor (or servo motor) Motor driver (e.g., L298N for a DC motor) External power supply (depending on the motor requirements) Jumper wires Breadboard (optional) Connections for DC Motor: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND Motor Driver to Arduino (using L298N as an example): Connect IN1 on the motor driver to Pin 6 on the Arduino. Connect IN2 on the motor driver to Pin 7 on the Arduino. Connect the motor terminals to OUT1 and OUT2 of the motor driver. Connect 12V external power supply to the motor driver. Connect GND from the motor driver to Arduino GND. Enable pin (ENB) on the motor driver to 5V. Procedure: Connect the Ultrasonic Sensor and Motor: Use jumper wires to connect the ultrasonic sensor, motor driver, and motor as described above. Write the Arduino Code (DC Motor Example): Copy and paste the following code into the Arduin...

6.Ultrasonic with Led and Buzzer

Ultrasonic with Led and Buzzer Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) LED (any color) 220Ω resistor for LED Buzzer Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND LED to Arduino: Connect the anode (longer leg) of the LED to Pin 13 through a 220Ω resistor. Connect the cathode (shorter leg) to GND. Buzzer to Arduino: Connect one terminal of the buzzer to Pin 11. Connect the other terminal to GND. Procedure: Connect the Components: Use jumper wires to connect the ultrasonic sensor, LED, and buzzer as described above. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code const int trigPin = 9; const int echoPin = 10; const int ledPin = 13; const int buzzerPin = 11; int thresholdDistance = 20;  // Set the distance threshold in centimeters void setup() {   Serial.begin(9600);  // Start the serial communication at 9600 baud rat...

5.Ultrasonic Obstacle Detection with Buzzer

 Ultrasonic Obstacle Detection with Buzzer Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) Buzzer Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND Buzzer to Arduino: Connect one terminal of the buzzer to Pin 11. Connect the other terminal to GND. Procedure: Connect the Ultrasonic Sensor and Buzzer: Use jumper wires to connect the ultrasonic sensor as described above. Connect the buzzer to Pin 11 and GND. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code const int trigPin = 9; const int echoPin = 10; const int buzzerPin = 11; int thresholdDistance = 20;  // Set the distance threshold in centimeters void setup() {   Serial.begin(9600);  // Start the serial communication at 9600 baud rate   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   pinMode(buzzerPin, OUTPUT); } void loop() {   long duration; ...

Arduino projects

Arduino projects 1.Ultrasonic sensor  1. Ultrasonic Basic project 2. Ultrasonic With One Led 3. Distance tracker with LCD 4. Obstacle Avoidance Robot 5. Ultrasonic Obstacle Detection with Buzzer 6. Ultrasonic with Led and Buzzer 7. Ultrasonic DC motor Driver 8. Ultrasonic with servo 9. LCD Display with Arduino 10. I2C LCD with Arduino 2.keypad 1. arduino keypad -project 2. ontrolling LEDs with a Keypad and Arduino 3. Controlling a Servo Motor with a Keypad and Arduino 4. Keypad-Controlled Lock System with Servo and I2C LCD Using Arduino 3.ldr 1. Using an LDR (Light Dependent Resistor) with Arduino to Measure Light Intensity. 2. Light-Controlled LED Using an LDR and Arduino 3. Light-Controlled Buzzer Using an LDR and Arduino 4. Light-Controlled Multi-LED System Using an LDR and Arduino 4.Force sensor [FSR] 1. Force Sensor Serial print 2. FSR with led 3. FSR with Buzzer 4. Displaying Weight and Force from an FSR on an I2C LCD using Arduino voltage detection 1. Measuring and Displ...

2.Ultrasonic With One Led

 Ultrasonic With One Led Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) Blue LED 220Ω resistor Jumper wires Breadboard (optional) Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND LED to Arduino: Connect the anode (longer leg) of the blue LED to Pin 13 through a 220Ω resistor. Connect the cathode (shorter leg) to GND. Procedure: Connect the Ultrasonic Sensor and LED: Use jumper wires to connect the ultrasonic sensor as described above. Connect the blue LED to digital Pin 13 using the resistor. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code const int trigPin = 9; const int echoPin = 10; const int ledPin = 13; int thresholdDistance = 20;  // Set the distance threshold in centimeters void setup() {   Serial.begin(9600);  // Start the serial communication at 9600 baud rate   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   pinMode(ledPi...

1.Ultrasonic Basic project

Ultrasonic Basic project Materials Needed: Arduino board Ultrasonic sensor (e.g., HC-SR04) Jumper wires Connections: Ultrasonic Sensor to Arduino: TRIG pin → Pin 9 ECHO pin → Pin 10 VCC pin → 5V GND pin → GND Procedure: Connect the Ultrasonic Sensor: Use the jumper wires to connect the ultrasonic sensor pins as mentioned above. Ensure proper power and ground connections for the sensor to work correctly. Write the Arduino Code: Copy and paste the following code into the Arduino IDE: C++ Code const int trigPin = 9; const int echoPin = 10; void setup() {   Serial.begin(9600);  // Start the serial communication at 9600 baud rate   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT); } void loop() {   long duration;   int distance;   // Send a 10us pulse to trigger the sensor   digitalWrite(trigPin, LOW);   delayMicroseconds(2);   digitalWrite(trigPin, HIGH);   delayMicroseconds(10);   digitalWrite(trigPin, LOW);   // Measure t...