Bluetooth "within range" alarm

I find myself in need of creating a deterrent device to discourage my dog from travelling out my driveway/a way to alert my wife when he attempts to.

I have a small farm with a fenced front yard/border parameter but he feels the need to, when my wife is distracted, go visit the neighbour...

Ignoring the simple factors like "don't let him out of your site" or "keep him tethered" what I find myself in the need of is a way to detect when he is near the end of the driveway and set off a siren.

Should be simple enough with modern day bluetooth "Smart Tags" right? :o I mean all I want to do is "see" the smart tag clipped to the dog's collar and set off an alarm accordingly.

Initially I had a couple of HC-06 kicking around from another project so I ordered the following Smart Tag:

https://www.amazon.ca/gp/product/B017R7WD0I/ref=oh_aui_detailpage_o08_s00?ie=UTF8&psc=1

When the "Nut" (Smart Tag) arrived I quickly discovered that the HC-06 was a "slave only" device and I needed one that could be used as a "master"; so I ordered a HC-05. I had done a bit of research and discovered the "Nut" was Bluetooth 4.0 but had also read it should be backwards compatible to my basic bluetooth device.

What I read appeared to have been wrong.

I, as such, ordered up a HM-10 on a shield for the Arduino Uno I've been playing with. It showed up and I've been working with it a bit but making no reasonable headway. I'm familiar with sending commands to the Bluetooth devices and reading the responses back.

From what I can kind of gather the Smart Tag I picked up may utilise some kind of security; I can detect it using a BLE scanner on my phone when the tag is in paring mode but it quickly disappears. I don't seem to ever be able to see it using the HM-10 module on the Arduino. I also am not able to see my Bluetooth phone with it with the HM-10 module so I'm wondering if I'm doing something wrong.

In doing my digging I see where people are using these units to detect iBeacons - http://forum.arduino.cc/index.php?topic=288624.45

I set up the module as they explain:

AT+ROLE1
AT+IMME1
AT+SHOW1
AT+PWRM1

and then issue a AT+DISI? or AT+DISC? command and I never seem to get anything back.

Anyone out there have any other suggestions?

Also; given that I'm an extreme n00b I realise I've likely neglected to provide some key bit of information. Feel free to point that out and I'll answer in any way I can.

Well I did a bit more digging this evening. It appears I certainly am not alone in my quest; though I have yet to find anyone who has successfully done what I’m trying to do.

I guess I’ll continue talking to myself and using this thread as a placeholder for information I find from around the interwebz.

This guy created a sketch titled “Discover other BLE devices”

However, according to the comments, one of the commands is only for the HM11 - the AT+FILT0 command doesn’t work on HM10’s

Here are some people talking about the AT+FILT0 being removed as of firmware 530?

Here is another person trying to do something similar (maybe I need to find myself a Nut Mini that broadcasts all the time?)

In doing some more digging I discovered there are some clone HM10’s around, that digging lead to this sketch which helps you figure out what you have:

Confirmed I have a proper HM-10.

FINALLY! A bit of progress!

Using the command I found from here (translated):

I can see the “nut” (While it is in programming mode)

AT .. OK
AT+ROLE1 .. OK
AT+RESET .. OK
AT+SHOW1 .. OK
AT+IMME1 .. OK
AT+DISI? .. OK
+DISISOK+DISCSOK+DIS1:EE0F9B5D520AOK+NAME:nut
OK+DISCE

Nowhere have I found any suggestion of how to connect to the damn “Smart Tag” yet though, so it knows to pair to the device.

More to come as I find time.

Well I did a bit more digging this evening. It appears I certainly am not alone in my quest; though I have yet to find anyone who has successfully done what I'm trying to do.

I guess I'll continue talking to myself and using this thread as a placeholder for information I find from around the interwebz.

This guy created a sketch titled "Discover other BLE devices"

However, according to the comments, one of the commands is only for the HM11 - the AT+FILT0 command doesn't work on HM10's

Here are some people talking about the AT+FILT0 being removed as of firmware 530?

Here is another person trying to do something similar (maybe I need to find myself a Nut Mini that broadcasts all the time?)

In doing some more digging I discovered there are some clone HM10's around, that digging lead to this sketch which helps you figure out what you have:

Confirmed I have a proper HM-10.

FINALLY! A bit of progress!

Using the command I found from here (translated):

I can see the "nut" (While it is in programming mode)

AT .. OK
AT+ROLE1 .. OK
AT+RESET .. OK
AT+SHOW1 .. OK
AT+IMME1 .. OK
AT+DISI? .. OK
+DISISOK+DISCSOK+DIS1:EE0F9B5D520AOK+NAME:nut
OK+DISCE

Nowhere have I found any suggestion of how to connect to the damn "Smart Tag" yet though, so it knows to pair to the device.

More to come as I find time.