Bluetooth Proximity Sensor
-
ok.. mine enters AT mode.. and I can get it to send and receive data.. I may as well keep plugging at it so
-
I have given up.. I cant get anywhere with this but I think its cause I bought hc-06.. Are you closer?
@Konrad-Walsh For what I know, the HC-06 is automatically configured to take in AT commands, so that shouldn't be a problem, although mine (that I got today) seems to be defective as I send it the AT command, but I'm getting no answer.
-
I accidentally feed the first module with reversed polarity. It did not like that very much. :(
The second module arrived this week, but I haven't hooked it up yet. Planned on using software serial and had a test sketch going something like this:
/* $Id$ Serial terminal for the HC-05 bluetooth module. Sets up BT module and allow user interaction with the device via the Arduino Serial Monitor. Wiring of BT HC-05 device to the Arduino RX -> 11 TX -> 10 KEY -> 9 */ #include <SoftwareSerial.h> // Bluetooth to Arduino pins. #define BTkey 9 #define BTrxPin 10 #define BTtxPin 11 enum { SYNC, ASYNC }; SoftwareSerial BTSerial(BTrxPin, BTtxPin); // Send a command to the bluetooth device. // mode ASYNC - don't want for the response // mode SYNC - wait for the response void sendBluetoothCommand(String cmd, uint8_t mode) { Serial.print(mode == SYNC ? "SYNC> " : "ASYNC> "); Serial.println(cmd); BTSerial.println(cmd); if (mode == ASYNC) return; char ch = 0; while (ch != '\n') { if (BTSerial.available()) { ch = BTSerial.read(); Serial.write(ch); } } } void setup() { Serial.begin(57600); ///////////////////////////////////////////////////////// // SETUP BLUETOOTH // define pin modes for tx, rx: pinMode(BTrxPin, INPUT); pinMode(BTtxPin, OUTPUT); // Switch module to AT mode pinMode(BTkey, OUTPUT); digitalWrite(BTkey, HIGH); BTSerial.begin(38400); sendBluetoothCommand("AT", SYNC); sendBluetoothCommand("AT+NAME=blueNode", SYNC); // AT+ROLE=p1 // p1 - 0 Slave Role, 1 Master Role, 2 Slave-Loop role. sendBluetoothCommand("AT+ROLE=1", SYNC); // AT+INQM=p1,p2,p3 // p1 - 0 inquire_mode_standad, 1 inquire_mode_rssi // p2 - maximum number of bluetooth devices response // p3 - the maximum of limited inquiring time. 1~48 (1.28s ~ 61.44s) // 15*1.28 = 19sec sendBluetoothCommand("AT+INQM=0,5,15", SYNC); } 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()); }And.. the first module was of the wrong type (I think). Must support master-mode if I understand it correctly. The second one I bought was this type.
-
@hek When you say you inverted the polarity... are you talking about VCC and GRD? or Rx and TX?
-
i am "semi" abandoned it.. I couldn't get it work at all...
-
i am "semi" abandoned it.. I couldn't get it work at all... but I cant say I fully grasp the syntax yet. Hopefully @HEK gets the notion...
-
i am "semi" abandoned it.. I couldn't get it work at all... but I cant say I fully grasp the syntax yet. Hopefully @HEK gets the notion...
@Konrad-Walsh At the end I got the HC06 to work, I'm finally understanding all of this, if you tell me what you're trying to accomplish and the code u have I might be able to help. Also the module you're using.
-
I really like this idea, but for it to be effective we need to measure the decibel level of the connection and not just connected/disconnected state. Is this possible?
-
I really like this idea, but for it to be effective we need to measure the decibel level of the connection and not just connected/disconnected state. Is this possible?
@Øyvind-A.-Espnes I haven't tried it, but with the AT+INQM command you can specify wether you want the RSSI of the device when issuing the AT+INQ command. This document can better explain it.
After that it should just be a matter of parsing the resulting string and extract the signal strength.
-
I was thinking about going this route, but until last weekend I was using Tasker and having it tell Vera that I am here when my phone connects to my Wifi. I bought a new phone and I can't get it to stay connected when it hasn't been used in a while, so I have to rethink...
While a Mysensors option could be good, what I am going to do is use my many Android tablets that I have throughout my home and have them always searching my my mobile. With them all throughout my home, I won't have to worry about bluetooth range.
Sorry it isn't a Mysensors option, but I thought I would share what I am going to do :-)
-
Hi,
Did you get anywhere with this? I would like to build a bluetooth sensor myself but since this is an old thread, I am not really sure if the market has been modernized a little with bluetooth devices..
Thanks!