Rotary phone, RPi5, STT & Ollama for an offline quirky assistant with TTS output - part 2
Okay, following on from the success of Part 1 (okay, it was only about 8 hours ago, but y'know)
I ventured into the Hardware side of things, looking at getting the software to interact with the hardware. Time to get the screwdrivers out.
As mentioned, I thought I was going to use Node-Red. I burnt even more time trying to get Node-Red GPIO nodes to work. Turns out that there are "issues" with RPi 5, Python and the GPIO access. It took me far too long going around in circles to accept this. I'll have a chat with DCJ when he's back from holiday in July.
So, what did I do? I went back to the layer underneath. Yep, I did it people, I dropped into using Python. Actually, I noticed that the node-red node was just dropping down to using Python anyway, so I was just removing the layer that was giving me issues.
Here's the Node-Red error I was getting:
It's odd as I can run that command not a problem and I followed all the instructions for the node about granting the right permissions etc..etc... that's probably why I didn't give up sooner.
Anyway, I did rip apart the internals of the phone and was looking to just hack / solder some wires into place as-is, eventually though I went and did the right thing & found a little micro-switch.
I knocked up a VERY SIMPLE bit of Python code as shown here:
That gives a simple STATE output of the GPIO 23 pin, which is what I have hooked up to the micro-switch.
There you go, it detects exactly what I want, the handset is down, then the handset is up - based upon the state I can trigger an action. Okay, it's not quite what I wanted, but Pfffhhh! at this point, I'll take it to assist with getting the integration working.
That micro-switch will fit nicely into the top of the phone so when the receiver handset is lifted it will trigger it. sweet.
Then the lovely Amazon Prime man turned up with the microphones.
This one looks like it might do the job I was after, which is to fit inside the existing handset...
Getting "exciting" now. I'm such a geek. :-D
It doesn't sound like I've done a lot, but, as I say, I went around in circles for too long trying to get the Node-Red GPIO nodes to work with the RPi 5 before I gave up.
Next Steps:
Obviously hook-up the microphone and get the micro-switch to work within the phone case.
Setup a small servo to swing back and forth really fast to "ring the bell" on an event trigger.
Fit it all back together as a prototype and test the software works repeatedly.
UPDATES to follow.
Comments
Post a Comment