User:Wordfa/oldphonehack: Difference between revisions
No edit summary |
No edit summary |
||
Line 95: | Line 95: | ||
Here is the eng version of the dutch code: https://pzwiki.wdka.nl/mediadesign/User:Wordfa/oldphonehack/PTT_Tafeltjes_Telefoon | Here is the eng version of the dutch code: https://pzwiki.wdka.nl/mediadesign/User:Wordfa/oldphonehack/PTT_Tafeltjes_Telefoon | ||
Fred wrote down a test code which we now lost... | Fred wrote down a test code which we now lost... <syntaxhighlight lang="py"> | ||
Last login: Mon Nov 11 18:05:41 on ttys000 | |||
designworm@Designs-MBP ~ % ssh sevgi@192.168.1.113 | |||
sevgi@192.168.1.113's password: | |||
Linux telephone 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 | |||
The programs included with the Debian GNU/Linux system are free software; | |||
the exact distribution terms for each program are described in the | |||
individual files in /usr/share/doc/*/copyright. | |||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | |||
permitted by applicable law. | |||
Last login: Mon Nov 11 17:49:30 2024 from 192.168.1.158 | |||
sevgi@telephone:~ $ exit | |||
logout | |||
Connection to 192.168.1.113 closed. | |||
designworm@Designs-MBP ~ % ssh wordie@192.168.1.113 | |||
wordie@192.168.1.113's password: | |||
Permission denied, please try again. | |||
wordie@192.168.1.113's password: | |||
Linux telephone 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 | |||
The programs included with the Debian GNU/Linux system are free software; | |||
the exact distribution terms for each program are described in the | |||
individual files in /usr/share/doc/*/copyright. | |||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | |||
permitted by applicable law. | |||
Last login: Mon Nov 11 17:46:47 2024 | |||
wordie@telephone:~ $ cd | |||
wordie@telephone:~ $ ls | |||
Bookshelf Documents Music Public Videos | |||
Desktop Downloads Pictures Templates telephone | |||
wordie@telephone:~ $ cd telephone | |||
wordie@telephone:~/telephone $ ls | |||
"08 I DON'T WANT TO FALL IN LOVE AGAIN.wav" markOne.py rotary_pi | |||
'Sunday Morning Maroon 5.mp3' markTwo.py test.py | |||
wordie@telephone:~/telephone $ nano test.py | |||
wordie@telephone:~/telephone $ nano test.py | |||
wordie@telephone:~/telephone $ ls | |||
"08 I DON'T WANT TO FALL IN LOVE AGAIN.wav" capture.py markTwo.py test.py | |||
'Sunday Morning Maroon 5.mp3' markOne.py rotary_pi | |||
wordie@telephone:~/telephone $ nano capture.py | |||
wordie@telephone:~/telephone $ nano test.py | |||
wordie@telephone:~/telephone $ nano capture.py | |||
GNU nano 7.2 capture.py | |||
frequency=44100, | |||
audioformat=AUDIO_F32, | |||
numchannels=2, | |||
chunksize=512, | |||
allowed_changes=AUDIO_ALLOW_FORMAT_CHANGE, | |||
callback=callback, | |||
) | |||
# start recording. | |||
audio.pause(0) | |||
print(audio) | |||
print(f"recording with '{names[0]}'") | |||
time.sleep(2) | |||
print("Turning data into a pg.mixer.Sound") | |||
sound = pg.mixer.Sound(buffer=b"".join(sound_chunks)) | |||
snd = pg.mixer.Sound(sound) | |||
# open new wave file | |||
sfile = wave.open('pure_tone.wav', 'w') | |||
# set the parameters | |||
sfile.setnchannels(NCHANNELS) | |||
# write raw PyGame sound buffer to wave file | |||
sfile.writeframesraw(snd.get_raw()) | |||
# close file | |||
sfile.close() | |||
print("playing back recorded sound") | |||
sound.play() | |||
time.sleep(2) | |||
pg.quit() | |||
^G Help ^O Write Out ^W Where Is ^K Cut ^T Execute ^C Location | |||
^X Exit ^R Read File ^\ Replace ^U Paste ^J Justify ^/ Go To Line | |||
</syntaxhighlight> | |||
== Refs and resources == | == Refs and resources == |
Revision as of 19:26, 11 November 2024
Press #1 For:
Description
From getting your BSN to installing internet in your new home to renting a car, rigid mazes of bureaucratic systems hold us all hostage. In the spirit of collective catharsis 'Press One For' invites you to share and listen to stories of how these systems frustrated you, or how you frustrated them.
Cookbook
Parts Required
USB interface to 3.5mm
https://www.adafruit.com/product/1475
3.5mm Cables
Old phone (T65)
Raspberry Pi
TRS 3.5 Jack x2
Loads of wires
old headphones with a mic (apple earpod works best)
Things we done
- We got one phone from ScrapXL Rotterdam and one from Marktplaats. The first one was a T65
- We took the phone apart and got the speaker to work by connecting the blue and red cables from the phone out to the audio jack to the soundcard to the computer. played show me the body, was good.
- Then we tried the microphone but its a carbon mic and it didnt work. so we atttached a battery and hoped. didnt work.
- We took apart wired headphones that had mic in them to see if we could use the mic from it rather than the carbon mic in the telephone.-> didnt work, headphone cable is TRRS not TRS:
spent a day trying to wire up TRRS to an audio cable, turns out the audio jack was the wrong kind.
then wired it directly to a TRS jack, worked!!!!!!!!!!!!!
then cable managed, looks beautiful now. now we have working speakers and working mic.
This is how you could make it work too (Schema 1)
From the headphones you need to...
Connect th Blue (Ground) to the Sleeve of the TRS jack
Connect the Red (mic) to Pin (Ring) 1 or 2 of the TRS jack
MAKE SURE THE HEADPHONES CONNECTION IS CLOSED!
Next Steps:
We need to work out how to read the keypad input on the raspberrypi. Mark Powers has a snippet of code that supposedly works with this: https://marks.kitchen/blog/rotary_phone_running_linux/
To test our phone we used this GitHub project: https://github.com/ralphcrutzen/PTT-Tafeltjes-Telefoon?tab=readme-ov-file. > This project turns the phone into a math game where a child asks you a times table question and you are supposed to give the correct answer using the rotary keypad. When you dial the answer the py code reads it as 2 separate entires and gives you a Goed zo! if you gave the correct answer.
Fred is translating the code to eng. He also thinks I can't do times tables.
Set up the raspberrypi, named it telephone.(tut here:https://nematicslab.com/how-to-enable-ssh-without-using-a-monitor/)
Fred made me a user(Sevgi) as well and we tested the connections first, adjusted the code accordingly. Fred tested the connections like this (this is the final working version):
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(25, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
print('-')
if GPIO.input(23):
print('23')
if GPIO.input(25):
print('25')
if GPIO.input(24):
print('24')
Here is how we set up the wires and the raspberry pi:
This wiring worked for us at first, but then we had to put the ground cables in different Rbpi GND's for it to work again.
Here is the eng version of the dutch code: https://pzwiki.wdka.nl/mediadesign/User:Wordfa/oldphonehack/PTT_Tafeltjes_Telefoon
Fred wrote down a test code which we now lost...
Last login: Mon Nov 11 18:05:41 on ttys000
designworm@Designs-MBP ~ % ssh sevgi@192.168.1.113
sevgi@192.168.1.113's password:
Linux telephone 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov 11 17:49:30 2024 from 192.168.1.158
sevgi@telephone:~ $ exit
logout
Connection to 192.168.1.113 closed.
designworm@Designs-MBP ~ % ssh wordie@192.168.1.113
wordie@192.168.1.113's password:
Permission denied, please try again.
wordie@192.168.1.113's password:
Linux telephone 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov 11 17:46:47 2024
wordie@telephone:~ $ cd
wordie@telephone:~ $ ls
Bookshelf Documents Music Public Videos
Desktop Downloads Pictures Templates telephone
wordie@telephone:~ $ cd telephone
wordie@telephone:~/telephone $ ls
"08 I DON'T WANT TO FALL IN LOVE AGAIN.wav" markOne.py rotary_pi
'Sunday Morning Maroon 5.mp3' markTwo.py test.py
wordie@telephone:~/telephone $ nano test.py
wordie@telephone:~/telephone $ nano test.py
wordie@telephone:~/telephone $ ls
"08 I DON'T WANT TO FALL IN LOVE AGAIN.wav" capture.py markTwo.py test.py
'Sunday Morning Maroon 5.mp3' markOne.py rotary_pi
wordie@telephone:~/telephone $ nano capture.py
wordie@telephone:~/telephone $ nano test.py
wordie@telephone:~/telephone $ nano capture.py
GNU nano 7.2 capture.py
frequency=44100,
audioformat=AUDIO_F32,
numchannels=2,
chunksize=512,
allowed_changes=AUDIO_ALLOW_FORMAT_CHANGE,
callback=callback,
)
# start recording.
audio.pause(0)
print(audio)
print(f"recording with '{names[0]}'")
time.sleep(2)
print("Turning data into a pg.mixer.Sound")
sound = pg.mixer.Sound(buffer=b"".join(sound_chunks))
snd = pg.mixer.Sound(sound)
# open new wave file
sfile = wave.open('pure_tone.wav', 'w')
# set the parameters
sfile.setnchannels(NCHANNELS)
# write raw PyGame sound buffer to wave file
sfile.writeframesraw(snd.get_raw())
# close file
sfile.close()
print("playing back recorded sound")
sound.play()
time.sleep(2)
pg.quit()
^G Help ^O Write Out ^W Where Is ^K Cut ^T Execute ^C Location
^X Exit ^R Read File ^\ Replace ^U Paste ^J Justify ^/ Go To Line
Refs and resources
Microphone from handset
https://www.youtube.com/watch?v=rIkIkbOw3OQ&t
Rotary Pi
- Really good write up with code:
- https://marks.kitchen/blog/rotary_phone_running_linux/
- Linking Video
- https://www.youtube.com/watch?v=M4eCrctDMEc
Lofi Mic
https://www.youtube.com/watch?v=7gorBkdk8zY
Schematic (v scary)
https://easyeda.com/editor#id=7d0350ec43844219912695cec1a0e156
Rotary MP3 Player
https://www.whizzbizz.com/en/gpo746-t65-rotary-dial-phone-mp3-wav-player
Info on the T65
https://www.cryptomuseum.com/phone/t65/index.htm(there is a wire list here as well)
Carbon Mic
https://www.youtube.com/watch?v=cwPPoVvljOw
https://www.youtube.com/watch?v=pb-Lu2kzKYc&t=221s
Dutch guide on rotary dail
https://github.com/ralphcrutzen/PTT-Tafeltjes-Telefoon?tab=readme-ov-file
Guide on getting Keypad Working (Matrix should be tried)
https://web.archive.org/web/20130919160654/http://www.keesvanweert.nl/blog/?p=1
Weird Stuff
how does a carbon mic work
https://wonderfoon.jimdosite.com/
https://www.youtube.com/@ruudshangout/search?query=t65
Event Rider:
Items Needs
- Table [ ]
- Chair [ ]
- Phone [x]
- Lamp [ ]
- Calendar [ ]
- Forms on table? [ ]
- Assorted Desk Items [ ]
Space Needs
- 2m x 2m (UBIK)
- Power (UBIK)
- Low light preferred
Time Needs
- Async/ All day