Final Project and Review

Final Project and Review

Arduino Mastery

Congratulations!

You've completed the Arduino Fundamentals course! This final lesson combines everything you've learned into a comprehensive project.

What You've Learned

Hardware

  • Arduino board layout and pinout
  • Digital and analog pins
  • Power requirements and connections

Software

  • Arduino IDE installation and use
  • Writing and uploading sketches
  • Using libraries

Input/Output

  • Digital output (LEDs)
  • Digital input (buttons)
  • Analog input (sensors)
  • PWM output

Components

  • Distance sensor (HC-SR04)
  • Servo motors
  • Relay modules

Final Project: Smart Home Controller

Create a comprehensive smart home controller that:

1. Monitors distance and displays on servo 2. Controls LED based on light level 3. Turns on fan based on temperature 4. Can be controlled via buttons

Components Needed

  • Arduino Uno
  • HC-SR04 distance sensor
  • Servo motor
  • Light sensor (LDR)
  • Temperature sensor (TMP36)
  • Relay module
  • LED
  • Push button

Circuit Connection

// Pin Definitions
const int trigPin = 9;
const int echoPin = 10;
const int servoPin = 6;
const int ldrPin = A0;
const int tempPin = A1;
const int relayPin = 7;
const int ledPin = 13;
const int buttonPin = 2;

// Include libraries #include <Servo.h>

Servo myServo;

void setup() { // Configure pins pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(servoPin, OUTPUT); pinMode(ledPin, OUTPUT); pinMode(relayPin, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); myServo.attach(servoPin); Serial.begin(9600); }

int getDistance() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); return pulseIn(echoPin, HIGH) / 29 / 2; }

void loop() { // Read distance and control servo int distance = getDistance(); int angle = map(distance, 2, 50, 180, 0); angle = constrain(angle, 0, 180); myServo.write(angle); // Read light level and control LED int lightLevel = analogRead(ldrPin); if (lightLevel < 300) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } // Read temperature and control relay int tempReading = analogRead(tempPin); float voltage = tempReading * 5.0 / 1024.0; float temperature = (voltage - 0.5) * 100; if (temperature > 28) { digitalWrite(relayPin, HIGH); } else { digitalWrite(relayPin, LOW); } // Manual button control if (digitalRead(buttonPin) == LOW) { digitalWrite(ledPin, HIGH); delay(500); } // Debug output Serial.print("Distance: "); Serial.print(distance); Serial.print(" cm, Light: "); Serial.print(lightLevel); Serial.print(", Temp: "); Serial.print(temperature); Serial.println(" C"); delay(200); }

Course Summary

Key Commands

FunctionDescription
pinMode(pin, mode)Set pin as input/output
digitalWrite(pin, value)Set digital output
digitalRead(pin)Read digital input
analogRead(pin)Read analog input
analogWrite(pin, value)PWM output
delay(ms)Pause execution
pulseIn(pin, value)Measure pulse duration

Libraries

LibraryUse
Servo.hControl servo motors
LiquidCrystal.hLCD displays
Wire.hI2C communication
SPI.hSPI communication

What's Next?

Continue Your Arduino Journey

1. Advanced Sensors - GPS, RFID, fingerprint sensors 2. Wireless Communication - WiFi, Bluetooth, LoRa 3. Display Modules - OLED, LCD, TFT screens 4. Motor Control - Stepper motors, motor drivers 5. IoT Projects - Connect to cloud services

Project Ideas

  • Weather station
  • Home automation system
  • Robot car
  • Security system
  • Automated greenhouse

Useful Resources

  • Arduino Official: https://www.arduino.cc
  • Arduino Project Hub: https://create.arduino.cc/projecthub
  • Instructables: https://www.instructables.com

Final Thoughts

You now have the foundation to build amazing projects with Arduino! The skills you've learned apply to countless electronics and IoT projects.

Keep experimenting, stay curious, and never stop building!

---

Congratulations on completing Arduino Fundamentals! 🎉

Quiz - Quiz - Final Project

1. What function is used to map values from one range to another?

2. What does constrain() function do?

3. What is pulseIn() used to measure?

4. What should you always prioritize when working with high voltage?

5. Which function prevents values from going outside a range?