laagland
Posts: 6
Joined: Tue May 23, 2017 8:33 am

Detect where Pi is physically docked

Mon Jul 16, 2018 1:56 pm

For a project I'm using a single PiZero with 2 different setups. I'm looking for the easiest/cheapest way for the Pi to know where it is 'docked'.

I've looked at RFID or Bluetooth but thats seems overly complicated/expensive for this use case.

Maybe someone has a better idea?

scotty101
Posts: 2987
Joined: Fri Jun 08, 2012 6:03 pm

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 2:09 pm

Perhaps you could describe what the Pi is connected to?

There may be a way to detect a specific serial number from one of the peripherals or a MAC address from an Ethernet adapter but impossible to tell you what unless we know what is connected at each "dock"
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

hippy
Posts: 3358
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 3:07 pm

If connected to something that could be used to reveal what it is connected to as suggested. A trace route might help if there's an internet connection.

You could just add a switch. Though, for an automatic determination, perhaps a compass chip or something could be used if it is reliably oriented differently in the two places. Even a tilt switch with labels on the case; "this way up when here", "this way up when there". Or a reed relay in the case and having a magnet under it when in one place but not another.

You could create special power cables at each location which can identify themselves.

More details about the two set-ups, what they have in common, what's different, would help elicit the best solutions.

laagland
Posts: 6
Joined: Tue May 23, 2017 8:33 am

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 3:27 pm

hippy wrote:
Mon Jul 16, 2018 3:07 pm

You could create special power cables at each location which can identify themselves.
This is interesting, how would that work?

The 'docking' station would be independant of the electronics connected to it, so the Pi would need to know based on the dock.
Also, more than 2 docks should be possible.

B.Goode
Posts: 6192
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 3:39 pm

scotty101 wrote:
Mon Jul 16, 2018 2:09 pm
Perhaps you could describe what the Pi is connected to?


and
The 'docking' station would be independant of the electronics connected to it, so the Pi would need to know based on the dock.

Another try...

What is this 'docking station?'


(Does it exist, or is it an imaginary solution to some problem?)

hippy
Posts: 3358
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 4:15 pm

laagland wrote:
Mon Jul 16, 2018 3:27 pm
hippy wrote:
Mon Jul 16, 2018 3:07 pm
You could create special power cables at each location which can identify themselves.
This is interesting, how would that work?
One solution would be to provide power to your Pi via a 3 or more pin connector, XLR, DIN or anything similar. One pin 0V, one pin 5V, another pin left open circuit for one cable, connected to 0V in the other.

That third pin connection can be read by a Pi GPIO with an internal pull-up enabled. When it reads low it knows it's connected using one cable, when high it's using the other.

hippy
Posts: 3358
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 4:30 pm

laagland wrote:
Mon Jul 16, 2018 3:27 pm
Also, more than 2 docks should be possible.
If you need to identify one of a number of docks you can extend the third pin open / short to 0V solution to each dock having a different resistor in each. You can measure the resistance, using a voltage divider and ADC or the time taken to discharge a capacitor.

Or you could get fancy and have a small micro in each dock and have it send a serial ID code and have the Pi read that using its UART. Or put a 1-wire device in each dock and have the Pi read its serial number.

If happy to have a larger connector, D-9 say, you could use more pins and hard code a binary open / short to 0V pattern in the dock, have the Pi read that. Or have the Pi determine which pins are shorted together or connected via diodes.

laagland
Posts: 6
Joined: Tue May 23, 2017 8:33 am

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 6:17 pm

hippy wrote:
Mon Jul 16, 2018 4:30 pm
laagland wrote:
Mon Jul 16, 2018 3:27 pm
Also, more than 2 docks should be possible.
If you need to identify one of a number of docks you can extend the third pin open / short to 0V solution to each dock having a different resistor in each. You can measure the resistance, using a voltage divider and ADC or the time taken to discharge a capacitor.

Or you could get fancy and have a small micro in each dock and have it send a serial ID code and have the Pi read that using its UART. Or put a 1-wire device in each dock and have the Pi read its serial number.

If happy to have a larger connector, D-9 say, you could use more pins and hard code a binary open / short to 0V pattern in the dock, have the Pi read that. Or have the Pi determine which pins are shorted together or connected via diodes.
Awesome, exactly why I read these forums. This will work perfectly, thanks! :)

hippy
Posts: 3358
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 6:38 pm

laagland wrote:
Mon Jul 16, 2018 6:17 pm
This will work perfectly, thanks! :)
Any chance of saying which "this" it is which you have chosen ?

laagland
Posts: 6
Joined: Tue May 23, 2017 8:33 am

Re: Detect where Pi is physically docked

Mon Jul 16, 2018 7:03 pm

hippy wrote:
Mon Jul 16, 2018 6:38 pm
laagland wrote:
Mon Jul 16, 2018 6:17 pm
This will work perfectly, thanks! :)
Any chance of saying which "this" it is which you have chosen ?
I have some resistors lying around, so I'll try those

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 6 guests