Today's Deals (in


led - Arduino + Android : Communicate with a JY-MCU Module
  • komfushee

    I am trying to turn ON and OFF a LED with my Android Device through a Bluetooth module (JY-MCU V1.05), I can connect to the module with the key "1234", but when I send a command to the module through the "Bluetooth Terminal" app, there is no respond, no action from the LED.

    Here is my installation:

    enter image description here

    Here is the Arduino code:

    char val;         
    int ledpin = 13;  
    void setup()
      pinMode(ledpin = 13, OUTPUT);       
    void loop() {
      if( Serial.available() )            
      val =;                
      if( val == '0' )                    
        digitalWrite(ledpin, LOW);        
        Serial.println("13 off");         
    if( val == '1' )                      
        digitalWrite(ledpin = 13, HIGH);  
        Serial.println("13 on");          

    (Also tried with a serial of 9600)

    Any idea why I can't communicate with the Arduino ?

  •  Answers:

  • PeterJ

    A few problems that I can see are:

    • The JY-MCU appears to be a 3.3V device and you have it connected to VIN which is 5V. Try connecting to the 3V3 line although be aware this will be available only when running from USB power because it's supplied by the FTDI USB chip.

    • Before doing that though I've found references to it not having 5V tolerant serial lines and found a recommendation to use a voltage divider by connecting a 2.2k resistor to ground from the TX line on the Ardunio and a 1k in series between the TX line on the Arduino and the RX line on the module. That was part of a Success Using the JY-MCU (linvor) Bluetooth Module Instructable that you might like to read as well.

    • The default speed appears to be 9600 BPS so stick with that at the moment.

    And a few recommendations that are not likely to be your problem but worth changing:

    • You don't have a current limit resistor in series with your LED. See the question Correct formula for LED current-limiting resistor?

    • Only leave ledpin = 13 near the top line where it is declared, remove it from the calls to digitalWrite. It won't make a functional difference it's just a good habit because at the moment if you change the pin you'll have to do it in several spots when not necessary and may forget to.

  • dawnoflife

    Do you have the USB plugged into the arduino? I believe (at least with the Uno), pins 0 and 1 are blocked when the USB is plugged in, so I used the SoftSerial library to use any other Digital I/O pins as the Rx and Tx.