Hey everyone
I recently bought this bluetooth module off ebay and I have been trying to make it work with my arduino mega but this stupid thing just wont communicate :~ with my arduino.
This is the code I been trying to use with my arduino
Pin 19 is RX and 18 is TX on the mega in communications area
Pin 2 is for the AT mode the KEY pin, and is connected to the PWM slot 2 on the mega.
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(19, 18); // RX | TX
void setup()
{
pinMode(2, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(2, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
Things I made sure are suppose to be standard procedure:
- RX on the module goes in the TX on the arduino
TX on the module goes in the RX on the arduino - The module is connected to 5V on the arduino since it wont even turn on the 3.3V
- To put it in the AT mode i remove the 5V cable > turn on my arduino let it boot > upload sketch > connect 5V cable to the module without turning off arduino.
couple of things I have had problems with:
- when I connect my PC BT to the BT module, it does get connected with the PIN "1234" showing me HC-05 but then after like 5 minutes it will disconnect itself.
- I tried to use putty on the BT COM port but it was unable to communicate with it
now what else am i missing, cause this thing is just slowing down the project I been working on. I been to so many forums searching for answers on this.... is my module faulty?