Interfacing with HC-05 & ESP-8266

I am making a project in which i have to send data from PC to Arduino via Bluetooth and Wifi. And then Arduino will send that data to a web server.

I am new to arduino programming.

I have coded for HC-05 but i am unable to code the arduino for ESP 8266.
and how can i use both of them in a single program ?

Hardware Used : Arduino UNO, ESP8266-01, HC-05.

Any help would be appreciated.

Thank You.

DarkL0rd:
I am making a project in which i have to send data from PC to Arduino via Bluetooth and Wifi.

Why both Bluetooth AND Wifi?

Its a part of a project.
Either Wifi or Bluetooth will be used for sending the data at a time but provision for both should be there.

I am facing some problems with ESP8266.
It doesnt respond to my AT commands. The blue LED is always on.

Any suggestions ?

DarkL0rd:
Its a part of a project.
Either Wifi or Bluetooth will be used for sending the data at a time but provision for both should be there.

I am facing some problems with ESP8266.
It doesnt respond to my AT commands. The blue LED is always on.

Any suggestions ?

First you should learn how to use an Arduino with an ESP.
Second you should learn how to use an Arduino with the bluetooth module.

When you have learned how to do that you can combine them. Both of them are controlled by UART (serial) thus you need two serial instances.

DarkL0rd:
Its a part of a project.
Either Wifi or Bluetooth will be used for sending the data at a time but provision for both should be there.

I am facing some problems with ESP8266.
It doesnt respond to my AT commands. The blue LED is always on.

Any suggestions ?

Can you post your code and a schematic?

TX goes to RX and RX goes to TX.

Not RX to RX and TX to TX.

You MUST use a voltage divider between the TX pin of the Arduino and the RX pin of the ESP.

Also set baudrate to 9600.

Oh I see you deleted your latest post.

i am using bare minimum sketch for esp.
i open serial monitor and type AT but i do not get any response.

Connections :
Arduino- ESP8266
3.3v- Vcc
3.3v - CHPD
GND - GND
TX - TX
RX - RX

i tried using volatge divider for RX pin, but it still doesnt work.

and when i bypass MCU by connecting RESET & GND of Arduino, the ESP doesnt get power.

Code for HC-05
#define ledPin 13
#define ledPin1 12
long int state = 0;

void setup()
{
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
pinMode(ledPin1, OUTPUT);
digitalWrite(ledPin1, LOW);
Serial.begin(38400);
}

void loop()
{
if (Serial.available() > 0)
{
state = Serial.read();
}
if (state <= 0 )
{
digitalWrite(ledPin, HIGH);
Serial.println(“No Data”);
state = 0;
delay(2000);
digitalWrite(ledPin, LOW);

}
else if (state >= 1)
{
digitalWrite(ledPin1, HIGH);
Serial.println(“Data Received is/”);
Serial.println(state - ‘0’);
state = 0;
delay(2000);
digitalWrite(ledPin1, LOW);

}
}

Lennyz1988:
TX goes to RX and RX goes to TX.

Not RX to RX and TX to TX.

You MUST use a voltage divider between the TX pin of the Arduino and the RX pin of the ESP.

Also set baudrate to 9600.

Oh I see you deleted your latest post.

I made a typing mistake, coudnt repost it for 5 mins... thats why took it down.

And I tried this too..
Now the Blue LED on the ESP goes off but still no response to AT commands..

Most Arduinos use 5V, your ESP8266 uses 3.3V. So your Tx from the Arduino may overload the Rx of the ESP8266, and the Tx from the ESP8266 may not go high enough for the Rx of your Arduino to receive the signal. Put a level converter in between.

Or even easer: dump the Arduino, do your programming on the ESP8266 and have it talk to the HC-05 by itself. It's more than capable of doing this. Saves you some steps.

wvmarle:
Most Arduinos use 5V, your ESP8266 uses 3.3V. So your Tx from the Arduino may overload the Rx of the ESP8266, and the Tx from the ESP8266 may not go high enough for the Rx of your Arduino to receive the signal. Put a level converter in between.

Or even easer: dump the Arduino, do your programming on the ESP8266 and have it talk to the HC-05 by itself. It's more than capable of doing this. Saves you some steps.

Is it possible to make to HC-05 communicate with ESP8266 ?

Can you guide me ?

I'm quite sure it can - the ESP8266 can work with just about anything the Arduino can work with, including bluetooth modules. You should be able to simply connect it to the Serial pins of the ESP8266 (do set up OTA updates for the ESP8266 so you don't have to unplug it every time you need to update your software which normally uses the same Serial).

Do NOT use the hardware UART for both PC and Bluetooth comms . If not using a Mega, use the softwareserial library.