Introduction: Arduino + JY-MCU Module + Bluetooth Android Application

This is a simple instructable how to create a working link between Android and Arduino via JY-MCU Module. By the end of this instructable you will be able to control LED with Android Application.

Step 1: Materials

You will need:

  • Arduino (any version is good, I used nano).
  • JY-MCU Module (Purchased on dx.com).
  • An Android Phone with BlueControl application installed.

Step 2: Connect Arduino to JY-MCU

You will need voltage divider to connect JY-MCU RX to Arduino TX. I used a 3 x 10 KOhm Resistors. You can use any combination of resistors as long as you get 3.3 Volts going to RX of JY-MCU Module.

  • Connect Ground of JY-MCU to Ground of Arduino.
  • Connect 5V output of Arduino to Vcc of JY-MCU.
  • Connect JY-MCU TX to Arduino RX.
  • Connect via voltage divider JY-MCU RX to Arduino TX.
  • Connect ground of voltage divider to ground of Arduino.
    • Not using voltage divider will result in damaging the module.

Step 3: Upload the Following Sketch to Arduino

/* Turn an LED on/off based on a command send via BlueTooth
**
** Credit: The following example was used as a reference
** Rui Santos: http://randomnerdtutorials.wordpress.com
*/
int ledPin = 13;  // use the built in LED on pin 13 of the Uno
int state = 0;
int flag = 0;        // make sure that you return the state only once
void setup() {
    // sets the pins as outputs:
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, LOW);
    Serial.begin(9600); // Default connection rate for my BT module
}
void loop() {
    //if some data is sent, read it and save it in the state variable
    if(Serial.available() > 0){
      state = Serial.read();
      flag=0;
    }
    // if the state is 0 the led will turn off
    if (state == '0') {
        digitalWrite(ledPin, LOW);
        if(flag == 0){
          Serial.println("LED: off");
          flag = 1;
        }
    }
    // if the state is 1 the led will turn on
    else if (state == '1') {
        digitalWrite(ledPin, HIGH);
        if(flag == 0){
          Serial.println("LED: on");
          flag = 1;
        }
    }
}

Step 4: Download Android Application

You can download application from Google Play store.

Run the application, search for JY-MCU Module, pair it, and then you will be able to toggle the lights on Arduino.

When connected the light on Bluetooth Module will stop flashing and be constant red.

Here is the source code on GitHub.