Harit Shah
Published

Bluetooth Chat with HC-05

I will be going over how to chat over two HC-05 Bluetooth modules.

BeginnerFull instructions provided2,215
Bluetooth Chat with HC-05

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×2
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×2
SparkFun FTDI Basic Breakout - 3.3V
SparkFun FTDI Basic Breakout - 3.3V
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Arduino Sample Code

C/C++
#include <SoftwareSerial.h>

#define bt_tx_pin 4     // connect to hc-05 rx pin
#define bt_rx_pin 6     // connect to hc-05 tx pin
#define bt_en_pin 9     // connect to hc-05 en pin
#define bt_state_pin 10 // connect to hc-05 state pin

SoftwareSerial bt_serial(bt_rx_pin, bt_tx_pin);

void setup()
{
    pinMode(bt_rx_pin, INPUT);
    pinMode(bt_tx_pin, OUTPUT);
    pinMode(bt_en_pin, OUTPUT);
    pinMode(bt_state_pin, OUTPUT);

    Serial.begin(9600);
    bt_serial.begin(38400);
}

void loop()
{

    if (bt_serial.available())
    {
        Serial.write(bt_serial.read());
    }

    if (Serial.available())
    {
        bt_serial.write(Serial.read());
    }
}

Credits

Harit Shah

Harit Shah

4 projects • 18 followers
Hardware Engineer with 7+ years’ experience in designing, managing, and testing of both digital and RF modules

Comments