User avatar
DaedalusOS
Posts: 13
Joined: Mon Aug 26, 2019 8:08 pm

Wireless Distance Sensing?

Tue Nov 05, 2019 3:54 pm

Greeting!

I have a Pi 4 4GB, and I've got an idea for a project, however unfortunately I'm really having a hard time figuring out just what to properly use to accomplish my goal.

What I want to do is basically setup a scavenger hunt using my Pi. I want to have small little devices (or anything at this point) that I can hide around the area, and the Pi can sense the current distance from itself to that object. The actual area that these little things will be hidden in is my apartment, so really not that big of a search grid. In a perfect world, I would want whatever devices to be able to be detected by the Pi from a handful of feet away so that I can throw in a buzzer or an RGB light that would go from blue to orange (cold to hot) the closer you get to the device.

I thought maybe what I could do is setup some Pi Zero's and connect them to my main Pi with bluetooth and then use RSSI to see if I can get the distance, however I'm not entirely sure that will be reliable enough.

Does anyone have any ideas here? Just looking for some advice.

Thanks, and I really appreciate it!

mattmiller
Posts: 2164
Joined: Thu Feb 05, 2015 11:25 pm

Re: Wireless Distance Sensing?

Tue Nov 05, 2019 4:06 pm

Like the idea :)

I'm thinking that Fing on a android phone works pretty well to detect strength of WiFi access points

So, you could turn some PiZeroW into access points and hide them

Stick them all on same WiFi channel.

Then "just" need to get your portable Pi to emulate Fing (but just scanning the same channel as the hidden PiZeros)

Use a Neopixel strip to indicate sig strength

Just my thoughts

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Tue Nov 05, 2019 4:38 pm

It sounds like you need battery power and small size.
Maybe Pi ZeroW plus a USB power pack but maybe ESP32 or ATTiny which could run on a coin cell for a lot longer than the Pi.

For sensing Bluetooth might be an easy option. You could read the RRSI signal strength of each Bluetooth or Wi-Fi device. Useful range maybe something like 4 to 15 metres for BT and 10 to 50metres for Wi-Fi? As you say that may not give reliable range.

You could set up dome fixed beacons and have each target device read RSSI to each of those and triangulate and average it own position. If every device can report a position relative to those fixed points you might get better ranging.
I don't know. Only speculating.

Another option could be ultrasonic chirps. There are lots of cheap transducers out there. HC-SR04 distance sensors.
If you made the targets listen for a ping from the seeker's device and instantly ping back. Then the time between the initial ping an the second / 'echo' relates to the distance to the target.
I say second echo because the seeker's SR04 will get a echo from it's own ping from nearby objects then a bit later it should hear the reply ping from the target.

You could use Wi-Fi or Bluetooth to tell targets to reply or remain silent so that the seeker devices isn't overwhelmed by lots of replies.

Maybe send a BT message to activate target 1 an silence all others, do the ping to get range to target one.
Repeat for each of your targets. Then sort the ranges to get the closest one and use that for your hot / cold signal.

User avatar
DaedalusOS
Posts: 13
Joined: Mon Aug 26, 2019 8:08 pm

Re: Wireless Distance Sensing?

Tue Nov 05, 2019 7:08 pm

PiGraham wrote:
Tue Nov 05, 2019 4:38 pm
It sounds like you need battery power and small size.
Maybe Pi ZeroW plus a USB power pack but maybe ESP32 or ATTiny which could run on a coin cell for a lot longer than the Pi.

For sensing Bluetooth might be an easy option. You could read the RRSI signal strength of each Bluetooth or Wi-Fi device. Useful range maybe something like 4 to 15 metres for BT and 10 to 50metres for Wi-Fi? As you say that may not give reliable range.

You could set up dome fixed beacons and have each target device read RSSI to each of those and triangulate and average it own position. If every device can report a position relative to those fixed points you might get better ranging.
I don't know. Only speculating.

Another option could be ultrasonic chirps. There are lots of cheap transducers out there. HC-SR04 distance sensors.
If you made the targets listen for a ping from the seeker's device and instantly ping back. Then the time between the initial ping an the second / 'echo' relates to the distance to the target.
I say second echo because the seeker's SR04 will get a echo from it's own ping from nearby objects then a bit later it should hear the reply ping from the target.

You could use Wi-Fi or Bluetooth to tell targets to reply or remain silent so that the seeker devices isn't overwhelmed by lots of replies.

Maybe send a BT message to activate target 1 an silence all others, do the ping to get range to target one.
Repeat for each of your targets. Then sort the ranges to get the closest one and use that for your hot / cold signal.
I've done some testing with having 2 different HC-SR04, however I don't believe that this route will work, at least not with these specific modules. It seems that as soon as the module has received its echo, it stops listening for more echo's, which puts this part dead in its tracks.

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Tue Nov 05, 2019 7:51 pm

DaedalusOS wrote:
Tue Nov 05, 2019 7:08 pm

I've done some testing with having 2 different HC-SR04, however I don't believe that this route will work, at least not with these specific modules. It seems that as soon as the module has received its echo, it stops listening for more echo's, which puts this part dead in its tracks.
You don't have to use HC-S04s. There are various transducers available and it may also be possible to modify HC-SR04 to change how they work.

Maybe useful sites:

https://www.davidpilling.com/wiki/index.php/HCSR04

http://www.pcserviceselectronics.co.uk/ ... hp#circuit

The em78P153S chip used is not reprogrammable so you can't hack it at that level but the circuit isn't that complicated. It could be built on a breadboard and use an Arduino or other microcontroller.

Here's one based in a reprogrammable PIC

https://www.robot-electronics.co.uk/htm/srf04tech.htm

User avatar
Gavinmc42
Posts: 4191
Joined: Wed Aug 28, 2013 3:31 am

Re: Wireless Distance Sensing?

Wed Nov 06, 2019 12:56 am

I'm waiting for someone to make a Bluetooth 5.1 diversity antenna Hat/module.

Use RF module and the RSSI feature.
Another way is RFID chips and RDF methods, low freq rf transmitter and directional coil antennas.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Wed Nov 06, 2019 9:45 am

Gavinmc42 wrote:
Wed Nov 06, 2019 12:56 am
I'm waiting for someone to make a Bluetooth 5.1 diversity antenna Hat/module.

Use RF module and the RSSI feature.
Another way is RFID chips and RDF methods, low freq rf transmitter and directional coil antennas.
You could put multiple USB BT adaptors on a Pi, arranging antennas in a wide triangle or whatever.
That might give useful RSSI data. But maybe phase is more important.

Do you know what sort of range can be achieved with low cost RFID? Presumably that would use active (powered) tags not the usual passive ones.

User avatar
Gavinmc42
Posts: 4191
Joined: Wed Aug 28, 2013 3:31 am

Re: Wireless Distance Sensing?

Wed Nov 06, 2019 11:14 am

Do you know what sort of range can be achieved with low cost RFID
Depends on the transmit power and receiver sensitivity.

RFID normally have a passive transponder but powered ones have much longer range.

Those MSF 60KHz radio clock chips and a 60KHz low power local transmitter can have meters of range.
The early 3D positioning gear Polonius used a low freq 3 coils system.
Newer stuff these days like Pozxy use UWB - Ultra Wide Band RF methods.

RSSI and a Reflector on BT modules could make them directional.
RF and Ultrasonic chirps has been used as well.
Even IR beacons for angle/position and "North Star" roof projectors.

Nothing "prefect" yet for the home hacker.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Wed Nov 06, 2019 12:52 pm

Posyx looks good but expensive in RPi terms.

https://www.pozyx.io/shop

deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Wed Nov 06, 2019 7:52 pm

DaedalusOS wrote:
Tue Nov 05, 2019 3:54 pm
Greeting!

I have a Pi 4 4GB, and I've got an idea for a project, however unfortunately I'm really having a hard time figuring out just what to properly use to accomplish my goal.

What I want to do is basically setup a scavenger hunt using my Pi. I want to have small little devices (or anything at this point) that I can hide around the area, and the Pi can sense the current distance from itself to that object. The actual area that these little things will be hidden in is my apartment, so really not that big of a search grid. In a perfect world, I would want whatever devices to be able to be detected by the Pi from a handful of feet away so that I can throw in a buzzer or an RGB light that would go from blue to orange (cold to hot) the closer you get to the device.

I thought maybe what I could do is setup some Pi Zero's and connect them to my main Pi with bluetooth and then use RSSI to see if I can get the distance, however I'm not entirely sure that will be reliable enough.

Does anyone have any ideas here? Just looking for some advice.

Thanks, and I really appreciate it!
There are two guides here on how to make e.g. a RPi Zwro W into an iBeacon or an Eddystone beacon:
https://pimylifeup.com/raspberry-pi-ibeacon/
https://pimylifeup.com/raspberry-pi-eddystone-beacon/

I haven't figured out the tx power byte in the Eddystone beacon message or the signal power byte in the iBeacon message. But it should be possible to get some sort of crude distance measurement out of.

/Mogens

User avatar
Gavinmc42
Posts: 4191
Joined: Wed Aug 28, 2013 3:31 am

Re: Wireless Distance Sensing?

Thu Nov 07, 2019 2:35 am

Could an Android BT apps read the iBeacon RSSI?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Thu Nov 07, 2019 7:32 am

Gavinmc42 wrote:
Thu Nov 07, 2019 2:35 am
Could an Android BT apps read the iBeacon RSSI?
Yes, RSSI is read and reported per default by most BT apps, but I don't know what the tx power byte does in relation to that.
Some beacon apps are capable of displaying an approximate distance, but I don't know what they do to make that happen.

/Mogens

User avatar
DaedalusOS
Posts: 13
Joined: Mon Aug 26, 2019 8:08 pm

Re: Wireless Distance Sensing?

Thu Nov 07, 2019 7:50 pm

Alright, after reading all of your responses I feel my exact goal may be a little more complex than what I wish to put into this right now, so I'm going to think about alternative methods to achieve something similar.

How about RFID? My only issue here is that after looking some of this up, I'm worried about the range. I would like to be able to detect if I'm within range of an RFID chip by maybe a couple feet, and preferably a passive one at that. Any ideas? Is there any way to detect range as well, or no?

Thanks!

deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Thu Nov 07, 2019 10:13 pm

DaedalusOS wrote:
Thu Nov 07, 2019 7:50 pm
Alright, after reading all of your responses I feel my exact goal may be a little more complex than what I wish to put into this right now, so I'm going to think about alternative methods to achieve something similar.

How about RFID? My only issue here is that after looking some of this up, I'm worried about the range. I would like to be able to detect if I'm within range of an RFID chip by maybe a couple feet, and preferably a passive one at that. Any ideas? Is there any way to detect range as well, or no?

Thanks!
RFID is not the way. You can get RSSI on the readings in the same way as for Bluetooth, but it requires expensive equipment in both reader and antenna. But the RSSI is not any better than with Bluetooth, and you have cheap beacons and cheap readers for Bluetooth.

I'd play a little more with Buetooth if I were you.

/Mogens

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Fri Nov 08, 2019 9:13 am

Not surprisingly there are a lot of phone apps claiming to "locate your Bluetooth devices"

I tried a couple but they don't seem effective. The reported signal strength doesn't vary with distance in a consistent way.

I used a Bluetooth speaker that was not connected. That means it keeps advertising itself so it can be discovered.
I'm not confident these apps would help me find BT devices.

You might as well just try to connect to the device from various locations which might tell you which one or two rooms a device is in.

User avatar
Gavinmc42
Posts: 4191
Joined: Wed Aug 28, 2013 3:31 am

Re: Wireless Distance Sensing?

Fri Nov 08, 2019 10:42 am

I tried a couple but they don't seem effective. The reported signal strength doesn't vary with distance in a consistent way.
Yep not the best finding solution.
Some TI RF chips are a bit better than BT chips for this.

But the new BT5.1 is supposed to do this.
Nordic's nRF52811 is one of the first chips, but I have yet to see usable positioning solutions for hackers.
This could change any month or week.

Hope it is soon, finance manager has given permission for making a robot lawn mower :D
Bt5.1 is a vital missing part of the puzzle.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Fri Nov 08, 2019 11:19 am

Gavinmc42 wrote:
Fri Nov 08, 2019 10:42 am
But the new BT5.1 is supposed to do this.
Nordic's nRF52811 is one of the first chips, but I have yet to see usable positioning solutions for hackers.
This could change any month or week.
That's exciting tech. Sub 1m accuracy with direction and elevation.

https://www.youtube.com/watch?v=c3XqbEKmNcM

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Fri Nov 08, 2019 11:22 am

This claims to be BT5.0 Eddystone beacon in a watch format. 1 yr battery life
https://www.amazon.co.uk/JINOU-OEM-Prog ... B07HQ9DJKG

User avatar
DaedalusOS
Posts: 13
Joined: Mon Aug 26, 2019 8:08 pm

Re: Wireless Distance Sensing?

Fri Nov 08, 2019 2:13 pm

I think I'm gonna go ahead and order a Pi Zero and see what I can do, and take a look at all of your suggestions.

In the event that I do choose to go with RFID, which type should I go with? I'd like it to be able to be detected from maybe a couple feet away, or maybe even just a foot away.

Thanks everyone for your input, I greatly appreciate it!


deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Sun Nov 10, 2019 6:58 pm

DaedalusOS wrote:
Fri Nov 08, 2019 2:13 pm
I think I'm gonna go ahead and order a Pi Zero and see what I can do, and take a look at all of your suggestions.

In the event that I do choose to go with RFID, which type should I go with? I'd like it to be able to be detected from maybe a couple feet away, or maybe even just a foot away.

Thanks everyone for your input, I greatly appreciate it!
Passive RFID detection range depends on the size and quality of the RFID tag and the chosen antenna.
Specielized equipment can give you ranges up to 10 meters, but ranges below 2 meters is the norm.
I'd think you can get 1 meter detection range with modest equipment.

But please note that you're dealing with directional equipment, as many RFID antennas are patch antennas, that only radiate in a hemispherical pattern.
So you'll have to point the antenna towards the RFID tag to detect it.

/Mogens

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Sun Nov 10, 2019 9:08 pm

deepo wrote:
Sun Nov 10, 2019 6:58 pm
ranges below 2 meters is the norm.
I'd think you can get 1 meter detection range with modest equipment.
The cheap maker kit I've seen is a range of a few centimetres (~2cm)

Can you give examples of kit that works at more than 10cm?

deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Sun Nov 10, 2019 9:27 pm

PiGraham wrote:
Sun Nov 10, 2019 9:08 pm
deepo wrote:
Sun Nov 10, 2019 6:58 pm
ranges below 2 meters is the norm.
I'd think you can get 1 meter detection range with modest equipment.
The cheap maker kit I've seen is a range of a few centimetres (~2cm)

Can you give examples of kit that works at more than 10cm?
Those are probably NFC tags or short range ID cards and access tags.
In my work I work with expensive RFID readers like Impinj R420 and patch antennas, but the price of those makes them out of reach for hobbyists like most of us here. They work at UHF frequencies.
Searching for "long range uhf rfid reader raspberry pi" gives a few results worth checking out.


/Mogens

PiGraham
Posts: 3678
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wireless Distance Sensing?

Mon Nov 11, 2019 8:08 am

deepo wrote:
Sun Nov 10, 2019 9:27 pm

Searching for "long range uhf rfid reader raspberry pi" gives a few results worth checking out.
Nothing specific that might suit this application?

There are things like this:
https://www.amazon.co.uk/reader-vehicle ... B018EFLJJI
which claim 3 to 5 metres reading range but would that give useful proximity range info under 3m?
It large for handheld use (20cm) and it's £150.

Then there is this one:
https://www.amazon.co.uk/dp/B075WY8DSR/ ... NrPXRydWU=
Similar price, range 10 to 150 cm which may be more appropriate 120 x 85 x 23 mm
.

deepo
Posts: 344
Joined: Sun Dec 30, 2018 8:36 pm

Re: Wireless Distance Sensing?

Mon Nov 11, 2019 9:40 am

PiGraham wrote:
Mon Nov 11, 2019 8:08 am
deepo wrote:
Sun Nov 10, 2019 9:27 pm

Searching for "long range uhf rfid reader raspberry pi" gives a few results worth checking out.
Nothing specific that might suit this application?

There are things like this:
https://www.amazon.co.uk/reader-vehicle ... B018EFLJJI
which claim 3 to 5 metres reading range but would that give useful proximity range info under 3m?
It large for handheld use (20cm) and it's £150.

Then there is this one:
https://www.amazon.co.uk/dp/B075WY8DSR/ ... NrPXRydWU=
Similar price, range 10 to 150 cm which may be more appropriate 120 x 85 x 23 mm
.
The latter RFID reader is handy, and acts as a USB HID keyboard device, so it should be easy to interface with it, as the ID of the RFID tag read is being sent as keyboard key presses.
But using RS232 as the first device does is not that hard to do either.

But for scavenger hunt a smart phone with a Bluetooth LE app, and either BLE tags or RPi Zero W's acting as BLE tags can get the OP most of what he needs, except for the feedback part. And it's cheap.

/Mogens

Return to “Other projects”