HC 05 Bluetooth not connecting to nano - newbie question

Hi,

I have a project where I eventually want to be able to have several Arduino nanos communicating with each other and an android phone. I thought the HC05 Bluetooth module would be good for this, but so far I can't get it to respond to AT commands or show to the Arduino at all. I can connect the module to my phone, but no data, and the LED flashes as it should in AT and non AT mode.

I'm probably doing something really stupid but I've been at this for days and have removed all other code and components except for this part from the board - still nothing and I'm at a loss.

Here is the code I'm using (from the manufacturer.) Nothing I type in the serial monitor then prompts any response when running.

#include <SoftwareSerial.h>
SoftwareSerial BTserial(8, 9); // RX, TX
char c=' '; boolean NL = true;
void setup()
{
Serial.begin(9600);
BTserial.begin(38400); Serial.println("BTserial started at 38400");
Serial.println(" ");
}
void loop()
{
// Read from the Bluetooth module and send to the Arduino Serial Monitor
if (BTserial.available())
{
c = BTserial.read();
Serial.write(c);
}
// Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
{
c = Serial.read(); BTserial.write(c);
// Echo the user input to the main window. The ">" character indicates the user entered text.
if (NL) { Serial.print(">"); NL = false; }
Serial.write(c);
if (c==10) { NL = true; }
}
}

This is my nano clone (elagoo):

This is my HC05:
https://www.ebay.co.uk/itm/HC-05-Arduino-Android-Wireless-Bluetooth-Serial-5v-Transceiver-Module-MASTER/313074658638?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

The wiring is:
GND - GND
VCC - 5V
TXD - D8
RXD - D9 (via resistors)

Any help hugely appreciated.

BTserial.begin(38400);

If you did not change it with an AT command, the default baud rate is usually 9600. 38400 is only for when it is in AT mode

Wiring sounds right. A photo is often valuable if the problem persists.

What application, running on the phone, is sending data? Post your test code.

Are you sure that what you have is an HC05? With the tiny button switch?

Your code works fine on my Uno with a HC05 on pins 8 and 9 talking to my Android tablet running Bluetooth Serial Terminal. Only changed the BTserial baud to 9600.

isambardify:
several Arduino nanos communicating with each other and an android phone. I thought the HC05 Bluetooth module would be good for this,

As this reads, not entirely. You will probably be better off having the several talking to each other on an NRF24 network, with ONE Nano also acting as a base station talking to the phone via Bluetooth.

While the code you post seems overly verbose, I assume it is kosher, but I might point out that

I can connect the module to my phone, but no data, and the LED flashes as it should in AT and non AT mode.

Doesn't prove anything other than that Arduino is reliably providing power. Check your wiring again - twice. Also, you might consider if you really need to send any AT commands at all. You haven't actually said anything that suggests you do, and the chances that you don't are pretty good.

Thanks for these suggestions. I've tried switching the baud rate to 9600 but the result is the same.

I've rebuilt my wiring a couple more times and probed it with a multimeter which has at least confirmed the voltage divider is going from just under 5v to just over 3v - roughly as expected. This is only testing with the arduino 5v line into the divider though, the RXD pin doesn't seem to have anything coming out of it to work with.

I've attached a photo and diagram of my circuit. Apologies for the crudeness of the diagram. I don't have much electronics background or the proper software to do these in a standard format, but hopefully it's at least clear what goes where.

Thanks so much for your ongoing help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.