Bluetooth on Arduino -a Led
Today, I will explain you how to use a bluetooth module HC05 or HC06 very easily. We are only going to learn the basics, with on/off components (those on the digital pins).
I will probably make an Instructable about the analog components (pin A...), when I will finally have figure out how to do it, to complete this one.
What Do You Need?
To achieve this project, you'll need:
- 1 Arduino Uno
- Wires
- 1 Led
- 1 resistor (220 ohm)
- 1 bluetooth module (HC05 or HC06, I will explain the difference later)
- 1 breadboard
- 1 computer
- the USB cable of the arduino
- a smartphone Android with the app "bluetooth RC controller" available on PlayStore
I don't know if the app is available on the AppStore, but you can search for it. If it isn't, go to the last step.
The Circuit
If you know a good app or website to create arduino diagram, I'm waiting for you in the comments!
So as I didn't find one (there wasn't the bluetooth module on tinkercad), I just made a beautiful drawing especially for you!
The bluetooth module:
- RXD→pin 10
- TXD→pin 11
- GND→GND
- VCC→3.3V
The Led:
- Long leg→pin 9
- Short leg→breadboard ground with the resistor
Just use the picture to recreate the circuit.
The App
First, download the app "bluetooth rc controller". Basically, when you press one of the button, it will send a letter to the arduino. You can check the letters in the settings. There is an accelerometer fonction, but we won't use it.
The Program
The program is the main piece to understand how does the bluetooth work.
You'll find all the explanations directly on the program, that you can find on the picture but also join.
If you have any questions don't hesitate to ask them in the comments!
Connect the App and the Arduino
To connect the bluetooth module and the smartphone, go in the app, click the settings button and click "connect to the car". Then click on HC05 (or HC06 if you're using a HC06). The red led on the bluetooth module should now be blinking 2 times, then a blank, then 2 times, etc. The red button on the app should have turn green.
The first time you connect the module, it will ask for a password. The initial password is 1234.
Test
Now that you've connected the bluetooth and put the program in the card, you can test it. Just press the up button to switch on the led and the down button to switch of the led.
Additional Step for Those Who Don't Have the App
If you are not using an android smartphone, maybe you can't download the app.
You can use another app. Search a bluetooth arduino app and check if it work as the app i'm using. It'll probably not send the same message so try to figure out what message it send when you press each button. To do this, you can go in the app settings or test every button with the serial monitor. If you don't know how to print the message in the serial monitor, just ask in the comments.
You can also create your own app using AppInventor by the MIT. I never used it, I just know that there are two parts, one for the design and one for the program. You'll have to search by yourself how it works, sorry.