0% found this document useful (0 votes)
34 views6 pages

Arduino Projects for Beginners

Uploaded by

asalangsang45
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

Arduino Projects for Beginners

Uploaded by

asalangsang45
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Teresa National High School Robotics Training Sept.

9-10,2024
### **1. Blinking LED**

**Materials:**

- 1 x Arduino Uno

- 1 x LED

- 1 x 220Ω resistor

- Breadboard

- Jumper wires

**Code:**

int ledPin = 13; // LED connected to digital pin 13

void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}

void loop() {
digitalWrite(ledPin, HIGH); // Turn the LED on
delay(1000); // Wait for 1 second
digitalWrite(ledPin, LOW); // Turn the LED off
delay(1000); // Wait for 1 second
}
### **2. Traffic Light Controller**

**Materials:**

- 1 x Arduino Uno

- 1 x Red LED

- 1 x Yellow LED
Teresa National High School Robotics Training Sept.9-10,2024
- 1 x Green LED

- 3 x 220Ω resistors

- Breadboard

- Jumper wires

**Code:**

int redPin = 13;


int yellowPin = 12;
int greenPin = 11;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
digitalWrite(greenPin, HIGH); // Green on
delay(5000); // Wait 5 seconds
digitalWrite(greenPin, LOW); // Green off
digitalWrite(yellowPin, HIGH); // Yellow on
delay(2000); // Wait 2 seconds
digitalWrite(yellowPin, LOW); // Yellow off
digitalWrite(redPin, HIGH); // Red on
delay(5000); // Wait 5 seconds
digitalWrite(redPin, LOW); // Red off
}
Teresa National High School Robotics Training Sept.9-10,2024
### **3. Temperature Sensor**

**Materials:**

- 1 x Arduino Uno

- 1 x LM35 temperature sensor

- Breadboard

- Jumper wires

**Code:**

int tempPin = A0; // Connect LM35 to analog pin A0

void setup() {
[Link](9600); // Start serial communication
}

void loop() {
int tempReading = analogRead(tempPin); // Read sensor value
float voltage = tempReading * (5.0 / 1023.0); // Convert reading to voltage
float temperature = voltage * 100; // Convert voltage to temperature (Celsius)
[Link](temperature); // Print temperature to serial monitor
delay(1000); // Update every 1 second
}

### **4. Ultrasonic Distance Sensor**

**Materials:**

- 1 x Arduino Uno
Teresa National High School Robotics Training Sept.9-10,2024
- 1 x HC-SR04 Ultrasonic Sensor

- Breadboard

- Jumper wires

**Code:**

const int trigPin = 9;


const int echoPin = 10;

void setup() {
[Link](9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}

void loop() {
long duration;
int distance;

digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);


Teresa National High School Robotics Training Sept.9-10,2024
distance = duration * 0.034 / 2; // Convert duration to distance (cm)

[Link]("Distance: ");
[Link](distance);
[Link](" cm");

delay(1000);
}

### **5. Sound Activated Lights**

**Materials:**

- 1 x Arduino Uno

- 1 x Microphone sensor

- 1 x LED

- 1 x 220Ω resistor

- Breadboard

- Jumper wires

**Code:**

int ledPin = 13;


int micPin = A0;
int threshold = 400;

void setup() {
pinMode(ledPin, OUTPUT);
[Link](9600);
Teresa National High School Robotics Training Sept.9-10,2024
}

void loop() {
int soundLevel = analogRead(micPin); // Read microphone input
[Link](soundLevel);

if (soundLevel > threshold) {


digitalWrite(ledPin, HIGH); // Turn LED on if sound exceeds threshold
} else {
digitalWrite(ledPin, LOW); // Turn LED off if sound is below threshold
}
delay(100);
}

Each project includes simple components and foundational Arduino concepts. With explanations of code and
components, these projects will make a great start for beginners!

Common questions

Powered by AI

In the Ultrasonic Distance Sensor project, the approach to reading and processing sensor data involves using digital I/O pins to send a trigger pulse and receive an echo pulse. The time duration of the echo is captured and converted into a distance measurement. Serial communication plays a critical role here by providing the means for debugging and displaying output data. The Serial.begin function initializes communication, and Serial.print functions are used to send the calculated distance to the serial monitor in a human-readable format. This allows users to observe real-time distance data, essential for verifying correct sensor operation and understanding how the hardware interacts with its environment .

An ultrasonic sensor measures distance by sending out an ultrasonic pulse via a trigger pin (trigPin) and receiving the echo on an echo pin (echoPin). The Arduino code generates a short pulse to trigger the ultrasonic burst. By measuring the time it takes for the pulse to travel to an object and back (captured as pulse width using the pulseIn function), the distance is calculated. The calculation uses the speed of sound (approximately 0.034 cm/microsecond) and divides by two to account for the round trip of the pulse. This process translates the duration into a readable distance measurement in centimeters .

Resistors in the Blinking LED project are significant as they limit the current flowing through the LED, protecting it from damage due to excess current. Without the 220Ω resistor, the LED could draw too much current from the Arduino Uno pin, potentially burning out the LED or damaging the Arduino. This resistor ensures a safe current level, maintaining the circuit's functionality and the component's longevity .

Engaging students in Arduino-based projects offers numerous educational benefits. These hands-on activities enhance learning in STEM fields by allowing students to apply theoretical knowledge in practical scenarios. Students gain proficiency in coding as they write and debug programs that interact with hardware, reinforcing programming concepts. The integration of various sensors and actuators supports creativity and problem-solving skills, as students design and implement their own projects. Moreover, these experiences can foster teamwork and collaboration when projects are conducted in groups, as well as critical thinking skills, by requiring students to troubleshoot and optimize their designs .

Breadboards facilitate prototyping in Arduino projects by providing a solderless platform for assembling circuits. Components such as resistors, LEDs, and sensors can be easily inserted and rearranged on the breadboard, allowing for quick modifications and experiments without permanent connections. This flexibility is important for beginners because it alleviates the risk of making irreversible mistakes, encourages exploring different configurations, and supports iterative development. By using breadboards, learners can focus on understanding circuit design principles and experiment with different setups without the need for specialized tools or skills like soldering .

Arduino code enables the integration of hardware components by providing a programmable interface through which various sensors and actuators can be connected and controlled. In the Teresa National High School Robotics Training exercise, the Arduino platform is used to manage inputs from sensors such as temperature sensors or ultrasonic sensors, and to output control signals to devices such as LEDs or motors. The code includes setup functions to initialize each component (e.g., setting pins as inputs or outputs) and loop functions for continuous monitoring and actuation, showcasing how fundamental coding constructs like loops and conditionals can manipulate and interact with the physical world in a structured, educational manner .

The traffic light controller code uses timing to simulate real-world traffic light changes by turning on and off LEDs connected to different digital pins at specified intervals. It uses three digital pins connected to a red, yellow, and green LED, each with its own resistor. Each LED is turned on or off using the digitalWrite function. The loop function cycles through the sequence by holding each light state for a specific time using the delay function: green for 5 seconds, yellow for 2 seconds, and red for 5 seconds .

The LM35 temperature sensor's function is to measure ambient temperature, providing an output proportional to the received temperature in Celsius. In the project setup, the sensor is connected to an analog pin (A0) to obtain readings. These readings are converted to voltage and then to temperature using specific calculations—voltage is obtained by scaling the sensor reading over the analog input range, and temperature is derived by multiplying the voltage by 100 to convert it to Celsius. The temperature is then printed to the serial monitor for display .

The Sound Activated Lights project uses a microphone sensor (connected to an analog pin) to detect sound levels in the environment. The analog input from the microphone is processed continuously, and if the sound level exceeds a predefined threshold (400), the Arduino sets the digital pin connected to the LED to HIGH, turning it on. If the sound level falls below the threshold, the LED is turned off. This setup ensures that the system remains responsive to changing ambient sound conditions by constantly reading the sensor input and adjusting the LED state accordingly, allowing for real-time interaction with the surrounding sound environment .

The algorithm for implementing a traffic light system with an Arduino utilizes a procedural code structure to define and control sequences of light changes. This structure is based on the orderly arrangement of code, beginning with pin initialization in the setup function and followed by a systematic light control sequence in the loop function. The loop function employs a sequence of digitalWrite and delay commands, ensuring each light is turned on or off in a specific order and for specific durations. The structured, step-by-step approach of procedural coding ensures predictability and clarity, making it easier for developers to understand the flow, debug, and make modifications. This methodical sequence simulates the timing characteristics of an actual traffic light .

You might also like