This is how I did finally implement the fabulous approach outlined by VillageTech.
Hardware
Wiring
The default pin for Onewire devices on the Pi is GPIO 4
. So I wired GND
to the sleeve of the plug and connected the tip to the mentioned GPIO pin.

A token
All I need for a token is the DS18B20 chip and a 3.5mm Jack.
Then solder the GND and VCC pin of the chip together and connect it to the sleeve. Add some head-shrink tubing to the middle pin to prevent shorts and connect it to the tip of the jack.
Both jacks work the ones with two rings and the one with just the tip.

Pull up resistor
I did decide not to use an external pull up resistor, since the Pi has internal Pull up resistors.
Let's not fry headphones
As flawr correctly pointed out is the fact that if it looks like a 3.5mm audio jack people might be tempted to insert headphones.
As long as we're using parasitic power, where only a ground wire and a high impedance GPIO output is exposed to the socket, we should be safe, since we don't have a VDD line that might create a short circuit through the low resistance of the headphones.
Configuration
Add the following line to /boot/config.txt
:
dtoverlay=w1-gpio
There are more options. You can find more in the /boot/overlays/README
of your Pi.
Some sources suggested to add the two modules w1-gpio
and w1_therm
to /etc/modules
, however I found out that the device-tree overlay entry in the boot/config.txt
was sufficient for my purposes.
Now reboot the device.
Add a pullup via software in python:
import RPi.GPIO as GPIO
GPIO_PIN_NUMBER=14
GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_PIN_NUMBER, GPIO.IN, pull_up_down=GPIO.PUD_UP)
As soon as I created this pull up I could detect the tokens in /sys/bus/w1/devices/
with the 28
prefix in another terminal window:
$ ls /sys/bus/w1/devices/
28-00000aabbccd w1_bus_master1
After 10 seconds or so the entries in devices
would disappear. I had to create the following configuration, so that the devices would disappear after a second or so:
sudo nano /etc/modprobe.d/w1.conf
Now add the contents to the file and reboot the device again:
options wire timeout=1 slave_ttl=1
In my setup this file did not exist previously.
Software
I did create a python class that would look for changes in the file system and tell me if a new token was connected or if all tokens were disconnected.
import os
import thread
import time
from datetime import datetime, timedelta
class W1Service(object):
__instance = None
def __new__(cls):
# Singleton initializer
if W1Service.__instance is None:
W1Service.__instance = object.__new__(cls)
return W1Service.__instance
on_all_token_removed = None
on_token_added = None
is_scanning = False
def start_scan(self, delay=10):
return thread.start_new_thread(self.scan, (delay,))
def scan(self, delay=10):
W1Service.is_scanning = True
last_token = None
current_token = ''
current_token_timestamp = datetime.now() - timedelta(days=1)
while W1Service.is_scanning:
file = open('/sys/devices/w1_bus_master1/w1_master_slaves')
all_tokens = file.readlines()
file.close()
no_token_attached = len(all_tokens) == 0 or 'not found.\n' in all_tokens
if no_token_attached and self.on_all_token_removed and current_token != last_token:
self.on_all_token_removed()
current_token = None
last_token = None
for line in all_tokens:
current_token = line.split("\n")[0]
time_diff = datetime.now() - current_token_timestamp
if self.on_token_added and last_token != current_token and time_diff.seconds >= 3:
# Test if the token is still attached
if os.path.exists('/sys/bus/w1/devices/' + current_token + '/w1_slave'):
self.on_token_added(current_token)
last_token = current_token
else:
current_token = None
else:
current_token = None
time.sleep(delay)
def stop_scan(self):
W1Service.is_scanning = False
Now using the created service is quite simple:
import time
import w1_service
def token_added(token):
print("Connected %s" % token)
def all_token_removed():
print('All tokens were removed')
service = w1_service.W1Service()
service.on_token_added = token_added
service.on_all_token_removed = all_token_removed
service.start_scan(0)
while True:
# The scan runs in a seperate thread
time.sleep(1)
This will produce the following output when inserting different tokens
All tokens were removed
Connected 28-00000aabbccd
All tokens were removed
Connected 28-00000ffddeea
All tokens were removed
Connected 28-00000bbddaa1
Connected 28-00000ffddeea
All tokens were removed
Connected 28-00000bbddaa1
All tokens were removed
Please note that my code accounts for the fact that in my setup only one token can be added at a time. So only the newest token is interesting for me. If multiple tokens should be added, which the onewire protocol supports nicely, the code would have to be updated.
Application
Now whenever a token is inserted it is matched to a person that my nice can then send messages and receive messages from

Notes and other considerations
The Onewire tokens could in theory be added in parallel which would offer new capabilities like group chat or the like. So you could connect ten tokens on a single GPIO.
I also like the approach with the passive R/C approach, which is very pragmatic and simple to set up as well. I might try this out in another project. However, a friend had some
I did consider adding iBeacons as tokens but then I would have to account for different RSSI of the tokens and it would not be 100% clear which token was active at any given time.
A friend was suggesting to to add a card reader and use old 1GB photo SD cards which could have the picture stuck on the front. The card could contain all the information about the person plus a personalised greeting or the like. The same would work with old USB-Sticks as tokens.
It was tremendous fun to implement this and to see how much interest my question stirred in people. I thank you guys all and wish you a lovely 0x1414
(=2020) :-)