Bluetooth receiver arduino

Bluetooth receiver arduino DEFAULT

64.48% of users selected JBtek HC-05, 11.38% selected DSD TECH HM-10, 2.76% selected ICQUANZX, 14.14% selected HC-05 Arduino and 7.24% selected KOOBOOK. Every month we analyze your answers and change our rating.

Arduino is an open-source hardware platform for electronics. But how does Bluetooth fit? On one hand, there are quite a number of Arduino modules and shields. On the other hand, a small number of producers sell these modules/shields. Also, there are low-cost modules for Arduino boards.

You need a Bluetooth module and a development board to make a robot that communicates wirelessly. Arduino has the most used and cheapest Bluetooth module that has worked great with Arduino’s very short list of standard Bluetooth modules.

Consider getting your next Arduino Bluetooth project going with some of the modules that are reviewed in this guide. The comparison table and tips of buyers are included.

JBtek HC-05 Wireless Bluetooth Host Serial Transceiver Module– the best for beginners!

JBtek HC-05 Wireless Bluetooth Host Serial Transceiver Module Slave and Master RS232 For ArduinoThe JBtek HC-05 wireless Bluetooth model is easy to set up and use. It won’t detect any temperature increases even if the prototype uses a lot of components and wires. Easily it runs the TX/RX pins on 3.3V. The module is fully compatible with Arduino Uno boards.

Check Price

  • Great temperature control;
  • Easy connectivity;
  • Simple to use;
  • Low voltage range (less than 5V);
  • Limited documentation;

The module can understand many AT commands, so it makes it easy to customize the device.


DSD TECH HM-10 Master and Slave Bluetooth 4.0 LE iBeacon Module– the best for Apple devices!

DSD TECH HM-10 Master and Slave Bluetooth 4.0 LE iBeacon Module CompatibleThis DSD Tech HM-10 iBeacon module is compatible with iPads and iPhones via 4 PIN Dupont cables. Through the AT command, you can set this master-and-slave, even in iBeacon way work. It also supports the ANCS (Apple Notification Center Service).

Check Price

  • Great voltage range;
  • 4-pin baseboard;
  • Compatible with many Apple devices;
  • Needs a voltage divider;
  • Some iOS apps may not respond;
  • Doesn’t support any Android OS lower than 3.0;

It is one of the most affordable Bluetooth modules for Arduino boards and iOS-supporting devices.


ICQUANZX T-Display ESP32 WiFi and Bluetooth Module– the best for USB connection!

ICQUANZX T-Display ESP32 WiFi and Bluetooth ModuleThe T-display is large and accessible from all angles. This ESP32 module, which includes a display, is a great deal for such a price. If you solder the headers on the included display, it fits well on a breadboard.

Check Price

  • Good USB connectivity;
  • Budget-friendly;
  • Top-notch LCD IPS display;
  • Doesn’t include battery;
  • LCD drains battery easily;

A solid Bluetooth module for Arduino that also includes a quality LCD display. The modular interface is vast and good for wide application.


HC-05 Arduino Wireless Bluetooth Receiver RF Transceiver Module– the best for transferring data!

HC-05 Arduino Wireless Bluetooth Receiver RF Transceiver ModuleThe HC-05 Bluetooth module sends out the data collected. When Bluetooth is not connected, the LED light flashes. Switch between transmitter and receiver via AT commands. HC-05 is a complete RS232 interface. However, it does not communicate with all iOS devices.

Check Price

  • Easily switch between Transmitter and Receiver modes;
  • Connection status indicator;
  • Bi-direction emulation;
  • Doesn’t fully support iOS;
  • Occasionally resets;

If you need an affordable Bluetooth module for transferring data between Arduino and devices, pick this HC-05 model.


KOOBOOK 2Pcs AT-09 Bluetooth 4.0 Transceiver BLE Module– the best for compatibility!

KOOBOOK 2Pcs AT-09 Bluetooth 4.0 Transceiver BLE Module Serial PortThe KOOBOOK AT-09 module contains a BLE chip to perform great serial communication via TX and RX pins. The module also uses a lot of the HM-10 functionality. This makes it simple to use. This small Bluetooth 4.0 TTL module supports iPhone/iPad, IOS 6, Android 4.3 and above devices to communicate.

Check Price

  • In-built switch function;
  • 5V power port supply;
  • Compatible with iOS and Android;
  • Good serial interface;
  • Results may float;
  • Good only for small projects;

The module will read the data using its serial port interface. Central can integrate data to any connected sensor.


The Buyer’s Guide

First, you need to understand that Bluetooth models for Arduino can be Low Energy (BLE) or Standard (Classic). Depending on this type, you need to consider such things when buying one of such modules:

Board size

The average Arduino board’s scale is 2.7 inches x 2.1 inches and the shields that bind to it are about that size as well. However, if you require a smaller device, some Arduino integrated boards are much shorter and rely on BLE.

You’ll need to look carefully at the compatibility of the boards. They are very different but use many of the same Arduino code and environment.

Output power

Standard Bluetooth boards may often have a higher output capacity than BLE. Many BLE modules output 0dBm to 4dB of maximum power, whilst also Bluetooth modules can also output 10dBm.

When you are measuring on the outside, you can measure at 100 meters. Batteries of Lithium-Ion and Alkaline types will work as long as the voltage is accurate.

Compatibility

Many computers have Bluetooth. You can normally quickly pair the Bluetooth module to your device and see the data being transmitted to the module over UART.

BLE4 is slightly more difficult. People support Windows 8. Operating systems may not support the new feature.

Many Mac computers now have BLE support, and OS X can also connect to Bluetooth devices.

Audio

Bluetooth was developed for audio applications. A few I2S module chips may transmit sound. There is no Bluetooth Low Energy for audio; you will need a Classic Bluetooth module.

Transmission rate

Most Bluetooth modules for Arduino are technically incapable of supporting its full frequency (1 MHz) since Bluetooth focuses on easy connectivity. For instance, E-cigarettes can produce low-energy Bluetooth radio transmissions, but this can be a drain on battery power. When high speed is needed, the EDR’s Bluetooth or Wi-Fi can support higher rates. Any rate increase will require more power consumption.

Video Tutorial: Bluetooth Low Energy Tutorial with HM-10 BLE 4.0 & Arduino

Final thoughts 

If you want to learn Bluetooth, an Arduino module is a hot item. Such modules are useful because they make it easy to build a product without dealing with the low-level issues of constructing Bluetooth products.


Hi! My name is Tom and I’m an author of the blog. My hobby is electronic circuits and soldering irons.

Sours: https://solderingironguide.com/reviews/best-bluetooth-modules-for-arduino/

Interfacing Bluetooth Module (HC-05) with Arduino Uno © GPL3+

Interfacing Bluetooth Module (HC-05) with Arduino Uno

Bluetooth is a one of the great example for wireless connectivity. It is used in many fields. Bluetooth consumes very small amount of energy. Do you know about Smartphone controlled robot or car. Commonly one of these two wireless technology is used in Smartphone controlled robot. One is WIFI and other is Bluetooth. And another commonly used wireless technology for controlling Robot car is RF. Which is the same remote and receiver used in drones. Here we are going to interface a Bluetooth Module (HC-05) with Arduino Uno. And describe each line of code. Then we control the builtin LED of Arduino Uno from smartphone via Bluetooth.

Before starting we must know about the HC-05

HC-05 Bluetooth Module

HC-05 is a Bluetooth module which can communicate in two way. Which means, It is full-duplex. We can use it with most micro controllers. Because it operates Serial Port Protocol (SSP). The module communicate with the help of USART (Universal Synchronous/Asynchronous Receiver/Transmitter ) at the baud rate of 9600. and it also support other baud rate. So we can interface this module with any microcontroller which supports USART. The HC-05 can operate in two modes. One is Data mode and other is AT command mode. When the enable pin is "LOW" the HC-05 is in Data Mode. If that pin set as "HIGH" the module is in AT command mode. Here we operate this module in Data Mode.

Technical Specifications

  • Operating Voltage: 4V to 6V (Typically +5V)
  • Operating Current: 30mA
  • Range: <100m
  • Works with Serial communication (USART) and TTL compatible
  • Can be easily interfaced with Laptop or Mobile phones with Bluetooth

You can see the more about the module in the datasheet.

it's time to start.

Step - 1

First I am going to create a sketch for Arduino Uno to Interface the HC-05

Open Arduino IDE.

Here we make this project without any library. First declare a variable named "inputByte" as char datatype. Alternatively you can use any variable name. Here we use the character to control the LED. And set the initial value of "inputByte" is "z" (it is lowercase). Why it is "z" ? See the String table. It is used to set the initial state of LED as "LOW" ( When turn on the Arduino, Set the LED is off).

Step - 2

Next we need to code the setup part. HC-05 use the serial communication. So begin the serial communication by using the function "Serial.begin()". Set the baud rate as 9600. Then set the digital pin 13 as a "OUTPUT" pin. Because this is the pin which internally connected to the inbuilt LED.

Setup part is completed.

Step - 3

Next I am going to code the loop part. Use a while loop and the function "Serial.available()". This function returns the number of bytes available to read. The body part of while loop works only the "Serial.available()" is greater than 0. Then read the data available in serial port. For that, I use the function "Serial.read()". Then store it to "inputByte". Then use an "if" condition. Make the pin 13 "HIGH" if the "inputByte" is "Z" (upper case).Because the the App will send "z" when the button is in ON mode. This is for turn on the LED. Next I use a "else if" condition to turn off the LED. condition for turn off the LED is "inputByte==z"(lower case). Because the the App will send "Z" when the button is in OFF mode. For more see the String table.

The loop part is completed. You can see the complete code in the code section of this article. Then upload the code to Arduino Uno

Please make sure the Rx and Tx pin of HC-05 remove from Arduino Uno while uploading. Otherwise you may encounter with some problem to upload the code.

Step - 4

Connections

Arduino Uno HC-05

Rx - Tx

Tx - Rx

5v - +5v

GND - GND

Connection is completed. After turn on the Arduino Uno, The indicator LED in the HC-05 will start blinking continuously

App configuration.

Now we need install an App in Smartphone. You can download the app here. After installation Open the app then you can see the string table. Which shows the character corresponding to each button. Click "next" and then click "Finish". Then you can see a scan button. Click that and pair the HC-05 with your phone. You can use the key "1234". After pairing back to App and turn on "Switch 1".

After paring the indicator LED in the HC-05 will stop continuous blinking and blink the same LED with some delay.

"Z" is represent the ON state of Switch 1 and "z" is represent the OFF state of Switch 1. You can see more in String Table.

You can use any application, careful about the string send to HC- 05 and string in the condition statement. The android application used here is not developed by me. I respect the corresponding developer. You can make your own Android app by using MIT App inventor. I strongly recommend for that.

Please don't copy-paste my code. Understand the code and make your own

You can join our telegram group here or search INNOVATION.

STAY HOME, STAY SAFE, STAY CREATIVE. Let break the chain.

Follow me on,

Instagram : five_volt_player

Facebook : Akshay Joseph

Github : akshayjoseph666

Contact : [email protected]

Share your experience and suggestions on the comment box.

Previous articles Automatic Water Tap, Automatic Hand Sanitizer, Interface Ultrasonic sensor with Arduino Uno, Control Servo motor with Arduino Uno and Pushbutton, Control Servo motor with Arduino Uno and POT, Servo Motor Interface with Arduino Uno, IR Controlled Home Appliances With Saving Previous State, Touchless Hand Wash Timer

Sours: https://create.arduino.cc/projecthub/akshayjoseph666/interfacing-bluetooth-module-hc-05-with-arduino-uno-f5209b
  1. Sporcle us history
  2. W3 global reviews
  3. Fall emergent readers
  4. Sensitive asmr
  5. Oem motherboard

This article was last updated on February 2018.

Wireless communications become a key driver of innovation for roboticists. Today, more than ever, you can easily use mobile devices to control and receive data from a robot.

A Bluetooth module and a development board are basically what you need to create a wirelessly communication channel with a robot. Since Arduino is the most used board to send and receive data over Bluetooth, in this post, I explore the best and cheapest Bluetooth modules compatible with this one.

HC-05

The HC-05 Bluetooth module

The HC-05 Bluetooth module

If you watch on YouTube a movie with a Bluetooth-controlled robot, most likely the wireless communication is done with an HC-05 module. The HC-05 module is familiar, cheap (Amazon) and designed for transparent wireless serial connection setup with Bluetooth SPP (Serial Port Protocol).

Another very important aspect, especially if you are at the beginning and want to use a Bluetooth module, you can find on the Internet a whole series of tutorials and guides to introduce you into wireless communication with robots.

This Bluetooth module covers 9 meters (30ft) of signals and works both as a master or as a slave. For example, a robot can be designed to be a master connected to a slave Bluetooth module or as a slave board to make a wireless connection with a PC.

HC-06 RS232 TTL

The HC-06 RS232 TTL module

The HC-06 RS232 TTL module

On the second place after HC-05 is the HC-06 module(Amazon). This is also popular and very simple to set up with an Arduino board.

The module is suitable where wireless data transmission is needed in slave mode. The board can be accessorized with a USB to TTL serial cable to connect to your PC. Like the HC-05, the HC-06 module can reach a range of up to 9 meters (30 ft).

If you need a Bluetooth module to talk to your smartphone and an Arduino board, the HC-06 would work fine. But if you want to talk with another Arduino development board, the HC-05 module is the way to go.

BLE Link Bee
Added on February 2018

BLE Link Bee

BLE Link Bee

The BLE Link Bee is a new entry in the range of Bluetooth modules compatible with the Arduino board. The module supports the master-slave switch. It has a transmission range of up to 60 meters in free space and makes it one of the most powerful Bluetooth modules.

It is a serial to Bluetooth 4.0 module and designed to adopt the compact form of an XBee socket. This is one of the few modules that integrates a voltage regulator that supports both 5V and 3.3V MCUs.

If you plan to use an iOS or Android smartphone to control a robot, you can use the Play Bluno application to start communicating between phone and Arduino immediately.

BLE Mini

The BLE Mini Bluetooth 4.0 Low Energy (BLE) module

The BLE Mini Bluetooth 4.0 Low Energy (BLE) module

If you want to control easily a robot with an iPhone, iPad or iPad mini, or the latest iPod generation, you have to use a BLE Mini board. Also, the module is compatible with any Android devices with BLE hardware.

The Bluetooth module is easy to setup with an Arduino board and has a range of 50 meters (164ft).

You are allowed to develop your own iOS application using the open-source SDK provided by the Red Bear company.

The module includes the Bluetooth 4.0 Low Energy (BLE) technology and requires only a serial port for communication. Like almost any other Bluetooth module, this one is compatible with some of the most popular prototyping boards such as the Arduino, Raspberry Pi, or BeagleBone Black.

BlueSMiRF

The BlueSMiRF and Bluetooth Mate

The BlueSMiRF and Bluetooth Mate

Connecting with other devices through Bluetooth technology does not take much and it is truly simple.

The BlueSMiRF from Sparkfun (Amazon) is one of the Arduino compatible Bluetooth modules that have a transceiver on it. This means that the Bluetooth module can send and receive data from up to 100 meters (328ft).

The BlueSMiRF worked right out of the box and is compatible with other Bluetooth devices that support SPP. The wireless module is perfect for applications that require a distance up to 100 meters (328ft).

JY-MCU

The JY-MCU module

The JY-MCU module

The JY-MCU module (Amazon) can connect devices and robots that generate massive amounts of data. Compatible with any Android device, the Bluetooth module covers a distance of 9 meters (30ft) between the master and slave devices.

Designed for faster connections between an Android device and an Arduino board, the Bluetooth module can be up and running in minutes. In addition, you can find many step-by-step tutorials that show you how to interface the module with the Arduino microcontroller.

ITEAD BT

The ITEAD BT Bluetooth shield

The ITEAD BT Bluetooth shield

The BT Bluetooth module is a stackable shield with serial ports based on the HC-06 module. The shield can be connected directly to the Arduino UART port for wireless communication. Without obstacles or other interference, the Bluetooth shield can communicate in a range of 10 meters (32ft).

Shield Bluetooth with RN-42

The Bluetooth Shield with RN-42

The Bluetooth Shield with RN-42

The RN-42 Bluetooth shield is what you need for any project you would like to use an Arduino microcontroller. But unlike the HC-05 and HC-06, it has a price of 28.00€. The shield is fitted on top of the Arduino board and works in a range of maximum 20 meters(65ft).

Bluefruit EZ-Link

The Bluefruit EZ-Link module

The Bluefruit EZ-Link module

The Bluefruit EZ-Link is a combination of all of the modules described above. With a range of 10 meters (32ft), the Bluetooth module doesn’t need additional software or custom hardware to communicate wirelessly with another Bluetooth system.

The Adafruit module is designed to work on a serial console or using a sort of FTDI-like cable.

Unlike other Bluetooth modules, the EZ-Link is featured with automated detection of the COM port.

Sours: https://www.intorobotics.com/pick-right-bluetooth-module-diy-arduino-project/
Bluetooth Controlled Arduino \

In this Arduino Bluetooth Tutorial we will learn how use the HC-05 module for controlling Arduino via Bluetooth communication. You can watch the following video or read the written tutorial below for more details.

Overview

For this tutorial I made two example, controlling the Arduino using a smartphone and controlling the Arduino using a laptop or a PC. In order not to overload this tutorial, in my next tutorial we will learn how we can configure the HC-05 Bluetooth module and make a Bluetooth communication between two separate Arduino Boards as master and slave devices.

HC 05 Bluetooth Module

Before we start with the first example, controlling an Arduino using a smartphone, let’s take a closer look at the HC-05 Bluetooth module. Comparing it to the HC-06 module, which can only be set as a Slave, the HC-05 can be set as Master as well which enables making a communication between two separate Arduino Boards. There are several different versions of this this module but I recommend the one that comes on a breakout board because in that way it’s much easier to be connected. The HC-05 module is a Bluetooth SPP (Serial Port Protocol) module, which means it communicates with the Arduino via the Serial Communication.

You can get the components needed for this Arduino tutorial from any of the sites below:

Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.

Circuit Schematics


Here’s how we need to connect the module to the Arduino Board.

Arduino and HC 05 Bluetooth Module Circuit Schematics - Arduino Bluetooth Tutorial

The particular module that I have can be powered from 3.6 to 6 volts, because it comes on breakout board which contains a voltage regulator. However, the logic voltage level of the data pins is 3.3V. So, the line between the Arduino TX (Transmit Pin, which has 5V output) and the Bluetooth module RX (Receive Pin, which supports only 3.3V) needs to be connected through a voltage divider in order not to burn the module. On the other hand, the line between the Bluetooth module TX pin and the Arduino RX pin can be connected directly because the 3.3V signal from the Bluetooth module is enough to be accepted as a high logic at the Arduino Board.

Arduino Bluetooth Communication Example Source Code

So, now we are ready to make the Arduino code for enabling the communication between the Arduino board and the smartphone. We will make a simple example, just turning on and off a LED but it will be good enough for understanding the communication.

#define ledPin 7 int state = 0; void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); Serial.begin(38400); // Default communication rate of the Bluetooth module } void loop() { if(Serial.available() > 0){ // Checks whether data is comming from the serial port state = Serial.read(); // Reads the data from the serial port } if (state == '0') { digitalWrite(ledPin, LOW); // Turn LED OFF Serial.println("LED: OFF"); // Send back, to the phone, the String "LED: ON" state = 0; } else if (state == '1') { digitalWrite(ledPin, HIGH); Serial.println("LED: ON");; state = 0; } }

Description: First we need to define the pin to which our LED will be connected and a variable in which we will store the data coming from the smartphone. In the setup section we need to define the LED pin as output and set it low right away. As mention previously, we will use the serial communication so we need to begin the serial communication at 38400 baud rate, which is the default baud rate of the Bluetooth module. In the loop section with the Serial.available() function we will check whether there is available data in the serial port to be read. This means that when we will send data to the Bluetooth module this statement will be true so then using the Serial.read() function we will read that data and put it into the “state” variable. So if the Arduino receive the character ‘0’ it will turn the LED off and using the Serial.println() function it will send back to the smartphone, via the serial port, the String “LED: OFF”. Additionally we will reset the “state” variable to 0 so that the two above lines will be executed only once. Note here that the “state” variable is integer, so when we receive the character ‘0’ that comes from smartphone, the actual value of the integer “state” variable is 48, which corresponds to character ‘0’, according to the ASCII table.. That’s why in the “if” statement we are comparing the “state” variable to a character ‘0’. On the other hand, if the received character is ‘1’, the LED will light up and the String “LED: ON” will be sent back.

Now the code is ready to be uploaded but in order to do that we need to unplug the TX and RX lines because when uploading the Arduino uses the serial communication so the pins RX (digital pin 0) and TX (digital pin1) are busy. We can avoid this step if we use the other TX and RX pins of the Arduino Board, but in that case we will have to use the SoftwareSerial.h library for the serial communication.

Related: How To Configure and Pair Two HC-05 Bluetooth Modules as Master and Slave | AT Commands

Connecting the Smartphone to the HC-05 Bluetooth Module and the Arduino

Now we are ready to connect the smartphone to the Bluetooth module and the Arduino. What we need to do here is to activate the Bluetooth and the smartphone will find the HC-05 Bluetooth module.

Smartphone Bluetooth Settings

Then we need to pair the devices and the default password of the HC-05 module is 1234. After we have paired the devices we need an application for controlling the Arduino. There are many application in the Play Store for this purpose which will work with the Arduino code that we wrote. However, I made my own custom application for this tutorial using the MIT App Inventor online application. This is a great and easy to use application for building Android application and in my next tutorial you can find a detailed step by step guide how to build your own custom Android application for your Arduino Project.

Arduino and Android Bluetooth App

You can download the app that I made for this example here:

With the connect button we will connect the smartphone to the Bluetooth module and the status text below the button will tell us whether we have successfully connected. Using the “Turn ON” and “Turn OFF” buttons we can turn on and off the LED. The text above the buttons is the one that the Arduino is sending back to the smartphone when a particular button is pressed.

Controlling Arduino Using a Laptop or PC via Bluetooth Communication

Let’s see how we can control the Arduino via Bluetooth using a Laptop or a PC. So, first we need to pair our laptop to the HC-05 Bluetooth module and we can do that from the Laptop Bluetooth Settings. The laptop will discover the HC-05 module and using the ‘1234’ password we will pair the devices.

Arduino and HC-05 Bluetooth Module - Laptop Settings 1

Once we will pair the devices in the Laptop Device Manager, under Ports (COM & LPT), two new entities will appear named “Standard Serial over Bluetooth link”. From here we can see the COM Port number of the serial port through which the devices will communicate.

Arduino and HC-05 Bluetooth Module - Laptop Settings 2

We will stick with the same example as previously, turning on and off a LED and sending back a string to the laptop, so we will use the same Arduino code as previously described.

Processing IDE Source Code

Now using the Processing IDE we will make a program for controlling the Arduino. Here’s the source code.

import processing.serial.*; Serial myPort; String ledStatus="LED: OFF"; void setup(){ size(450, 500); myPort = new Serial(this, "COM5", 38400); // Starts the serial communication myPort.bufferUntil('\n'); // Defines up to which character the data from the serial port will be read. The character '\n' or 'New Line' } void serialEvent (Serial myPort){ // Checks for available data in the Serial Port ledStatus = myPort.readStringUntil('\n'); //Reads the data sent from the Arduino (the String "LED: OFF/ON) and it puts into the "ledStatus" variable } void draw(){ background(237, 240, 241); fill(20, 160, 133); // Green Color stroke(33); strokeWeight(1); rect(50, 100, 150, 50, 10); // Turn ON Button rect(250, 100, 150, 50, 10); // Turn OFF Button fill(255); textSize(32); text("Turn ON",60, 135); text("Turn OFF", 255, 135); textSize(24); fill(33); text("Status:", 180, 200); textSize(30); textSize(16); text("Program made by Dejan Nedelkovski,\n www.HowToMechatronics.com", 80, 320); text(ledStatus, 155, 240); // Prints the string comming from the Arduino // If the button "Turn ON" is pressed if(mousePressed && mouseX>50 && mouseX<200 && mouseY>100 && mouseY<150){ myPort.write('1'); // Sends the character '1' and that will turn on the LED // Highlighs the buttons in red color when pressed stroke(255,0,0); strokeWeight(2); noFill(); rect(50, 100, 150, 50, 10); } // If the button "Turn OFF" is pressed if(mousePressed && mouseX>250 && mouseX<400 && mouseY>100 && mouseY<150){ myPort.write('0'); // Sends the character '0' and that will turn on the LED stroke(255,0,0); strokeWeight(2); noFill(); rect(250, 100, 150, 50, 10); } }

Description: We need to include the Serial library and create a serial object in order to enable the serial communication, as well as, define a String variable for the led status. In the setup section we need to set the window size of the program and start the serial communication. As for the COM Port Number here we need to try one of the two COM Port numbers we previously noticed in the device manager. The next line defines the buffering of the serial port and in our case that’s until there is a new line and actually there is a new line each time the Arduino sends the String “LED: OFF” or “LED ON” because of the println() function. Next, using the serialEvent() function we check whether there is available data in the serial port to be read. If so, using the readStringUntil() function we will read that data from the serial port which has been sent from the Arduino and in our case that’s the String “LED: OFF” or “LED: ON”.

In the main draw() function, which constantly repeats, we make all the graphics and functions of the program. So first we need set the background color, the fill color, the stroke size and color and using the rect() function we draw the two buttons. Using the text() function we print all the text, including the ledStatus string that’s coming from the Arduino. What’s left now is to make the buttons functional. So using the first “if” statement we confine the area of the “Turn ON” button, so when the button is pressed the character ‘1’ will be sent over the serial port to the Arduino and that will turn on the LED. The next for lines are used to highlight the button when it’s pressed. The same procedure goes for the “Turn OFF” button.

Arduino and Laptop Bluetooth Communication via Processing IDE

Now the program is ready, so when we will click the run button, the program will automatically activate the Bluetooth communication between the laptop and the Arduino. The HC-05 Bluetooth module will start to flash every two seconds, which indicates that the module is connect and we will be able to control the LED using our Laptop.

Thant’s all for this tutorial, but don’t forget to check my next tutorial where we will learn how we can configure the HC-05 Bluetooth module and make a Bluetooth communication between two separate Arduino Boards as master and slave devices.

Also, feel free to ask any question in the comments section below and don’t forget to check out my collection of Arduino Projects.

Categories Arduino TutorialsSours: https://howtomechatronics.com/tutorials/arduino/arduino-and-hc-05-bluetooth-module-tutorial/

Receiver arduino bluetooth

Simple Data Transfer Example

Even though Bluetooth Low Energy Modules available at a reasonable cost, most of these modules are not compatible with existing devices that support the classic Bluetooth. The HC-05 is an expensive module that is compatible with wide range of devices including smartphone, laptops and tablets. Adding a Bluetooth to Arduino can take your project to the next level. It opens up lots of possibilities for user interface (UI) and communication. The phone/tablet etc can act as an UI element or data logger and interpreter for your next project.

So let's get started , in the first part we will simply look at how easy it use the module with Arduino and transfer data to a Smart Phone. Later we will look at various configurations the HC-05 module like the device name, pass-code, modes of operations and all of that with the help of AT commands.Later we will also look at pairing to Bluetooth modules, configuring one as Master and other as Slave. You need not configure the module, if you simple want to use it.

The Module:

Observe the tiny switch on the board on the top end of the switch, we will be using it to put the board in the AT command mode. dsc09412.jpg

The Pinout:

The module available at the EE Store has 6 pins as shown below: dsc09415.jpg

Pin Funtions

Pin Description
State can be connected to the Arduino Input in order to know the state of the connection. Paired or disconnected.
Rx Receive Pin of the module. It is recommended to use a voltage divider as shown in the hookup.
Tx Can be connected directly to the Arduino Rx Pin
GND connected to GND pin of Arduino
5v This breakout board has a internal 3.3v regulator on board.
ENEnables or Disables the module. Rarely Used.

We will start with a very simple example of establishing a serial connection between the HC-05 and the Smart Phone and send/receive message. You can take the example forward to control devices or log any data that you wish.

Hookup

We will use pins 10 and 11 of the Arduino to connect the HC-05 and use the SoftwareSerial library to communicate with the module. The Hardware serial port on arduino is used to send/receive messages from the computer to the Arduino.

The voltage divider on the Rx line of the module is recommended to ensure that module does not receive signals above 3.3v.

In a real application you might want to use the HW serial port itself to connect the Bluetooth module, if you need hardware interrupts.

Bluetooth HC-05 with Arduino bb.png

Code

This is probably the simplest code to test all the device that support the serial port communication. It simply connects the computer terminal and the HC-05 in a loop. The codes sends the messages from the terminal to the Bluetooth Module and messages from the Bluetooth module to the terminal.

#include <SoftwareSerial.h> SoftwareSerial EEBlue(10,11);// RX | TXvoid setup(){   Serial.begin(9600); EEBlue.begin(9600);//Default Baud for comm, it may be different for your Module. Serial.println("The bluetooth gates are open.\n Connect to HC-05 from any other bluetooth device with 1234 as pairing key!.");   }   void loop(){   // Feed any data from bluetooth to Terminal.if(EEBlue.available()) Serial.write(EEBlue.read());   // Feed all data from termial to bluetoothif(Serial.available()) EEBlue.write(Serial.read());}

Demo

There are numerous Android apps to connect your phone the blue-tooth Module. I used the Bluetooth Terminal to connect it to the HC-05.

Bt 1.png

The output as seen on the Arduino Terminal. This way we have established a blue-tooth link to send messages form the phone to the Arduino with HC-05.


HC 05 output.JPG

As said earlier, you might want to configure the module to setup various things like the device name, pass code, baud rate etc. To do all of this, you need to first put the module in AT command mode.

AT command Mode

We have the breakout board with a switch on it as shown in the first picture, for this module perform the steps below:

  1. Disconnect the +5v line from the modules end as shown in the hook diagram above.
  2. Press and hold the switch (DO NOT RELEASE IT!)
  3. Reconnect the +5v connection
  4. Now Release the switch and take a breathe. Observe that the led on the module starts blinking once every two seconds, slower than normal disconnected mode.
  5. Upload the code below to the Arduino.
#include <SoftwareSerial.h> SoftwareSerial EEBlue(10,11);// RX | TX   void setup(){ Serial.begin(9600); EEBlue.begin(38400);//Baud Rate for command Mode. Serial.println("Enter AT commands!");}   void loop(){   // Feed any data from bluetooth to Terminal.if(EEBlue.available()) Serial.write(EEBlue.read());   // Feed all data from termial to bluetoothif(Serial.available()) EEBlue.write(Serial.read());}

Notice that the only change in the code is the baud Rate. This is the rate at which the module speaks in the command mode. We need not change anything on the terminal because we are still speaking the with the Arduino at 9600 baud.

Open up the terminal hit AT and check if the module echos back OK! HC 05 CommandMode.JPG

Setting up Device Name and Pass key

Command Response Description
AT+NAME="EE BLUE" OK Sets the name to EE Blue.
AT+PSWD="2425"OKSets the pairing key.
Sours: https://exploreembedded.com/wiki/Setting_up_Bluetooth_HC-05_with_Arduino
HID USB-Bluetooth-Adapter: USB-Host 2.0 - Arduino Mini - HC05/HC06 as RN42 for mouse \u0026 keyboard -DIY

Arduino Bluetooth Basic Tutorial © CC BY

Watch how does it Work?

Watch the video tutorial

Before the build check out my blog for more similar tutorials

Link to my link

Let’s Start Building

The circuit is so simple and small, there are only a few connections to be made

Arduino Pins           Bluetooth Pins

RX (Pin 0)     ———->      TX

TX (Pin 1)      ———->      RX

5V                ———->      VCC

GND             ———->      GND

Connect a LED negative to GND of Arduino and positive to pin 13 with a resistance valued between 220Ω – 1KΩ. And you're done with the circuit

Note: Don’t  Connect RX to RX and TX to TX of Bluetooth to Arduino you will receive no data, Here TX means Transmit and RX means Receive

How Does it Work?

HC 05/06 works on serial communication.here the android app is designed to send serial data to the Bluetooth module when a certain button is pressed. The Bluetooth module at the other end receives the data and sends it to Arduino through the TX pin of the Bluetooth module(RX pin of Arduino). The Code fed to Arduino checks the received data and compares it.If received data is 1 the LED turns on turns OFF when received data is 0

Open the serial monitor and watch the received data

Android Application

In this tutorial, I will not be covering tutorials on android app development.You can download the android application from here and the source code of the entire project. In future, I may be posting it tutorials herehttp://mgprojecthub.com

How to use the App?

Watch in video how to pair to Bluetooth module

  • Download the Application form here or here
  • Pair your device with HC 05/06 Bluetooth module1) Turn ON HC 05/06 Bluetooth module2) Scan for available device3) Pair to HC 05/06 by entering default password 1234 OR 0000
  • Install  LED application on your android device
  • Open the Application
  • Press paired devices
  • Select your Bluetooth module from the List (HC 05)
  • After connecting successfully
  • Press ON button to turn ON LED and OFF button to turn OFF the LED
  • Disconnect button to disconnect from Bluetooth module

This is just a basic tutorial on interfacing Bluetooth module with Arduino This project can be improved to a higher level like Home automation using a smartphone, Smartphone controlled robot, and much more.

UPDATE : Check out my Bluetooth RC robot using Arduino.



Check out my blog for my new projects

If you have any doubt leave a comment here. It's my blog. I will be regularly checking for feedback there rather than here.

Also, see my similar tutorials and Projects

Support me by buying me a coffee

Sours: https://create.arduino.cc/projecthub/mayooghgirish/arduino-bluetooth-basic-tutorial-d8b737

You will also be interested:

The difference was only 2-3 centimeters. The movements of the tannin hand accelerated. Oleg leaned back on the bench, closing his eyes. My wife, biting her lip, tried to give her partner the greatest pleasure.



7347 7348 7349 7350 7351