Summary

This document provides a tutorial on connecting an HC-05 Bluetooth module to an Arduino. It covers the necessary wiring, configuration of the Bluetooth module, and pairing instructions for Android phones.

Full Transcript

Bluetooth Module with Arduino Objectives Define Bluetooth Module Learn how to configure the electrical circuit of the Bluetooth Module with Arduino Know on how to program Bluetooth Module Perform Bluetooth Module with Arduino that will control the LED. WHA...

Bluetooth Module with Arduino Objectives Define Bluetooth Module Learn how to configure the electrical circuit of the Bluetooth Module with Arduino Know on how to program Bluetooth Module Perform Bluetooth Module with Arduino that will control the LED. WHAT IS BLUETOOTH? The name dates back more than a millennia to King Harald “Bluetooth” Gormsson who was well known for two things: Uniting Denmark and Norway in 958. His dead tooth, which was a dark blue/grey color, and earned him the nickname Bluetooth. WHAT IS BLUETOOTH? In 19 9 6 , three industry leaders, Intel,Ericsson,and N okia , met to plan the standardization of this short-range radio technology to support connectivity and collaboration between different products and industries. During this meeting, Jim Kardach from Intel suggested Bluetooth as a temporary code name. Kardach was later quoted as saying, “King Harald Bluetooth was fam ous for uniting Scandinavia just as we intended to unite the PC and cellular industries with a short-range wireless link.” Bluetooth was only intended as a placeholder until marketing could come up with something really cool. WHAT IS BLUETOOTH? The Bluetooth logo is a bind rune merging the Younger Futhark runes (Hagall) (ᚼ) and (Bjarkan) (ᛒ), Harald’s initials. BLUETOOTH MOD ULE It is a basic circuit set of chip which integrated Bluetooth functions and which can be used in wireless network transmission. It can be used for real-tim e data logging,or controlling a p roject using a sm artp hone. HC -0 5 is one of the examples of Bluetooth Module. HC -0 5 It is a Bluetooth-to-Serial-Bridge module that allows wireless communications. It can be used between two microcontrollers or between a m icrocontroller and a sm artp hone, lap top ,or desktop PC with Bluetooth capability. HC -0 5 This module contains a Bluetooth transceiver (sending and receiving). This module has a nominal range of 10 meter. HC-05 is easy to configure and use Modes of Operation AT Mode It uses AT commands which are used to change setting of HC-05. You can configure various settings of the HC-05 module, such as its name, baud rate, PIN code, and data rate. Modes of Operation D ata Mode It is the exchange of data between devices. The HC -0 5 m odule acts as a transparent data gateway. C onnection Roles Slave Role The HC-05 module waits for other devices to initiate a connection. This is the module’s default role and is commonly used in p rojects where you want to control things using a sm artp hone. C onnection Roles Master Role The HC -0 5 actively searches for other Bluetooth devices and tries to initiate a connection. This mode is used in projects where two m icrocontrollers need to com m unicate wirelessly. C onnection Roles Master Role The HC -0 5 actively searches for other Bluetooth devices and tries to initiate a connection. This mode is used in projects where two m icrocontrollers need to com m unicate wirelessly. HC -0 5 Parts Power The maximum operating voltage of the bare HC-05 chip is 3.3V. Therefore, the module includes a linear 3.3V regulator, which allows a voltage from 3.6V to 6V to be used to supply power to the module HC -0 5 Parts Status LED When powered up, the module enters Bluetooth p airing m ode , with the LED flashing rap idly at about 2 Hz. HC -0 5 Parts Status LED When the module is p aired with a device,the LED flash p attern changes to two q uick flashes , followed by a pause, and then repeats. When the module is put into AT m ode , the LED blinks at a slow and steady rate. HC -0 5 Parts AT Mode It is the configuration mode where you can send Hayes AT-style commands to the HC-05 module to change its settings like name, baud rate, password, etc HC -0 5 Parts HC -0 5 Pinout State - can be used to determ ine the current status of the HC-05 module. R X D - receives serial data from the m icrocontroller. It should be connected to the TX of the microcontroller. TX D - sends serial data to the m icrocontroller. It should be connected to the RX of the microcontroller. HC -0 5 Pinout HC -0 5 Parts G N D - the ground p in , common to any other device connected to the module. V C C - is where you connect the p ositive sup p ly voltage. This voltage supply signal is routed to the HC- 05 chip via a 3.3V regulator. It should range from 3.6V to 6V. EN - is connected to the on-board regulator enable p in and is p ulled high by a 220 k resistor. Pulling this pin low disables the regulator, which consequently turns off the HC-05 Procedure 1. Connect the HC-05 module to a device capable of sending and receiving serial data, like an Arduino or any microcontroller with UART. 2. On the Bluetooth side, you need a terminal program installed on your phone that can communicate via Bluetooth. Install the “Serial Bluetooth Terminal,” which is available in the Play Store. 3. SoftwareSerial library and connect the HC-05’s RX and TX pins to any of the Arduino’s free digital pins. Procedure 4. TXD of the HC-05 module is connected to the Arduino’s D3 5. The RXD to D2, GND to GND, and VCC to 5V. 6. A 1K resistor between HC-05’s Rx and Arduino’s D2, and a 2K resistor between HC05’s Rx and GND, will work just fine. C ON N EC TION S C OD E # include SoftwareSerial m ySerial(3,2); void setup () { Serial.begin(9 6 0 0 ); m ySerial.begin(9 6 0 0 ); Serial.p rintln("Initializing..."); Serial.p rintln("The device started,now you can p air it with bluetooth!"); } void loop () { if(Serial.available()) { m ySerial.write(Serial.read()); } if(m ySerial.available()) { Serial.write(m ySerial.read()); } delay(20 ); } Output C onnecting to Android Phone 1. Make sure the HC -0 5 m odule is p owered up and ready to establish a connection. 2. N ow,swip e down from the top of your Android p hone’s screen and make sure Bluetooth is turned on. C onnecting to Android Phone 1. Make sure the HC -0 5 m odule is p owered up and ready to establish a connection. 2. N ow,swip e down from the top of your Android p hone’s screen and make sure Bluetooth is turned on. C onnecting to Android Phone C onnecting to Android Phone 3. Touch and hold the Bluetooth icon , then tap “Pair new device” and wait a few seconds. C onnecting to Android Phone 4. Tap the nam e of the Bluetooth device you want to pair with your device (in our case, HC-05). Follow any on- screen instructions. C onnecting to Android Phone 5. When asked,enter 1234 as the PIN code. This is the default PIN for every HC-05 module. C onnecting to Android Phone 6. For the next step s in this tutorial,you need a Bluetooth Term inal ap p lication installed on your sm artp hone. We recommend using the Android app “Serial Bluetooth Terminal,” available in the Play Store. C onnecting to Android Phone 7. After installing, launch the “Serial Bluetooth Term inal” ap p. Click on the icon in the top left corner and choose “Devices”. C onnecting to Android Phone 7. After installing, launch the “Serial Bluetooth Term inal” ap p. Click on the icon in the top left corner and choose “Devices”. C onnecting to Android Phone 8. You should see a list of devices you’ve p reviously p aired with. Select “HC-05” from this list. C onnecting to Android Phone 9. You should get a “C onnected” m essage. The flash pattern on your HC-05’s onboard LED should now change to two quick flashes followed by a pause. That’s it! Your smartphone is now successfully paired with the HC-05 Bluetooth module and ready to communicate. C onnecting to Android Phone 10. N ow,typ e som ething in the inp ut box located at the bottom of the ap p , for example, “Hi!” C onnecting to Android Phone 11. You should instantly receive that m essage in the Arduino ID E Serial Monitor. C onnecting to Android Phone 12. You can also exchange data between your Serial Monitor and your sm artp hone. Type something in the Serial Monitor’s top input box and press the “Send” button. C onnecting to Android Phone 13. You should instantly receive that m essage in the Serial Bluetooth Term inal Ap p. Q UESTION S Reference https://lastm inuteengineers.com /hc 0 5-bluetooth-arduino-tutorial/ AC TIV ITY How Arduino and Bluetooth Technology C an Shape the Future of Autom ation and C onnectivity? 1/2 C ROSSWISE 3-4 sentences

Use Quizgecko on...
Browser
Browser