97
submitted 1 year ago* (last edited 1 year ago) by JacobCoffinWrites@slrpnk.net to c/diy@slrpnk.net

My grandmother recently lost her vision. She wanted a sound recorder so she could continue writing/recording her stories, but she's never been comfortable with computers or small electronics, even when she could see them. One of the features she really wanted was automatic transcription voice to text. But all the voice recorders I could find online, even simple ones, seemed like they'd be hard for her to use. They had small buttons, recessed into the case (she has trouble feeling stuff like that), switches on the sides, multiple modes, screens she couldn't see, etc. After the last year of trying to find various devices for her, and of being frustrated at how overly complicated devices supposedly intended for the elderly and vision-impaired still are, I decided to just build something that would actually fit her needs. Unfortunately, I had just a week to do it in before I was heading up to visit.

The goals:

  • It had to be aggressively simple to use. No modes, no settings, no buttons combos to remember.
  • It had to support advanced features (transcription was one she really wanted, but just being able to get the voice files out to relatives easily was big)
  • Sturdy design

I googled around and found this tutorial for making a spy device from a raspberry pi. It was pretty much perfect - when it detected motion, the device was meant to record audio, transcribe it, and then send the transcription out to the 'spy' as an email. That was perfect - email is a robust system all my other relatives are familiar with, figuring out what to do with the files, renaming them, forwarding them as necessary is well within their abilities. Plus the email account could act as a backup.

I started with setting up a button. I used this tutorial as my guide, and used an old arcade button left over from helping a friend build an arcade cab. I soldered a 220 resistor in line with the button per the tutorial. The arcade button was a good fit - it's designed for this kind of project and mounts easily to a hole drilled through a board, it's big and raised up, meaning its easy to find.

Then it was on to the python code:

The changes I had to make were mostly around the motion sensor. We were going to replace that with a single button. Push it once, it plays my voice saying 'recording' and starts recording. Push it again, it stops recording and says 'stop'. It's been years since I wrote python code, but all I really had to do with identify the parts relevant to my requirements and make changes. I ended up using this code for preventing button bounce, since the built-in GPIO features failed to prevent it. The only change was a minor adjustment to the end of look_for_triggers() (which will show up in my code,) because it was preventing the second button press from being detected. I basically just stitched the button_callback() function to start_recording() and replaced the for loop in audioRecording() with a while loop to support variable-length recordings based on the button press. And I used pygame to play my voice audio. The other change I added was to the email feature. I added some try and except error catching, so failing to send an email (like if her wifi goes down) won't crash the program. I won't be around to start it up again so I wanted it to be robust, and to degrade gracefully. I explained that if it says 'email error' after 'stop' that just means it couldn't send an email, but the file is still saved and the program still works.

After getting email to work, the next job was to make sure the program ran as soon as the raspberry pi booted up. My grandmother has lots of friends who love to help, which often means unplugging things, moving them around, losing them, finding them, reorganizing her house, and mailing back audiobooks she hasn't listened to yet. I needed this thing to be able to survive power loss and general curious fiddling. And if it crashed, power cycling would be an ugly but functional way to restart the program.

I used this guide and modified the line to say @reboot python3 /home/audio/sound_recorder_good.py

Once that was done, I found I had to replace the 'input("Press enter to quit")' line at the end of the main function with an endless while loop, because the program was no longer running from the terminal and couldn't use input.

You can find my code here: https://mega.nz/file/OJV1hZJB#pVeddKWKu6EwC6yxiMMsSVSCQdoTUkhtcfWM6ryAYIw

At this point, it was pretty reliable, so I started work on the physical case. It's basically just a wooden box containing the pi, a button, a speaker, the microphone, and built to keep people from opening it up, unplugging components, or fiddling with the speaker settings.

I wrote the woodworking part up with pictures here: https://imgur.com/a/xiVjvdQ

The last of the setup was just connecting it to my grandmother's wifi, packing it all into the case, and making sure it still worked before showing her how to use it. She was very pleased with the overall design, she's going to test it for a couple weeks while I'm away, and if she wants, I'll add transcription and urethane the case when I get back.

you are viewing a single comment's thread
view the rest of the comments
[-] JacobCoffinWrites@slrpnk.net 5 points 1 year ago

Thank you! I really appreciate it

this post was submitted on 31 Oct 2023
97 points (99.0% liked)

DIY

2381 readers
2 users here now

Share your self-made stuff and half-baked projects here.

Also check out !diy@beehaw.org

There is also a related XMPP chat.

founded 2 years ago
MODERATORS