Projects / Bluetooth serial terminal control

Bluetooth serial terminal control

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO

    Build the divider

    Nano D11 through 1 kΩ to the HC-05 RXD, and 2 kΩ from RXD to ground.

  2. NANO

    Wire the module

    VCC to 5V, GND to ground, TXD to D10.

  3. NANODHT22USB24.1°C

    Add the DHT22

    Data on D2 with a 10 kΩ pull-up.

  4. NANOUSB

    Upload

    Use the sketch above. The HC-05 is on D10 and D11, not on the USB serial pins, so it does not interfere with uploads.

  5. NANOHC05

    Pair your phone

    In Bluetooth settings find HC-05 and pair with 1234 or 0000.

  6. NANOHC05

    Open a terminal app

    Use a Bluetooth serial terminal app and connect to HC-05.

  7. NANO

    Send commands

    T, H, L1, L0 and ? and read the replies.

In short

How do you build a bluetooth serial terminal control?

An HC-05 lets a phone terminal app send commands and read sensor values from an Arduino. You need Arduino Nano, HC-05 Bluetooth Module, DHT22 Sensor, Resistor 10 kΩ, Resistor 1 kΩ, Resistor 2 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
9

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
HC-05 VCC and GNDNano 5V and GNDSupply
HC-05 TXDNano D10 (SoftwareSerial RX)Data from the module
Nano D11 (SoftwareSerial TX)1 kΩ to HC-05 RXD, and 2 kΩ from RXD to GNDDivides 5 V down to about 3.3 V
DHT22 VCC and GNDNano 5V and GNDSensor supply
DHT22 DATANano D2, with 10 kΩ to 5VPull-up

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "DHT sensor library" and "Adafruit Unified Sensor". The HC-05 is a Bluetooth Classic module, so it works with Android terminal apps but not with iPhones. Pair with the default PIN 1234 or 0000. The module's RXD pin is 3.3 V, so the 1 kΩ and 2 kΩ divider is needed. To change its name, hold the KEY pin high at power-up and send AT commands at 38400 baud.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <SoftwareSerial.h>
#include <DHT.h>

SoftwareSerial bt(10, 11);                  // RX, TX
DHT dht(2, DHT22);
String cmd;

void setup() {
  bt.begin(9600);                           // HC-05 default data rate
  dht.begin();
  pinMode(LED_BUILTIN, OUTPUT);
  bt.println("Ready. Commands: T, H, L1, L0, ?");
}

void loop() {
  while (bt.available()) {
    char c = bt.read();
    if (c == '\n' || c == '\r') {
      cmd.trim();
      if (cmd == "T")       { bt.print("Temp "); bt.print(dht.readTemperature(), 1); bt.println(" C"); }
      else if (cmd == "H")  { bt.print("Humidity "); bt.print(dht.readHumidity(), 0); bt.println(" %"); }
      else if (cmd == "L1") { digitalWrite(LED_BUILTIN, HIGH); bt.println("LED on"); }
      else if (cmd == "L0") { digitalWrite(LED_BUILTIN, LOW);  bt.println("LED off"); }
      else if (cmd == "?")  { bt.println("T, H, L1, L0"); }
      else if (cmd.length()) bt.println("Unknown command");
      cmd = "";
    } else cmd += c;
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Send TReplies with the temperature
Send HReplies with the humidity
Send L1 and L0Built-in LED switches on and off
Walk 5 m awayLink still works indoors

If it does not work

Cannot see HC-05

Power the module properly. A slowly blinking LED means connected, fast blinking means waiting.

Garbled text

Baud rate mismatch. Use 9600 on both sides.

Phone cannot pair

Use the PIN 1234. iPhones cannot use Bluetooth Classic.

Replies missing

Terminal app is not adding a newline. Enable newline in its settings.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the bluetooth serial terminal control?

Arduino Nano, HC-05 Bluetooth Module, DHT22 Sensor, Resistor 10 kΩ, Resistor 1 kΩ, Resistor 2 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).

How long does the bluetooth serial terminal control take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the bluetooth serial terminal control works?

Send T: Replies with the temperature. Send H: Replies with the humidity. Send L1 and L0: Built-in LED switches on and off.

Cannot see HC-05: what should I check?

Power the module properly. A slowly blinking LED means connected, fast blinking means waiting.

Garbled text: what should I check?

Baud rate mismatch. Use 9600 on both sides.

Phone cannot pair: what should I check?

Use the PIN 1234. iPhones cannot use Bluetooth Classic.

Replies missing: what should I check?

Terminal app is not adding a newline. Enable newline in its settings.