Changing code to use with HC-06

I would really appreciate if someone help me to change code to use with bluetooth module HC-06. I'm new to Arduino and can't figure it out on my own.

/* Arduino Nano based EKG monitor.
*

  • EKG module AD8232) - Adruino Nano
  • =================================
  • GND - GND
  • 3.3V - 3.3V
  • OUTPUT - A1
  • LO- - D11
  • LO+ - D10
  • SDN not connected
  • Electrodes:
    • red R = RA (right arm)
    • green R = LA (left arm)
    • yellow L = RL (right leg)
      */

void setup() {
pinMode(10,INPUT);
pinMode(11,INPUT);
Serial.begin(9600);
}

void loop() {
if ((digitalRead(10)==1)||(digitalRead(11)==1)) {
Serial.println("no valid data");
}
else {
Serial.println(analogRead(A1));
}
//delay(10);
}

How is your HC-06 connected?

VCC-3.3V
RX-TX
TX-RX
GND

From your original post

3.3V - 5V

I would really appreciate if someone help me to change code to use with bluetooth module HC-06.

If you want to have the HC-06 send the value to something that is paired and connected to the HC-06, then I think no changes are needed.

Disconnect the HC-06 from Rx and Tx when you download the code, and then reconnect it. The Serial.print(analogRead(A1)) should go to both the monitor and the HC06 which will send the value to the receiver.

With this setup you will not be able to use the monitor to send data to the Arduino, only receive. You can send to the Arduino from the device paired and connected to the HC06.

What were you thinking that the HC-06 module was going to do? Take some information from somewhere? Send some information to somewhere? Your requirements could do with a bit more detail.

Steve

TheMemberFormerlyKnownAsAWOL:
From your original post

That was a mistake

slipstick:
What were you thinking that the HC-06 module was going to do? Take some information from somewhere? Send some information to somewhere? Your requirements could do with a bit more detail.

Steve

I just want it to send the data, received from ecg module (AD8232), then using processing app I will get the results I need

cattledog:
If you want to have the HC-06 send the value to something that is paired and connected to the HC-06, then I think no changes are needed.

Disconnect the HC-06 from Rx and Tx when you download the code, and then reconnect it. The Serial.print(analogRead(A1)) should go to both the monitor and the HC06 which will send the value to the receiver.

With this setup you will not be able to use the monitor to send data to the Arduino, only receive. You can send to the Arduino from the device paired and connected to the HC06.

So, if I need to send received data to PC, than I dont need to change anything?

*EDIT: Added how my connection would probably look like

So, if I need to send received data to PC, than I dont need to change anything?

I have only used the bluetooth modules with a phone, but if the PC's bluetooth can find and pair with the HC06 you should be able to receive data into some terminal program which can read the pc's bluetooth serial port.

What happens when you try?

It is recommended to use a voltage divider between the Arduino Tx and the module Rx so that the HC06 Rx only sees 3.3v. There are many online tutorials about how to do this.

I just saw the revision to the wiring diagram.

The HC06 should have +5v on its Vcc. Rx and Tx logic is at 3.3v but the module is powered with 5v.

cattledog:
I just saw the revision to the wiring diagram.

The HC06 should have +5v on its Vcc. Rx and Tx logic is at 3.3v but the module is powered with 5v.

But datasheet says max voltage is 3.6V

cattledog:
I have only used the bluetooth modules with a phone, but if the PC's bluetooth can find and pair with the HC06 you should be able to receive data into some terminal program which can read the pc's bluetooth serial port.

What happens when you try?

It is recommended to use a voltage divider between the Arduino Tx and the module Rx so that the HC06 Rx only sees 3.3v. There are many online tutorials about how to do this.

Yes, processing is gonna get the data from the port, still I need to send it

The problem is that I can't try now, so I want at least to make it theoretically right

But datasheet says max voltage is 3.6V

The HC06 bluetooth module with the two chips(which run at 3.3v) is usually soldered onto a breakout board which has the Vcc and ground pins for power connection.

Typically those boards take 5v input, and it is usually silkscreened on the board. There are versions of the HC06 breakout board which have silkcreened on them power = 3.6v -- 6V

What exactly do you have?

thehandass:
The problem is that I can't try now, so I want at least to make it theoretically right

That really IS the problem. Connect as you propose. No change in code required. Disconnect Bluetooth first if you want to upload.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.