Arduino Uno + JY-MCU HC-06 Bluetooth

HI there,

I was wondering if anyone could help shed some light on a problem I’m having, I can get the HC-06 module to pair with another device (either my tablet or PC) but I cannot get it to do anything, I have tried with a voltage divider as described in many many articles/tutorials on the web and without, both allow it to power on and connect but neither way gives a response. The only thing I can say is I don’t have any 10 or 20K Ohms resistors, So I uh…matched them as closely as possible.

This is the Sketch code I currently have, I will also try to get a picture of the wiring both ways, it just difficult with only a front facing camera :slight_smile: - Many thanks to anyone who takes the time to read this.

#include <SoftwareSerial.h>

#include <AFMotor.h>

AF_DCMotor motorfront1(1, MOTOR12_8KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motorfront2(2, MOTOR12_8KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motorback3(3, MOTOR12_8KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motorback4(4, MOTOR12_8KHZ); // create motor #2, 64KHz pwm
SoftwareSerial bluetooth(0,1);


void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
  bluetooth.begin(9600);
  
motorfront1.setSpeed(255);
motorfront1.run(RELEASE);
motorfront2.setSpeed(255);
motorfront2.run(RELEASE);

motorback3.setSpeed(255);
motorback3.run(RELEASE);
motorback4.setSpeed(255);
motorback4.run(RELEASE);
// set the speed to 200/255
}

void loop() {
  if (bluetooth.available())
  {
    int command = bluetooth.parseInt();
    if (command == 1)
    {
      bluetooth.println("Command 1");
motorfront1.run(FORWARD);
motorfront2.run(FORWARD);
motorback3.run(FORWARD);
motorback4.run(FORWARD);
    }
    else if (command == 2){
     motorfront1.run(BACKWARD);
motorfront2.run(BACKWARD);
motorback3.run(BACKWARD);
motorback4.run(BACKWARD); 
    }
  }


  //motor.run(BACKWARD);     // the other way

  //motor.run(RELEASE);      // stopped
}

I can't comment on the motor stuff, and I'm not sure what your intent is with the voltage dividers, but the first thing to do is establish clear and usable two way communication between Arduino and other via bluetooth.

You might find this link useful

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

It is written with Android in mind but was developed on a laptop and is just as applicable there.

Hi,

I uploaded and tried the code for clarity's sake, it works via USB on the PC. But I get no response either way via bluetooth, as far as I can tell the connection is established but nothing gets received to my tablet/phone.

For example there is an app called Bluetotth SSP Pro (Its misspelled by the author) shows you how many byes have been sent and how many have been received, It shows bytes sending (to the arduino) but never been received .(by the tablet or phone or PC).

The motor code was from an Adafruit Motor shield library, I was attempting to get the wheels going forwards by pressing 1 on the phone/tablet/pc via bluetooth.

I'm starting to think its a faulty module.

Dev_iant: as far as I can tell the connection is established

If by that you mean a solid LED on bluetooth, that only confirms connection to Android. It confirms nothing about Arduino. Check the Rx/Tx wiring.