Arduino with HC-05 (ZS-040) Bluetooth Module AT Mode
Arduino is a popular open-source platform for creating electronic projects. It consists of a microcontroller board and a software environment that allows you to program and control the board. Arduino can interact with various sensors, actuators, displays, and other devices using digital and analog pins.
Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE
Download Zip: https://www.google.com/url?q=https%3A%2F%2Furluso.com%2F2tNxSK&sa=D&sntz=1&usg=AOvVaw3SysgD_iofXI9oZMcb6dy1
One of the devices that you can use with Arduino is the HC-05 Bluetooth module. This module allows you to establish wireless communication between Arduino and other Bluetooth-enabled devices, such as smartphones, computers, or other Arduino boards. You can use the HC-05 Bluetooth module to send and receive data, control devices remotely, or create your own wireless network.
The HC-05 Bluetooth module has two modes of operation: data mode and AT mode. In data mode, the module acts as a serial port that transmits and receives data over Bluetooth. In AT mode, the module accepts commands that allow you to configure its settings, such as baud rate, device name, password, etc.
In this article, we will show you how to use Arduino and HC-05 Bluetooth module in AT mode. We will explain what AT mode is, how to enter and exit it, and how to use some common AT commands. We will also provide some examples of how to change the settings of the HC-05 Bluetooth module using Arduino and AT mode.
What is AT Mode?
AT mode is a special mode of the HC-05 Bluetooth module that allows you to send commands to the module using a serial communication protocol. The commands start with the letters \"AT\" followed by a parameter or a query. For example, \"AT+NAME?\" is a command that asks the module for its device name.
AT mode is useful for configuring the settings of the HC-05 Bluetooth module, such as:
Baud rate: The speed of data transmission over serial communication.
Device name: The name that identifies the module when it is discovered by other Bluetooth devices.
Password: The four-digit code that is required to pair with the module.
Role: The role of the module in a Bluetooth network. It can be master (initiates connection), slave (accepts connection), or both.
State: The state of the module. It can be initialized (ready to accept commands), paired (connected to another device), or inquired (searching for other devices).
By changing these settings, you can customize the behavior and performance of the HC-05 Bluetooth module according to your needs and preferences.
AT: Test if the module is working and responds to commands.
AT+NAME: Query or set the device name of the module.
AT+PSWD: Query or set the password of the module.
AT+UART: Query or set the baud rate of the module.
AT+ROLE: Query or set the role of the module (master, slave, or both).
AT+STATE: Query the state of the module (initialized, paired, or inquired).
AT+RESET: Reset the module and exit AT mode.
For example, to change the device name of the HC-05 Bluetooth module to \"MyBluetooth\", you can type \"AT+NAME=MyBluetooth\" in Serial Monitor and press enter. The module will respond with \"OK\" and change its name. To check the current device name of the module, you can type \"AT+NAME?\" in Serial Monitor and press enter. The module will respond with \"+NAME:MyBluetooth\".
How to Change the Settings of HC-05 Bluetooth Module Using Arduino and AT Mode?
In this section, we will provide some examples of how to change the settings of HC-05 Bluetooth module using Arduino and AT mode. We will use hardware serial for simplicity, but you can also use software serial if you prefer.
The first example is how to change the baud rate of HC-05 Bluetooth module. The baud rate is the speed of data transmission over serial communication. The default baud rate of HC-05 Bluetooth module is 9600 bps (bits per second), but you can change it to any value between 1200 and 1382400 bps. Changing the baud rate can improve the performance and reliability of data transmission, but you need to make sure that both Arduino and HC-05 Bluetooth module use the same baud rate.
To change the baud rate of HC-05 Bluetooth module, you need to follow these steps:
Connect Arduino and HC-05 Bluetooth module using hardware serial as described before.
Upload the sketch that initializes hardware serial at 9600 baud rate as described before.
Open Serial Monitor and set the baud rate to 9600.
Type \"AT+UART?\" in Serial Monitor and press enter. The module will respond with \"+UART:9600,0,0\", which means that the current baud rate is 9600 bps, with no parity bit and one stop bit.
Type \"AT+UART=38400,0,0\" in Serial Monitor and press enter. The module will respond with \"OK\", which means that the new baud rate is 38400 bps, with no parity bit and one stop bit.
Close Serial Monitor and change the baud rate to 38400 in Arduino IDE.
Open Serial Monitor again and set the baud rate to 38400.
Type \"AT+UART?\" in Serial Monitor and press enter. The module will respond with \"+UART:38400,0,0\", which means that the new baud rate is 38400 bps, with no parity bit and one stop bit.
You have successfully changed the baud rate of HC-05 Bluetooth module to 38400 bps. You can use any other value between 1200 and 1382400 bps as long as you match it with Arduino IDE and Serial Monitor.
The second example is how to change the role of HC-05 Bluetooth module. The role is the function of the module in a Bluetooth network. It can be master (initiates connection), slave (accepts connection), or both. The default role of HC-05 Bluetooth module is slave, but you can change it to master or both. Changing the role can affect the compatibility and functionality of the module with other Bluetooth devices.
To change the role of HC-05 Bluetooth module, you need to follow these steps:
Connect Arduino and HC-05 Bluetooth module using hardware serial as described before.
Upload the sketch that initializes hardware serial at 38400 baud rate as described before.
Open Serial Monitor and set the baud rate to 38400.
Type \"AT+ROLE?\" in Serial Monitor and press enter. The module will respond with \"+ROLE:0\", which means that the current role is slave.
Type \"AT+ROLE=1\" in Serial Monitor and press enter. The module will respond with \"OK\", which means that the new role is master.
Type \"AT+ROLE?\" in Serial Monitor and press enter. The module will respond with \"+ROLE:1\", which means that the new role is master.
You have successfully changed the role of HC-05 Bluetooth module to master. You can use any other value between 0 and 2 as long as you understand its implications. For example, if you set the role to both (2), you need to use another command (AT+CMODE) to specify whether the module connects to a fixed address or any address.
The third example is how to change the device name of HC-05 Bluetooth module. The device name is the name that identifies the module when it is discovered by other Bluetooth devices. The default device name of HC-05 Bluetooth module is \"HC-05\", but you can change it to any name you like. Changing the device name can make it easier to recognize and connect to the module.
To change the device name of HC-05 Bluetooth module, you need to follow these steps:
Connect Arduino and HC-05 Bluetooth module using hardware serial as described before.
Upload the sketch that initializes hardware serial at 38400 baud rate as described before.
Open Serial Monitor and set the baud rate to 38400.
Type \"AT+NAME?\" in Serial Monitor and press enter. The module will respond with \"+NAME:HC-05\", which means that the current device name is \"HC-05\".
Type \"AT+NAME=MyBluetooth\" in Serial Monitor and press enter. The module will respond with \"OK\", which means that the new device name is \"MyBluetooth\".
Type \"AT+NAME?\" in Serial Monitor and press enter. The module will respond with \"+NAME:MyBluetooth\", which means that the new device name is \"MyBluetooth\".
You have successfully changed the device name of HC-05 Bluetooth module to \"MyBluetooth\". You can use any other name you like as long as it is not longer than 20 characters.
The fourth example is how to change the password of HC-05 Bluetooth module. The password is the four-digit code that is required to pair with the module. The default password of HC-05 Bluetooth module is \"1234\", but you can change it to any code you like. Changing the password can improve the security and privacy of the module.
To change the password of HC-05 Bluetooth module, you need to follow these steps:
Connect Arduino and HC-05 Bluetooth module using hardware serial as described before.
Upload the sketch that initializes hardware serial at 38400 baud rate as described before.
Open Serial Monitor and set the baud rate to 38400.
Type \"AT+PSWD?\" in Serial Monitor and press enter. The module will respond with \"+PSWD:1234\", which means that the current password is \"1234\".
Type \"AT+PSWD=4321\" in Serial Monitor and press enter. The module will respond with \"OK\", which means that the new password is \"4321\".
Type \"AT+PSWD?\" in Serial Monitor and press enter. The module will respond with \"+PSWD:4321\", which means that the new password is \"4321\".
You have successfully changed the password of HC-05 Bluetooth module to \"4321\". You can use any other four-digit code you like as long as you remember it.
Conclusion
In this article, we have learned how to use Arduino and HC-05 Bluetooth module in AT mode. We have explained what AT mode is, how to enter and exit it, and how to use some common AT commands. We have also provided some examples of how to change the settings of HC-05 Bluetooth module using Arduino and AT mode.
AT mode is a powerful and useful feature of HC-05 Bluetooth module that allows you to customize its behavior and performance according to your needs and preferences. By using Arduino and AT mode, you can easily configure the HC-05 Bluetooth module and make it work with other Bluetooth devices.
We hope you have enjoyed this article and learned something new. If you have any questions or comments, please feel free to leave them below. Thank you for reading!
Conclusion
In this article, we have learned how to use Arduino and HC-05 Bluetooth module in AT mode. We have explained what AT mode is, how to enter and exit it, and how to use some common AT commands. We have also provided some examples of how to change the settings of HC-05 Bluetooth module using Arduino and AT mode.
AT mode is a powerful and useful feature of HC-05 Bluetooth module that allows you to customize its behavior and performance according to your needs and preferences. By using Arduino and AT mode, you can easily configure the HC-05 Bluetooth module and make it work with other Bluetooth devices.
We hope you have enjoyed this article and learned something new. If you have any questions or comments, please feel free to leave them below. Thank you for reading! b99f773239
https://www.foxxberry.com/group/learner-community/discussion/343f5b81-c780-493a-9bda-0f8a795d19c1
https://www.clsproserv.com/group/plan18/discussion/e7536121-c2fe-4412-b578-b166d59cd21d