How To Control LED With Android phone

In this Arduino project, you will learn how to turn on or off LED with your android phone via Bluetooth.

Photo by Sten Ritterfeld on Unsplash

COMPONENTS USED IN THE PROJECT
1-Arduino Uno
2-HC-5 Bluetooth module
3-LED x 2
4-Jumper Wires

SOFTWARE
download the Bluetooth controlled app from the google app play store using the link https://play.google.com/store/apps/details?id=gr.fundroid3000.bluetootharduino&hl=en&gl=US

DIAGRAM

Magtech Dihub

STEP 1: connect the Bluetooth module to the Arduino.

Magtech Dihub

1-connect RX of Bluetooth module to the TX of the Arduino.
2-connect TX of Bluetooth module to the RX of the Arduino.
3-connect GND of Bluetooth module to the GND of the Arduino.
4-connect VCC of Bluetooth module to the 5v of the Arduino.

STEP 2: connect LED to the Arduino.

Magtech Dihub

place your two LEDs into the breadboard, connect the positive terminal of one of the LEDs to pin 5, and the other terminal to pin 6 of the Arduino Uno, also connect the negative terminals of the LED’s to the GND of the Arduino.

STEP 3: upload the code in Arduino IDE
now, write and upload this code in the Arduino IDE

int pin1=5;
int pin2=6;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pin1,OUTPUT);
pinMode(pin2,OUTPUT);
}
char data;

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0){
data=Serial.read();

if (data=='a'){
digitalWrite(pin1,HIGH);
}
else if (data=='1'){
digitalWrite(pin1,LOW);
}
else if (data=='b'){
digitalWrite(pin2,HIGH);
}
else if (data=='2'){
digitalWrite(pin2,LOW);
}
}
}

or download the source code from the Github repo https://github.com/alaminmagaga/Arduino-LED-Source-code

warning:
disconnect the Bluetooth module from the Arduino before uploading the code.

Video Demonstration

https://www.youtube.com/watch?v=8ZLVHrCddB4&t=44s

--

--

--

Data Scientist |Full stack developer |AI/ML Researcher | @AngelHack student ambassador |Robotics and IOT |founder @Magtech_Dihub | pythonista

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A spiritual teacher of mine told me that those who are in the service of a sick person are in God’s

Magento Open Source vs Adobe Commerce: What Should You Choose

Output Echo And Printf

Automate Build & Deploy for React production build with gitlab-ci to Linux base server (AWS)

Ultra chooses Cudo as core technology for its Ultra Miner application.

Troubleshooting System Performance Issues — CPU Load Issues

eCXD elearnSecurity certification review

Factory Pattern with an easy example

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alamin Musa Magaga

Alamin Musa Magaga

Data Scientist |Full stack developer |AI/ML Researcher | @AngelHack student ambassador |Robotics and IOT |founder @Magtech_Dihub | pythonista

More from Medium

CS371g Spring 2022: Yash Patil

CS373 Spring 2022: Sumedh Chilak

CS373 Spring 2022: Sabeer Shahzad Week 5