Talk to me: Phone booth

Communication device for overcomming loneliness in retirement homes.

IntermediateWork in progress20 hours130
Talk to me: Phone booth

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
LED (generic)
LED (generic)
×2
Flash Memory Card, SD Card
Flash Memory Card, SD Card
4 GB
×1
Microphone, Plug-In
Microphone, Plug-In
×1
PiFi DAC: I2S Interface HIFI DAC+ Sound Card For Raspberry PI
Itead PiFi DAC: I2S Interface HIFI DAC+ Sound Card For Raspberry PI
×1
Speaker / Loudspeaker Audio Connector, Chuck Type Strain Relief
Speaker / Loudspeaker Audio Connector, Chuck Type Strain Relief
JBL commercial speaker
×1
Through Hole Resistor, 330 kohm
Through Hole Resistor, 330 kohm
×1
Through Hole Resistor, 470 ohm
Through Hole Resistor, 470 ohm
×3

Software apps and online services

Raspbian
Raspberry Pi Raspbian
Raspbian 10

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless
Exacto knife
Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

.stl file of the shell cupola

Model of the shell cupola

.stl file of connector

Connector between the longer edges of the plates.

.dxf files of plates (numbered)

Each plate has its' own number.

Schematics

Schematics of electronics

Code

talk_to_me.py

Python
import RPi.GPIO as GPIO
import subprocess
import time

ffmpeg_stream = "ffmpeg -ar 80000 -f alsa -i plughw:1,0 -acodec mp2 -b:a 128k -f wav  udp://192.168.20.74:4444" #change it!! ip of remote end
ffmpeg_play = "ffplay -fflags nobuffer -flags low_delay -framedrop -strict experimental -nodisp udp:/192.168.20.248:4445" #change it!! local ip

#GPIO Mode (BOARD / BCM)
GPIO.setmode(GPIO.BCM)

GPIO_TRIGGER_0 = 23
GPIO_ECHO_0 = 24

GPIO_TRIGGER_1 = 18
GPIO_ECHO_1 = 25

GPIO.setup(GPIO_TRIGGER_0, GPIO.OUT)
GPIO.setup(GPIO_ECHO_0, GPIO.IN)

GPIO.setup(GPIO_TRIGGER_1, GPIO.OUT)
GPIO.setup(GPIO_ECHO_1, GPIO.IN)

GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(9, GPIO.OUT)

def distance(trig, echo):
    timeout = time.time()
    GPIO.output(trig, True)

    time.sleep(0.00001)
    GPIO.output(trig, False)

    start_time = time.time()
    stop_time = time.time()

    while GPIO.input(echo) == 0:
        start_time = time.time()

    while GPIO.input(echo) == 1:
        stop_time = time.time()
        if stop_time - timeout > 0.05:
         return 1000

    time_elapsed = stop_time - start_time
    distance = (time_elapsed * 34300) / 2

    return distance

print("test")

levo_desno = 0
ld_time = 0
state = 0
stream = None
play = None
GPIO.output(7, False)
GPIO.output(8, False)
while True:
	d = distance(GPIO_TRIGGER_0, GPIO_ECHO_0)
	if d > 10 and d < 30:
		if state == 0:
			state = 1
			ld_time = time.time()
		if state == 1 and (time.time() - ld_time) > 0.5:
			GPIO.output(8, True)
			time.sleep(0.3)
			GPIO.output(8, False)
			time.sleep(0.3)
			GPIO.output(8, True)
			time.sleep(0.3)
			GPIO.output(8, False)
			if stream and play:
				stream.kill()
				play.kill()
				GPIO.output(8, False)
			state = 2
	if d > 35 and d < 70:
		if state == 2:
			state = 3
			ld_time = time.time()
		if state == 3 and (time.time() - ld_time) > 0.5:
			stream = subprocess.Popen(ffmpeg_stream, stdout=subprocess.PIPE, shell=True)
			play = subprocess.Popen(ffmpeg_play, stdout=subprocess.PIPE, shell=True)
			print("call")
			state = 0
			GPIO.output(8, True)
	print(d, state)
	time.sleep(0.05)

remote_part.sh

SH
ffmpeg -ar 8000 -f alsa -i hw:0 -acodec mp2 -b:a 128k -f wav  udp://192.168.20.248:4445 &
ffplay -fflags nobuffer -flags low_delay -framedrop -strict experimental -nodisp udp://192.168.20.74:4445 &

Credits

Filip Stražišar

Filip Stražišar

1 project • 0 followers
Ziga Brinsek

Ziga Brinsek

1 project • 0 followers
Lan Terseglav

Lan Terseglav

1 project • 0 followers
Jon Schwarzmann

Jon Schwarzmann

1 project • 0 followers
Industrial designer
Deja Kofol

Deja Kofol

1 project • 0 followers

Comments