This week, I implemented servo rotation and RGB LED color changes (red, green, blue) based on numbers (1-3) sent via Bluetooth from a phone GUI. Inspired by smart pet feeders and Arduino projects, this improves wireless control and automation for my final project.
Electronics
Arduino UNO
Jumper Wires
Servo motor
Bluetooth Module HC-05
RGB LED
300 ohm Resistor
Breadboard
Wiring on TinkerCad (same wiring on real life ) adjust pins locations as the connections section below ;)
Bluetooth Module Connection
Input Actions :
Bluetooth Signal (from phone GUI: '1', '2', or '3')
Output Actions :
Servo Motor (rotates based on input)
RGB LED (changes color: red for '1', green for '2', blue for '3')
Connections
servo motor
signal --> pin 9
power --> 5V arduino
gnd --> gnd
RGB LED
resistor on each leg except for the cathode
green --> pin 3
blue --> pin 5
red --> pin 6
Bluetooth Module ( i followed the pic above for the resistors wiring )
vcc --> 5V
gnd --> gnd
txd --> Rx pin 0
rxd --> Tx pin 1
Wiring on Breadboard
Arduino Code
Brief Explanation of Code :
1. Setup Phase
- Initializes Bluetooth communication at 9600 baud
- Attaches the servo motor to pin 9
- Sets RGB LED pins (red, green, blue) as outputs.
- Positions the servo at 0° and turns off the LED initially.
2. Main Loop (loop())
- Checks if there is an incoming Bluetooth command.
- Reads and prints the command for debugging.
- Based on the received command (`'1'`, `'2'`, or `'3'`):
- Moves the servo to 90°, waits for 1 second, then resets to 0°
- Changes the RGB LED color:
- `'1'` → Red
- `'2'` → Green
- `'3'` → Blue
3. Functions Used
- moveServo(): Moves the servo to 90° and back to 0°
- setRGB(red, green, blue): Adjusts the RGB LED colors
Purpose
This setup allows Bluetooth-based control of a pet feeder or similar device, with LED feedback for different commands.
Final Outcome Video
When I got stuck, I searched about Bluetooth connection for the resistor wiring since I wasn’t sure how they were connected.
the pic i used is mentioned 🔝