HC-05 bluetooth communications with Arduino

Hi fellow Arduinians, I've been working on a small project here and ran into a bit of a wall :frowning:
Hopefully someone who has experience with serial communications, bluetooth comms, Arduino uno, and 16x2 LCDs can help me with my dilemma.

So, here's what's happening:

I am trying to get a string of data programmed to an Arduino UNO, which will then transmit the data to an HC-05 bluetooth module set in master mode, which will then broadcast that data to another HC-05 bluetooth module set in slave mode. The slave module needs to send the data back to the Arduino so it can be programmed to finally print the data to a 16x2 LCD.

To add more, the master module will need to be activated using a photoresistor (LDR). Once activated, the string of data ("message") that is being sent to the master bluetooth module to be broadcast will be changed to a different "message." I'll worry about the photoresistor part later.

So far, I have this much accomplished:

  1. Bluetooth modules are both configured, one set as master and one set as slave.
  2. A small bit of Arduino programming to let me know both modules are communicating with each other.
    Here's the code I have for bluetooth module comm testing:

void setup()
{
Serial.begin(9600);

}

void loop()
{
Serial.println("Message 2017");
delay(1000);

}

I am getting communications between the two bluetooth modules :slight_smile: I just need to verify that the message I have in my program ("Message 2017") is what is being communicated, so I thought the best way to do that would be display it on an LCD.

MY QUESTION IS THIS:

Can anyone explain how to wire the LCD and slave bluetooth module so that the message received by the slave module will show up on the LCD? Being that I am new to Arduino's libraries and methods and/or functions, I will probably need some programming advice if I need to do more programming to make it work.

Thanks for any help!!

dbren17:
MY QUESTION IS THIS:

Can anyone explain how to wire the LCD and slave bluetooth module so that the message received by the slave module will show up on the LCD? Being that I am new to Arduino's libraries and methods and/or functions, I will probably need some programming advice if I need to do more programming to make it work.

Why not bit-bang the serial for the bluetooth modules via softwareserial.h and use the hardware UART for debugging (instead of an LCD)? This will save you lots of time and effort.

Anyway, here you go:
LCD
HC-05

It appears that you have done it all as far as bluetooth is concerned, and it is now just a matter of printing the input. Using the standard LCD procedure, i.e. the example in the IDE, should be all you need.

#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
String readString;
char c;
void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2);
}

void loop() {
    while (Serial.available())     //Check if there is an available byte to read
  {
    delay(3);                      //Delay added to make thing stable 
    c = Serial.read();             //Conduct a serial read
    readString += c;               //build up the string
  }                                // end while
  if (readString.length() >0) 
  {  
    lcd.print(c);  
   readString="";  
  }                                // end if
}

The above compiles, but is not necessarily complete. If you need more sophisticated input, check Serial Input Basics - updated - Introductory Tutorials - Arduino Forum