

It will take a second or two to connect, it might ask for password. Next check the App for Bluetooth devices and connect to the HC-05/HC-06 from the list. Now power the Arduino and the Bluetooth module should start blinking. Once installed the app you will, Open it and allow it the permission to turn on Bluetooth. The app we will use for this purpose is Arduino Remote LITE app which is available on Playstore. Now that we have a circuit ready and code uploaded, we just need to get an app which will help us toggle the LEDs on and off. The TX and RX pins should not be connected to any other device while uploading codes or you will get errors. NOTE: Before you hit upload, Make sure you remove the Bluetooth Module. You can save this as “.ino” fine and upload to the Arduino Nano. The code is well commented so I don’t think it is necessary to explain it again. If (cmd = LED2_OFF) //If cmd is LED2_OFFĭigitalWrite(LED2, LOW) //LED2 turns OFF
#Arduino bluetooth serial
Serial.println("Command:" + cmd) //Prints command in Serial MonitorĭigitalWrite(LED1, HIGH) //LED1 turns onĭigitalWrite(LED1, LOW) //LED1 turns OFFĭigitalWrite(LED2, HIGH) //LED2 turns ON If(Serial.available()) //Checks if Data is availableĬmd = Serial.readStringUntil('\ n') //Stores Data in 'cmd' until new line *Arduino Code to control 2 LEDs using Smartphone over Bluetooth. Coding:Ĭopy the code from below and open it in IDE. Connect them as shown in the image above and you are good to go.Īlso I have connected 2 LEDs to Pin 7 & Pin 8 of arduino which we will control using Smartphone. To make a voltage divider, all we need are two resistors (1K and 2.2K). So we need a voltage divider so the RX pin receives only 3.3V. Directly connecting these pins can damage the Bluetooth module. That’s cause the module operates on 3.3V logic level and Arduino operates on 5V logic. The WiFi and Bluetooth® connectivity is performed with a module from u-blox, the NINA-W10, a low power chipset operating in the 2.4GHz range. But we cannot connect the RX pin of the Bluetooth module directly to the Arduino. The boards main processor is a low power Arm® Cortex®-M0 32-bit SAMD21, like in the other boards within the Arduino MKR family.
