Introduction: Arduino DIY Bluetooth Controller LED RGB Strip
Hello everybody, this is the second project I want to share with you!
Today I will show you how to connect Arduino and Bluetooth module and later use it to control a LED RGB Strip.
In this tutorial we will use HC-06 Bluetooth Module, because it is cheap and easy-to-use. (I got mine for 2$ from aliexpress)
The Bluetooth module we will use today is HC-06 which is well-known and cheap. (I got mine for 2€ from aliexpress)
Our app is still in testing process, so we encourage you to send an email to: email@example.com if you have any technical problems or you experienced some troubles. Thank you a lot for understanding!
We will need these parts:
- 1x Arduino Board (I will be using Arduino NANO)
- 1x Bluetooth Module HC-06 or HC-05
- 1x 12V Meter-long of RGB LED Strip (I am using 30LEDs/m with common Anode)
- 1x Terminal Screw
- 3x 220Ω Resistor
- 3x BUZ11 N-Channel Power MOSFET (or equivalent)
- Breadboard and jumpers
- (Optional) DC Jack and DC Connector
- And of course 12V Power supply, I am using variable power supply
Step 2: Connections and Schematic
The circuit is not as complicated as it may seem at first glance.
First, we need to determine if our LED Strip has Common Anode or Common Cathode. Mine has common Anode, so I connected the LED Strip's anode to the 12V Power Supply and the rest to screw terminals, which we will connect to the MOSFET's output later.
All the important connections and schematic is/are shown in the pictures above.
Be very careful when connecting 12V+ rail into VIN to Arduino board, because you can burn the board if you connect it false. Also, don't forget to ground (GND) everything.
Step 3: Arduino Code and Serial Communication
Upload the following sketch to the Arduino using a USB cable.
Don't forget to disconnect HC-06 module before uploading the sketch!
Why? HC-06's Communication pins (RX and TX) are blocking communication between Arduino and Computer.
- First, we declared few constants (constant, which can't be changed later on) for all three colors (red, green, blue)
- In setup() we started Serial communication with 9600 baud rate and set all led pins as an OUTPUT
- In loop() if the Serial receives something it parses the received data as Integer (Important in next step)
- If it receives newline character ('\n'), it firstly constrains values to range 0-255, because of the PWM range and then commits changes to digital pins with analogWrite() method
That's it! We are ready now for the final step!
Step 4: Connect Arduino to Android Device
Now download the following app: Smart Bluetooth - Arduino Bluetooth Serial ⚡
Smart Bluetooth is an app that allows you to use your phone to communicate
with your Bluetooth module or board, with the easiest and simplest way. It opens door to unlimited ways to control your DIY projects. Smart Bluetooth offers many different ways how to send data to your module.
Smart Bluetooth has the following features:
- Fast connection to your module
- Send and receive data from your module
- Control receiver’s digital and PWM pins
- Dark and Light themeDifferent control layouts for different purposes
- Modern and responsive UI
- Customizable buttons and switches
- Implement your DIY RC Car project with a beautiful gamepad
- Easily control your RGB Led strips with sliders
- Automatically turns off Bluetooth when closed to save battery life
- Command line (terminal)
In this tutorial, we are using the second TAB with big led, just sufficient enough to send two characters.
In these following pictures I will show you how to use the app. I will show you how to search for nearby devices, how to pair with the module we are using, and how to set up the data sent from the app. If you feel confused, pause and go back to previous steps until you get it working. However, if you still have problems let me know firstname.lastname@example.org, I will respond within 24h hours :)
- Open the app, slide through the intro, hit SEARCH button and search for nearby devices
- When your device is found, select it by clicking on it
- Select your prefered theme (dark or light) and hold the button you selected
- Wait for the connection, if it fails, try to reconnect
- After successful connection, choose the second TAB by clicking on it, and drag the sliders and check whether the led strip does change colours or not.
- If everything works and you are happy with this project, please leave a nice feedback and rating for my app, this will help with further development and tutorial :)
Don't forget to rate and leave a nice feedback. Thanks and see you at next tutorial :)
Please support my Robotic Arm project here:
Question 1 year ago on Step 4
Hi, Can we program for the lights with effects??
And can we program for the same LED strip with differnet colors as well??