Code Arduino pour module Bluetooth HC-05
Ce document fournit le code nécessaire pour utiliser le module Bluetooth HC-05 avec Arduino, idéal pour des projets de communication sans fil.
Arduino- Installer la bibliothèque Bluetooth HC-05
- Configurer le module avec Arduino
- Écrire le code pour la communication série
- Tester la connexion entre Arduino et un appareil Bluetooth
- Déboguer les problèmes de connexion
- Utiliser le module pour des projets pratiques
- Comprendre les protocoles de communication Bluetooth
- Appliquer ces compétences dans des projets robotiques
- Analyser les performances du module Bluetooth
- Documenter le processus d'installation et d'utilisation

How to use Arduino hc-05?
What we need to do here is to activate the bluetooth and the smartphone will find the hc-05 bluetooth module. 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.
What is the hc-05 module?
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: hc-05 bluetooth module ……………. amazon / banggood / aliexpress arduino board …………………………… amazon / banggood / aliexpress
How to change hc-05 module name in Arduino IDE?
For example, if you write at+name? in the serial monitor of arduino ide and press enter, you will see a massage “hc-05” which is default name of hc-05. you can change your module name by at+name=”name” command. we have been configuring our bluetooth module.
How do I connect my hc-05 module?
Connect the hc-05 module to a device capable of sending and receiving serial data, such as an arduino or any microcontroller equipped with uart. on the bluetooth side, initiate a wireless connection between the hc-05 module and another bluetooth-enabled device, like an android phone.
How do I connect the hc-05 module to an Arduino?
Connecting the hc-05 module to an arduino is straightforward: apply power and wire up the serial rx and tx pins. rather than linking the hc-05 module directly to the arduino’s hardware uart, we’ll utilize softwareserial and connect the hc-05’s rx and tx pins to any available digital pins on the arduino.
Is hc-05 compatible with Arduino?
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.

How to connect hc-05 Bluetooth module in at command mode?
Txd is the transmit pin of the bluetooth module. connect the txd pin of hc-05 to the rxd pin of the mcu (arduino uno pin 0) rxd is the receive pin of the module. you will send the commands to the module via this rxd pin. connect txd pin of the mcu (arduino uno pin 1) the key pin enables you to put the hc-05 bluetooth module in at command mode.

Overview
For this tutorial I made two example, controlling the Arduino using a smartphone and controlling the Arduino using a laptop or a PC
Circuit schematics
Here’s how we need to connect the module to the Arduino Board. 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
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
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. Then we need to pair the devices and the default password of the HC-05 module is 1234
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
Processing ide source code
Now using the Processing IDE we will make a program for controlling the Arduino. Here’s the source code. 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