Arduino Uno HC-06 Bluetooth Trouble

Hello I am working on a school project that requires the use of Arduino to Android Bluetooth communication to read two voltages and generate the current. At the moment, no matter what I do, I cannot get the Bluetooth to communicate Serially, either using AT commands or by connecting to a Bluetooth terminal application. I have checked every online resource to find the problem.

I made sure to set the pinMode of the pin I wish to use Software Serial on. I have used multiple applications and multiple computers. I have done multiple Bluetooth dongles. I put a potential divider into the TX of the UNO. I have used both the default 0 and 1 serial ports and several different versions of softwareSerial. I am using the most recent IDE and have Arduino 1.6.10 loaded. I have tried multiple baud rates.

What I haven’t tried: use another UNO (don’t have one). Switch Arduino versions (wouldn’t know which one to try.

I will submit the code to the site and will take pictures of the devices. Feel free to run the code yourself if you have a Bluetooth dongle yourself. I may just need to borrow it for the remainder of the project (only kind of joking.)

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);//RX, TX
float R1 = 10000.0;
float R2 = 5000.0;
float R3 = 1000.0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("DONE");
  mySerial.begin(9600);
  pinMode(10, INPUT);
  pinMode(11, OUTPUT);

}


void loop() {
  // put your main code here, to run repeatedly:
  if (mySerial.available()) {
    char temp =mySerial.read();
    int analog_value1 = analogRead(A0);
    float voltage1 = analog_value1 * (5.0 / 1023.0);
    voltage1 = voltage1 / (R2 / (R1 + R2));
    mySerial.print("Voltage 1: ");
    mySerial.println(voltage1);

    delay(100);
  }


}

http://tronixlabs.com.au/news/tutorial-using-hc06-bluetooth-to-serial-wireless-uart-adaptors-with-arduino/ helped me

That wasn't helpful unfortunately. The website I bought it from mentioned something about a MAX232. Do I need that. Again, I not sure if the Arduino and dongle are communicating serially.

MystNinja:
That wasn't helpful unfortunately. The website I bought it from mentioned something about a MAX232. Do I need that. Again, I not sure if the Arduino and dongle are communicating serially.

Unhelpful?

It is the most basic of tutorials to teach you how to communicate to the HC-06 Bluetooth from the Arduino. If you are unable to do understand and/or implement, then I don't know what else there is to do.

Let me explain. I have looked at this and several other tutorials. I am under the suspension that something is wrong with my UNO. It doesn't appear to be a coding problem. Could you use your setup to test my code? That would help. And like I said, I'm not opposed to paying to borrow an UNO and dongle that work (Although realistically no one would take me up on this). I just need someone to verify the code and see if it works.

Shouldn't you be verifying your setup with known good code ?

If you didn’t like the other tutorial, Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE | Martyn Currey

I have not gotten either tutorial to work. Is is possible my UNO digital ports are wrong?

MystNinja:
I have not gotten either tutorial to work. Is is possible my UNO digital ports are wrong?

To verify your digital ports, all you need is a digital multimeter or a resistor and a diode.

It would help to know for sure that you have a HC-06 and not something else.

Seeing that you already have had two tutorials that don't work, I hesitate to offer a third, but you never know, and it might at least confirm that you have a hardware problem.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

Whatever you do, there is no evidence that you need to reconfigure the HC-06, so don't.

I would like to to thank everyone who tried to assist me. After trying different methods, my partners and I found that the issue was that not all HC-06 modules have built in logic level conversion from 5V logic level to 3.3V logic level. After ordering a new HC-06 from a new site, we were able to have our code worked as intended. I am sorry for the miscommunication that my post may have caused. All of your tutorials were fine, it was our hardware that was wrong.

MystNinja:
I found that the issue was that not all HC-06 modules have built in logic level conversion from 5V logic level to 3.3V logic level. After ordering a new HC-06 from a new site, we were able to have our code worked as intended.

While I don't have a proper explanation for your success, I don't think the logic level conversion has anything to do with it. There may be shields that have logic conversion, they being specifically for Arduino, but I'm not aware of any four pin HC-06 modules with built-in logic conversion. It wouldn't be a bad idea if there were.

Be that as it may, and while applying level conversion is a good idea, I have never heard of an HC-06 failing because it hasn't got it. I ran an HC-06 more or less continuously for a couple of years or so with no conversion.

I would be glad to see details of the old and new HC-06s you have.