1

It all started when I tried connecting an hm10-nano to a relay board which is Bluetooth enabled. Here is my nano with the hm10 module:

nano-hm10

And here is the relay board's BT module, which looks like an hm12:

relay'sBT

I started by connecting the nano-hm10 to my mac and using the Arduino IDE to send the module commands. The hm12 has a mac for ble and another for edr:

ble:00-0e-0b-00-75-12 edr:00-0e-0e-00-75-12

The hm10 does connect because:

  1. I get a steady blue led on the hm10 after AT+COmacble
  2. I get the macble from the hm10 module after AT+RADD?
  3. I hear the relay (channel1) open on the relay board after AT+COmacble

When I try the following steps -> I get these results 1. Unplug relay board -> hm10 blue blinking 2. Plug relay board -> hm10 blue steady, relay BT module blue led steady 3. AT commands to hm10 thru serial monitor stop working (expected) 4. AT+CO000e0e007512 to hm10 -> turns on relay 1 for some reason 5. Unplug relay -> RADD on hm10 = 00-0e-0b-00-75-12 instead of 00-0e-0e-00-75-12

My questions are: A. Is it possible to send data from an hm10 to hm12? B. Why does the relay get activated when I connect to the hm12-relay board? C. I just realized my sketch's bluetooth.print() sends a command from the nano to the hm10, not to from the hm10 to the hm12. How can I send the data from the nano to the hm12?

Sketch:

#include <SoftwareSerial.h>
int bluetoothTx = 10;  // TX-O pin of bluetooth
int bluetoothRx = 11;  // RX-I pin of bluetooth
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup(){
  Serial.begin(9600);  // Begin the serial monitor at 9600bps
  delay(200);
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
  Serial.print("send...");
  bluetooth.print("AT");
    bluetooth.print("110"); //open relay 1
    delay(2000);
  bluetooth.print("100"); //close relay 1
}
void loop(){
  if(bluetooth.available()){
    Serial.print((char)bluetooth.read());
  }
  if(Serial.available()){
    bluetooth.print((char)Serial.read());
  }
}

migrated from electronics.stackexchange.com Aug 25 '16 at 0:57

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Try switching the rx and tx pins – Durk Jun 20 '17 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.