• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Arduino Bluetooth Remote Control Tutorial : Part I

By Abhishek Ghosh December 2, 2018 11:12 pm Updated on December 2, 2018

Arduino Bluetooth Remote Control Tutorial : Part I

Advertisement

Previously, we discussed how to use Wi-Fi module with Arduino and Arduino 4 channel relay. Making them working togather with smartphone not that easy. Bluetooth is Easier Than Wi-Fi From Programming Aspect To Build Wireless Electrical Switch. Here is Part I of The Arduino Bluetooth Remote Control Tutorial.

There are various bluetooth modules for Arduino including modules supporting BLE. A bluetooth module operates at 2.4GHz short-range radio frequency band. Bluetooth has a range around 30 meters. A commonly used module is HC 05 bluetooth module. HM-10 Bluetooth module supports BLE. The required Android App for the M-10 Bluetooth module is available on Google Play :

Vim
1
https://play.google.com/store/apps/details?id=appinventor.ai_Esdrastlc.BLE_ControPanell&hl=en_US

There is another application named BLE Scanner. Both of them are useful in testing and development.

Advertisement

---

Android 8.0 will not find some HM-10 clone BLE modules when scanning for them out of a a bug in the firmware of those modules. The HM-10 is a tiny 3.3-V BLE Bluetooth 4.0 module based on the TI CC2540/CC2541 Bluetooth SoC. It can be controlled via AT commands, which are sent over the serial UART connection. Most of the latest HM-10 modules, though, are based on the CC2541 chip, with lower power and a shorter range than the former CC2540 version. Cheap clones are cleverly pointed as CC2541, may be CC2540. Their hardware-firmware ombination has some issues (that is a long topic). Original HM-10 manufactured by Jinan Huamao technology Co.) is back version of the chip. Detecting clone is not closest to easy. You will see, original HM-10 itself has many versions :

Vim
1
http://www.jnhuamao.cn/bluetooth.asp

You should try to buy genuine HM-10.

 

Arduino Bluetooth Remote Control : First Wirelessly Control a LED

 

For this purpose, we need :

  1. One HM-10 Bluetooth module
  2. Arduino Uno
  3. Breadboard
  4. Jumpers
  5. One LED
  6. One 220 Ohm resistor

Connect HM-10 bluetooth module with Arduino Uno in this way :

Module’s VCC –> Arduino Uno’s 3.3V or 5V
Module’s GND –> Arduino Uno’s GND
Module’s TX –> Arduino Uno’s digital pin 10
Module’s RX –> Arduino Uno’s digital pin 11

Arduino Bluetooth Remote Control Tutorial

Test serial output with the above setup (without LED) with this sketch :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11);
void setup()
{
mySerial.begin(9600);  
Serial.begin(9600);  
delay(100);
}
void loop()
{
if (Serial.available()>0)
mySerial.write(Serial.read());
if (mySerial.available()>0)
Serial.write(mySerial.read());
}

Install BLE Scanner App on Android mobile phone and scan. You will get the module. Default passcode to pair usually something like 123456789 or 0000000000 (9 zeros) or 111111111 (9 ones). After getting paired, you will get a list of services of the module. The last on the list will be “custom service”. On the custom service menu, there will three icons bearing the letters R (Read), W (Write) and N (Notify). Tap the W icon, type the text and send. The sent text will appear on the serial monitor. In this way, you can print data on LCD display too.

Many of the new readers, users noticed that AT commands used for these devices. AT commands in short is just sending command from the serial terminal.

Next, we will control LED from the Android Smartphone. Arduino already has a led at pin 13, so it is optional to connect the LED on breadboard with pin 13.

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int ledPin = 13;
char read_bt;
 
void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);     // debug on serial port
}
 
void loop() {
  if (Serial.available() > 0) {
 
  read_bt = Serial.read();
  if(read_bt=='A')
   digitalWrite(ledPin, HIGH);  
 
   if(read_bt=='B')
   digitalWrite(ledPin, LOW);  
  }
}

Notice the lines :

Vim
1
2
3
4
5
...
  if(read_bt=='A')
...
   if(read_bt=='B')
...

A and B are custom labels of button on Android mobile. Any Android App for this purpose which supports editing of button name will work with it. We can control it from PC/Mac serial terminal too, this is example code :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <SoftwareSerial.h>
int led = 13;
 
SoftwareSerial Bluetooth(10, 11);
 
void setup() {  
  Serial.begin(9600);
  Bluetooth.begin(9600);
  pinMode(led, OUTPUT);
}
 
void loop() {  
  int command;
  
  if (Bluetooth.available()) {
    command = Bluetooth.read();  
    Serial.println("Input received:");
    if (command != 0)
    {
      Serial.println("0 / ON");
      digitalWrite(led, HIGH);
    }
    else
    {
      Serial.println("1 / OFF");
      digitalWrite(led, LOW);
    }  
  }
}

This is the first part of the guide to get used around controlling DC operated device, like LED. Next guide will be on integrating the relay to control a test AC bulb.

Tagged With 8 channel relay arduino bluetooth control , bluetooth remote for arduino , arduino bluetooth remote control , arduino wireless remote control , bluetooth remote to control Arduino uno , arduino bluetooth part , arduino bluetooth remote , windows 10 remote arduino tutorials , arduino bluetooth controlled laptop , arduino as bluetooth transmitter
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Arduino Bluetooth Remote Control Tutorial : Part I

  • Arduino and LED Bar Display : Circuit Diagram, Code

    Here is a Guide Explaining the Basics, Circuit Diagram, Code on Arduino and LED Bar Display. LED Bar Display is Actually Like Multiple LED.

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

  • Detect Smartwatch With ESP32 on IBM Watson IoT Widget

    In our previous guide, we have shown that we can trigger ESP32 (with Arduino IDE) to send message to IBM Watson IoT in Presence of a Particular Samsung Galaxy Smartwatch. That process involves BLE and WiFi. In our one series of articles on Samsung Smartwatch as Proximity Switch, we triggered a local event, such as […]

  • Samsung Smartwatch as Proximity Switch : Part II

    This second part of the guide (here is the first part) ideally should have the working code matching with the title! But, ESP32 with Arduino IDE is not completely bug-free with BLE. So, instead of directly going to the topic, it will be practical for us to show some basic example codes which the readers […]

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy