Tracking iPhones.

Posted on
Sun Mar 03, 2019 6:21 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Tracking iPhones.

Hi Karl

I've come across this Pi code, used to mqtt to HA. It was looking for a non indigo alternate to your code when I was telling depends how great it is.
I wondering if this way of tracking iPhones is new (since your last comment back on 2016 on them) and whether it could work in piBeacon? I don't really understand the differences between all the methods.

https://github.com/andrewjfreyer/monito ... ce-problem

Cheers.


Sent from my iPhone using Tapatalk

Posted on
Sun Mar 03, 2019 7:27 am
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

pibeacon does the following:

1.listens to any beacon bluetooth broadcasts, similar to mentioned method, uses python directly calls to BLE stack
2. sends connect requests to phones via bluetooth. to track if device is present, similar to mentioned method. = BLEconnect

piBeacon does NOT use wifi to track devices.

The idea is the same for the mentioned article.

Monitor uses command line HCI-tool utilities, pibeacon uses a mix of HCI-tools and direct python BLE calls

What PiBeacon does in addition:. it adds management of several RPI, to better cover area, determines X,Y,Z positions.
That's is seriously limited by walls etc. You determine see if a device is in the room (closest RPI), but the exact position is physically limited by absorption of EM waves in buildings.
One would need to to do an area scan every meter or so (put an ibeacon at every place in the house, measure go to next) , record that, create a map of signal strength -> coordinates
Then do a reverse mapping /fitting with actually received signal strengths by all RPIs.

so in summary "METHOD" looks promising. uses similar tools to get beacons and BLE device responses

Karl


the tools used by monitor and presence, rest is management of devices etc.
Code: Select all
 result=$(hcitool -i $hci_device name "$1" 2>&1 | grep -v 'not available' | grep -vE "hcitool|timeout|invalid|error" )
and
known_device_rssi=$(hcitool cc $known_addr; avg_total=""; for i in 1 2 3; do scan_result=$(hcitool rssi $known_addr 2>&1); scan_result=${scan_result//[^0-9]/}; [[ "$scan_result" == "0" ]] && scan_result=30; counter=$((counter+1)); avg_total=$((avg_total + scan_result )); sleep 0.5; done; printf "$(( avg_total / counter ))" )

Posted on
Sun Mar 03, 2019 9:26 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

Thanks for the detailed reply.
So is the difference that monitor can see iPhones with minimal impact to battery but can't tell signal strength or only one pi at a time so can't triangulate with multiplie Pis?

A simple up / down based on always on Bluetooth rather than WiFi which goes to sleep would be useful even if there was no position information?





Sent from my iPhone using Tapatalk

Posted on
Sun Mar 03, 2019 12:32 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

No, both use the same tool to detect the iPhone.

Pibeacon: bleconnect uses the same hcitool


Sent from my iPhone using Tapatalk

Posted on
Sun Mar 03, 2019 1:11 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

Thanks. But I'm sure I've seen this impact my battery life on default 90 seconds. Is that what you see too? Maybe I'll set it to 5 mins so I get instant up and accept a slow down time in exchange for a better presence detection whilst I'm home.


Sent from my iPhone using Tapatalk

Posted on
Sun Mar 03, 2019 2:03 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

I have it running on several rpi going after one iPhone. Have correct uptime and have not seen any battery impact.

This has changed with one of the latest iOS releases.



Sent from my iPhone using Tapatalk

Posted on
Sun Mar 03, 2019 3:46 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Tracking iPhones.

Cheers... will give it another go.

Should have known you'd have it already implemented.

Posted on
Sun Mar 03, 2019 5:10 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Tracking iPhones.

Actually I was wrong


After I switched from command line to python calls for bleconnect it got better.

So pibeacon does not use hcitool command line but python ble calls




Sent from my iPhone using Tapatalk

Posted on
Wed Mar 20, 2019 2:02 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

Hi Karl,

All ok with using BLE connect on iPhone and watch, no noticeable battery issues. Now I have 4 Pis setup and looking to track location within the house, is there any reason why BLE connect devices do not get plotted? I see they show distance to each Pi, so could the same logic be applied to them as the beacons?

thanks

Posted on
Wed Mar 20, 2019 3:25 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

On my list to do. I am in Europe for 3 weeks.


Sent from my iPhone using Tapatalk

Posted on
Wed Mar 20, 2019 3:43 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

Amazing. Thank you.


Sent from my iPhone using Tapatalk

Posted on
Thu May 09, 2019 10:58 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

Hi Karl. Any news on getting this to work?


Sent from my iPhone using Tapatalk

Posted on
Thu May 09, 2019 11:10 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

Was busy and now I am out for 3 weeks again. Will try to squeeze it in over the weekend.


Sent from my iPhone using Tapatalk

Posted on
Thu May 09, 2019 11:38 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Tracking iPhones.

No rush, but now I've got everything working after a move to a new Mac I was wondering if I had any new toys to play with. Whenever is good with you, it's hardly critical


Sent from my iPhone using Tapatalk

Posted on
Fri May 10, 2019 8:42 am
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: Tracking iPhones.

have it working, still doing some testing.

Karl

Who is online

Users browsing this forum: No registered users and 6 guests