For this week’s project, I decided to create a disco ball. I’m fascinated by the way it makes colors shift and scatter across a room, transforming the space. What excites me most is how something so captivating can come from just three simple elements: light, a reflective surface, and rotation.
I will control this smart circuit using the Bluetooth for Arduino app.
Arduino IDE
Bluetooth for Arduino app
Arduino Uno & USB cable
Jumper wires
5v adapter
220 ohm resistor
Servo motor
HC-05 bluetooth module
RGB LED
Breadboard
Wiring diagram on Tinkercad
Input:
GUI buttons on Processing
Action components:
Servo motor
RGB LED
1) connected RGB LED to mini breadboard with 3x 220 ohm resistors.
4) connected servo motor on pin 6, and negative and positive to the rails
2) connected the corresponding, red green and blue wires to pins 9, 10 and 11
5) connected HC-05:
VCC to 5v rail
GND to GND rail
TX to RX
RX to TX
3) connected 5V and GND to make positive and ground rails (brown & white wires)
6) connective negative RGB LED to the GND rail and this is the final circuit
I stated coding by browsing the Arduino Library and testing out 3 codes individually;
Gradient: to change colours in the RGB LED
Blinking: to add another mode to the RGB LED
Sweep: for servo motor
I tested out each code individually and then stared to combine them into one code, adding extra code for the if statements for bluetooth control.
I also tested out the GUI on processing to know how the serial monitor will read each command to insert the proper commands in my code.
Button 1: controls servo - reads 0 & 1
Button 2: controls blinking - reads 2 & 3
Button 3: controls gradient - reads 4 & 5
Bringing in the Servo and RGB LED libraries
variables:
Creates a servo object
A15RGB diode(9, 10, 11); creates the RGB LED object placed in these pins. (taken directly from library)
incomingData stores the command received from the HC-05
void setup:
starts communication with the HC-05 bluetooth module
The servo is attached to pin 6
The RGB LED brightness is set to 100%
___________
void loop:
Checks if Bluetooth sent a character.
Saves that character into incomingData
if conditions:
If command is '0', servo is turned off
If command is '1', servo is turned on and sweeps from 0° to 180° and back
If command is '2' turns blinking off (sets LEDs to 0 brightness)
If command is '3' turns blinking on
If command is '4' turns gradient off
If command is '5' turns gradient on
___________
Full code
Final outcome video
After finishing my wiring and code, I uploaded the sketch to the Arduino and powered it with a 5V adapter instead of the laptop’s USB cable. However, the Bluetooth module didn’t light up or appear as a Bluetooth connection. To troubleshoot, I disconnected all other wires and tested the module on its own, making sure it was connected properly, but it still didn’t work. I watched this video for help: https://www.youtube.com/watch?v=aVhjlN-sy78 (but it did not help :))
Then, I asked my instructor, they suggested I double check my connections or it is probably faulty. I borrowed another module from the lab, and it worked right away.
This experience reminded me of the importance of testing each component individually just as I had done with the RGB LED and servo motor before integrating everything together. It’s a practice I’ll make sure to follow in my final project.
Learning to use Arduino libraries and integrating multiple codes into one.