🔍
Artificial Intelligence Cybersecurity Windows Mac Android iPhone Software How-To Guides Reviews Comparisons Productivity Internet Apps Cloud Business Software About Contact

Arduino Projects for Beginners: 10 Ideas with Code

The best way to learn Arduino is by building projects. Each project in this list teaches a new concept: reading sensors, controlling outputs, using libraries, and combining components. Start with project 1 and work your way up.

1. Automatic Night Light

Components: LDR (light-dependent resistor), 10k resistor, LED, 220 ohm resistor. The LDR and 10k resistor form a voltage divider. When it is dark, the LDR resistance increases and the voltage at A0 drops. Below a threshold, turn on the LED. This teaches analog input and threshold logic.

Code: read analogRead(A0). If the value is below 200, digitalWrite(ledPin, HIGH). Otherwise, LOW. Use Serial.println() to find your room's threshold value. Adjust the threshold in code. For bonus points, use PWM to gradually increase LED brightness instead of a sudden on/off.

2. Distance Alarm

Components: HC-SR04 ultrasonic sensor, buzzer, LEDs. The sensor sends a 40kHz ultrasonic pulse and measures how long it takes to bounce back. Use the NewPing library. If an object is closer than 30 cm, activate the buzzer. Under 10 cm, turn on a red LED and make the buzzer beep rapidly.

Code: #include . Create a NewPing object with trigger and echo pins. In loop(), ping_cm() returns distance in cm. If distance < 30, tone(buzzerPin, 1000). If distance < 10, increase beep frequency with shorter delays. This is a simple parking sensor.

3. Temperature and Humidity Monitor

Components: DHT11 sensor, 16x2 LCD display with I2C module. The DHT11 reads temperature and humidity. The I2C LCD display shows values using only two data pins (SDA and SCL). Install the DHT sensor library and LiquidCrystal_I2C library.

Code: #include and #include . Create DHT and LCD objects. In loop(), read dht.readTemperature() and dht.readHumidity(). Display on LCD with lcd.print(). Update every 2 seconds (DHT11 reads at most once per second).

4. Servo Controlled by Potentiometer

Components: Servo motor, potentiometer. The potentiometer provides an analog value from 0 to 1023. Map it to 0-180 degrees for the servo. This teaches analog input, the map() function, and servo control.

Code: #include . myservo.attach(9). int val = analogRead(A0). val = map(val, 0, 1023, 0, 180). myservo.write(val). Turn the knob and the servo shaft follows.

5. Motion-Activated Light

Components: PIR motion sensor, relay module, lamp or LED strip. The PIR sensor detects motion (changes in infrared radiation). When motion is detected, the relay turns on the connected device. This teaches how to use relays for controlling high-power devices safely.

Code: int motion = digitalRead(pirPin). If HIGH, digitalWrite(relayPin, HIGH). Add a timer: turn off after 30 seconds of no motion. Use millis() for non-blocking timing instead of delay().

6. Ultrasonic Theremin

Components: HC-SR04, buzzer. Wave your hand in front of the sensor to change pitch. This combines distance sensing with audio output. It teaches tone generation and frequency mapping.

Code: measure distance with ping_cm(). Map distance (2 to 40 cm) to frequency (100 to 2000 Hz). Use tone(buzzerPin, frequency) with no delay for continuous sound. Update frequency in each loop iteration.

7. RGB LED Color Mixer

Components: RGB LED (common cathode), three 220 ohm resistors, three potentiometers. Each potentiometer controls one color channel (red, green, blue). This teaches PWM and analogWrite on multiple pins simultaneously.

Code: int r = map(analogRead(A0), 0, 1023, 0, 255). Same for g (A1) and b (A2). analogWrite(redPin, r) etc. Combine colors to create any RGB color.

8. Keypad Door Lock

Components: 4x4 matrix keypad, servo motor, LCD display. Enter a 4-digit code on the keypad. If correct, servo unlocks. If wrong 3 times, lock for 30 seconds. This teaches keypad scanning, string comparison, and security timing.

Code: #include . Define the keypad layout and pins. In loop(), read char key = keypad.getKey(). Append to input string. When length is 4, compare with stored password. If match, unlock servo.

9. Weather Station with OLED Display

Components: DHT22 (more accurate than DHT11), OLED 128x64 display (I2C). Show temperature, humidity, and a simple icon (sunny/cloudy). This teaches graphical display output.

Code: #include and #include . Create display object. Use display.clearDisplay(), display.setTextSize(), display.println() to show text. Draw simple shapes for weather icons.

10. Bluetooth Controlled Robot Car

Components: Arduino Uno, L298N motor driver, 2 DC motors with wheels, HC-05 Bluetooth module, battery pack. Control the robot with a smartphone via Bluetooth Serial. This is the capstone project combining motors, Bluetooth communication, and mobile control.

Code: #include . Create Bluetooth serial connection. In loop(), read commands over Bluetooth. 'F' moves forward, 'B' backward, 'L' left, 'R' right, 'S' stop. Control the L298N with digitalWrite on four pins (IN1-IN4) and PWM for speed.