Arduino tutorial: How to control LED from your phone via Bluetooth

Hello. This is my first tutorial on Arduino and I am very excited about this. At this very moment, I realized that I will keep posting on Arduino programming in future, as it is so much fun. There is plenty of room for creativity and coming up with nice ideas and all we need to do is do some research and start creating.

First of all, let me introduce you to the Proteus. Proteus is the best (and in my opinion, the only good) virtual platform for Arduino programming. If you are a beginner and want to learn about Arduino, I suggest you to use Proteus to study. When you get comfortable, you can buy real devices and produce things.

Now, let me provide you with tutorial on setting up the IDE for Arduino. This is the video for setting Arduino IDE on Ubuntu:


Now you want to build your board. On the 13th pin, put your LED’s anode (because 13th pin is predefined for this), and LED’s cathode in 14th pin, which is actually Ground (GND) pin. If you connect your USB now, the LED will blink couple of times. That means it works fine.


Now, regarding the Bluetooth module, this is how you want to have it connected:


Next, you want to download the app for your smartphone. I think most of them work similar, you just need to download app for bluetooth connection between the phone and the Arduino.


In your Arduino IDE, this is the code you want to have:

void setup() {
    // initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
        char data=;
            case 'a':digitalWrite(LED_BUILTIN, HIGH); 
            case 'd':digitalWrite(LED_BUILTIN, LOW); 
            default: break;

I won’t explain the code as I think it is pretty straightforward.

You plug in the Arduino, compile the code, run the application on phone and communicate with Arduino via ‘a’ and ‘d’ .



Share with your friends
Tagged with: