Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/boatartist/robo-spy-pigeon-phone

I'm way too addicted to my phone, so I'm replacing it with a robot bird, come along for the ride as I document the entire project in one badly formatted page ;)
https://github.com/boatartist/robo-spy-pigeon-phone

birdsarentreeal core-electronics python raspberry-pi robotics

Last synced: about 2 months ago
JSON representation

I'm way too addicted to my phone, so I'm replacing it with a robot bird, come along for the ride as I document the entire project in one badly formatted page ;)

Awesome Lists containing this project

README

        

# Robo-spy-pigeon-phone
## May 16, 2024
Hello, welcome to my Robot-spy-pigeon-phone-assistant-project! (I'm bad at names I'll fix it later)
This is an idea I've had in my head for ages, and I really want to document one of my procrastination projects properly, so I'm just going to put everything I do onto this github, then procrastinate on my procrastination by fixing it later.

So, robot phones. I think I was unreasonably influenced by Amy McCulloch's Jinxed series, which is a pretty good YA series in its own right. Basically the premise is that everyone has an animal-looking robot that does everything their phone used to do, and also is like a pet and friend and assistant, and idk I just think that's pretty cool. I would just make that but it'd kinda feel like plagiarism or something, which brings me to my second influence: Birds aren't real. I assume everyone has heard of this pseudo conspiracy, which is just hilarious and very much something my generation would make up in response to actual conspiracy theorists. Essentially, all birds were hunted down and killed by the US government/CIA in the 50s and 60s and replaced with spy drones that are tracking us, ooh scary. Finally: ornithopters. You know drones? They're like that but cooler, because they flap their wings. I'm not an aeronautical engineer (I'm just a highschooler actually), but I do have a very hyper plane loving little brother, so there's that

With these ideas in mind I have a bunch of features I want to implement at some point but may never, best explained through a series of tiny sketches:

![WIN_20240516_12_24_25_Scan](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/e0a665ed-67cb-4014-8c68-2e687821655a)
![WIN_20240516_12_25_56_Scan](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/6f2c601f-394f-4fe3-896c-14ff19c58ae7)

Look at the little cyborg pigeon!!!❤️❤️❤️❤️ I'm so proud of my non-existent drawing skills. If you can't read my handwriting (valid, I can't either), here's some of the highlights:

- cute little perch
- holds a little pencil
- camera (or is it a death laser?)
- touchscreen
- eyes follow you around
- full 360° vision, head rotates
- foot clamps/jointed toes (taking inspiration from nerdforge's prosthetic finger but it defaults to contracted so it doesn't fall off the perch)
- Bits that move (perched edition): feet lift and flap, head rotates = 3 servos, optional bonus: balance body by tilting
- also some sound effects/comments ie. eeeee, creeeeak, ring ring..., unknown phone number...

## May 28, 2024
I made a super cute lil cardboard/electrical tape model, feeling very professional
![WIN_20240528_18_45_05_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/cc6d8b38-ed80-439f-9cb3-b49d9c9466aa)
And if the ultra-high quality school laptop night photo didn't sell it to you, then I used an AAA battery as a stylus to sketch over it 🙃
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/7aeb6054-db9a-41c6-a717-e6f5397237d4)

I also found some old(er) sketches and plans from when I wanted to make a cockatoo, so might as well put those in, there's no one reading this anyway lol
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/08a2796a-752b-45f6-a16d-ad7dbbedd2ad)

## June 02, 2024 (I think, this is a retrospective post)
I tried to make a bird shape in solidworks and it went disastrously wrong. Luckily my dad is a literal designer so he showed me how to do it and mine are still terrible but i got some ideas about how to do it, later. This was the dumpy model my dad whipped up in like 10 minutes, I think mine are right at the bottom of the windows rubbish bin.
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/622d17b7-626a-4f9a-9f2c-d02b641bd462)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/8e6f3bed-820f-4a98-b4fb-109ceb701017)

## June 09, 2024
~~Feet! (No not like that stop being dirty minded).~~ (This joke has been redacted because everyone keeps judging me (valid ig)). I figured this was as good a place as any to start my project, so I've spent this weekend wasting filament and masking tape on prototypes, until I got to a design that I think will do for now. My original concept was inspired by prosthetic finger designs (Shout out to [this video from Nerdforge](https://www.youtube.com/watch?v=ZVqa7j6jG0Q) for the inspiration), which contract when a string is yanked and then have a bit of elastic which defaults them to open again. Obviously a bird clinging to a perch for dear life has quite the opposite motivations, so my design had a bit of string on the outside which gets pulled by a servo to open the claws and then a piece of elastic pulling them closed again, as can be seen in this low-res night photo.
![WIN_20240609_19_17_24_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/24ccbe44-e2e9-46a6-ad14-0b6d771a9bf7)
This design seemed great on paper but left more than a little to be desired in real life, so I created a new design featuring the coolest thing I know nothing about: gears. After a loooong time in solidworks I finally got something that kind of works, so my current foot design looks like this:
![WIN_20240609_19_19_10_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/03e079a5-b7f3-41b0-9a06-832dcd0e71f8)
![WIN_20240609_19_18_48_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/92ea8066-b827-4297-b5eb-cd4bbecca48f)
I'll put the current cad files up if there's anyone interested (that's a little inside joke because there's noone here at all lol)

## June 16, 2024
I figured out how to get blender on my school laptop and I've finally got a terrible low-poly model which I'm going to polish up in Solidworks (stl file up now)

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/f196effa-0f99-410b-8606-b46fe0e7c1e1)

This is a photo of a tiny 3D print I did of it, just for fun, I think it looks pretty good.
![WIN_20240616_14_55_46_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/c3a70914-966a-4a60-aeb3-b3e95454be29)
I also realised that I haven't put up the fancy drawings I did, oops, here they are now.
![WIN_20240616_11_46_52_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/6bdf42ea-ce33-4253-97e3-869f63633a92)
Umm, what else? Oh yes, I bought a [usb modem](https://www.telstra.com.au/internet/mobile-broadband/prepaid/4gx-mf833v-usb) to use instead of the raspberry pi hat I had for my phone project, which unfortunately broke. Hoping that having an actual professional thing will make this a bit less dodgy.
I'm also going to buy [a little round touchscreen](https://core-electronics.com.au/128inch-round-lcd-display-module-with-touch-240240-pixels.html), which I'm really excited about, hopefully we start getting some actual progress soon!

## June 18, 2024
Welcome to the total of 2 people I shared the link to this with, here's the things I did today and at the end of the weekend.
1. I chopped the blender model in half and hollowed out the head so I could put a raspberry pi camera in there, the stl can be found on this github but it's not a final product by any means.
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/e5be9bc5-a6cf-4575-9906-b623f8420ea4)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/1703c0cc-184d-49d8-abdc-a2f13d4222ed)

2. I bought a cheap usb cable and a usb socket which I soldered together so that the modem doesn't have to stick straight out of the side of the raspberry pi, instead I can attach it via the dodgy cable and position it around the side. I would advise anyone thinking of copying this project to invest in an official cable ([like this one maybe](https://www.amazon.com.au/Degree-Angled-Female-Extension-Adapter/dp/B015H0KUEI?th=1)), I melted quite a lot of plastic and had to restart several times from fragile cables breaking.
![WIN_20240618_19_49_22_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/9d7dc34b-4597-4e6e-bffa-2d3c0c68b07e)
![WIN_20240618_19_50_09_Pro](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/d0bb3d2a-c7b1-47a7-80f5-67778a302ffb)

## June 25, 2024
I'm away from the Raspberry Pi rn so I can't test this code, but I've been researching text-to-speech (tts) modules that I can use, because a big feature of the bird is that it's going to give audio notifications and users will be able to converse with the robot instead of just using the screen.
![WIN_20240709_15_02_11_Scan](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/8bc84b66-6336-4831-8bcd-da5deb878636)
After much consideration, I've decided to use the Google tts API (gTTS), following [this Geeks for Geeks article](https://www.geeksforgeeks.org/convert-text-speech-python/) because I'm lazy and it looks easy, but also it's really well documented and I can also use the google speech-to-text API so it will look symmetrical in my brain. According to the tutorial, this is the python code I'm going to need:
```
from gtts import gTTS
import os
tts = gTTS(text='Hello World', lang='en', slow=False)
tts.save('audio_file.mp3')
os.system('start audio_file.mp3')
```

## June 27, 2024
I got the gTTS module working, and I'm using the pygame mixer to play audio through the audio jack. I found an old pair of headphones and a speaker from a singing birthday card which I brutally massacred to make this speaker setup I can plug into the audio jack. I might replace the speaker because it's still a little too quiet, but it works for now.

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/1789b539-49b2-42f3-851f-8c67c5073d02)

In the past I've tried to find a ready-made speaker which would do this for me, but most speakers seem to be the massive round bluetooth speakers, so anyone copying this project I would advise to find a cheap headphone jack part and a small speaker component, that seems like the best option.
I also improved the head cad file so that the camera fits better and there's also a hole in the other eye for a 5mm led, which I think is pretty cool. I'll upload the new stl alongside the old one, they're pretty similar at this stage. I think the next step is going to be getting my hands on that round display, and also looking at how I'm going to get the microphone working, stay tuned!

## June 30, 2024
Oops, turns out I did not the gTTS working, it steals its tts from the interwebs, and mine is a bit sketchy rn, so I'm settling for a worse module that's fully offline, [pyttsx3](https://pyttsx3.readthedocs.io/en/latest/engine.html) (I did try to install it's updated sibling pyttsx4 but I'm not bothered to install the module on a computer with internet and then manually install it on the raspberry pi, so we're settling for the one I managed to get). The voices are terrible, but at least it talks and I haven't had any major issues. I also don't need to use the pygame mixer to play my sounds, so that's nice. This is my current code:
```import pyttsx3
engine = pyttsx3.init()
# reducing the speed of the voice from 200 to 100
engine.setProperty('rate', 100)
# I think the english voice is the best, but there's code in the documentation to loop through every voice and test it if you want to find a better one
engine.setProperty('voice', 'english')
#say the thing
engine.say('Hello World, I am pigeon')
#I think the say() method preloads the audio to the engine, and then this method actually runs it
engine.runAndWait()
```
Oh and here's a photo of the new head, it's still goofy, but I kinda love it.
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/f94d057c-6710-43c3-bc58-51f36dc41025)

## July 2, 2024
A quick moment of silent for my realisation that the raspberry pi audio jack does not support the microphone, so I apparently wasted my money and time buying [a new 4-poled plug](https://www.jaycar.com.au/3-5mm-gold-plug-4-pole/p/PP0138?pos=6&queryId=201fd0d2d0470ca55455e4e27b61be16&sort=relevance&searchText=4%20pole#), soldering 4 wires to it and trying to connect the speaker and the microphone to it, ouch. At least I did realise how I could amplify the volume of the speaker using a transistor so now we have this snazzy and compact little set-up on the back of the speaker:

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/7b3f0795-3d35-42ad-9275-6d1ea9ed24b0)

And since I'm overcompensating for my laziness and refusal to make wiring diagrams for my actual school software projects, here's one I whipped up in two minutes:

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/4adc555f-0f90-4180-ad04-e3ea26794a1f)

So it's a bit sad that I did all that for nothing, but at least I have a good result. For now, I'm using a big flat usb mic I bought for a past project that didn't work out, but it's better than nothing until I figure out how to make my own, more compact version with the tiny microphone I bought. Oh and if anyone ever copies this project, [you can get audio output from the gpio pins](https://wiki.batocera.org/audio_via_gpio_rpi_only), which I've been searching for for ages and only discovered after hacking together my solution :( Anyway we live and we learn ig.

## July 3, 2024
❤️ [http://apachepersonal.miun.se/~muhimr/index_files/Tutorial_4g_modem_with_Raspberry_PI_B_plus.pdf](http://apachepersonal.miun.se/~muhimr/index_files/Tutorial_4g_modem_with_Raspberry_PI_B_plus.pdf)

## July 4, 2024
I was pretty rushed when I posted that article yesterday, I hadn't done much and I just wanted to share the brilliant pdf which unlocked my ability to actually use the usb modem I've bought. So basically what I learnt is that when you go to [192.168.0.1](192.168.0.1) on any device, it takes you to your modem's page, where you can see different diagnostics, change settings and even (if you have a sim-based modem like mine) send and receive text messages. Amazing! This is the best news I've had in ever, because I thought I was going to have to hack together a solution, bypass a billion safeguards and do all sorts of wizardry to even get internet working with the modem, let alone sms on it, but no, I just need to figure out how to steal data from that webpage, praise the lord, god is good, I'm converted, all that jazz⛪✝️

... Actually, maybe not, looks like the website is kind of janky and it doesn't want me to steal from it, or maybe I'm just bad at requests and Beautiful Soup, we'll see. Oh side note I finally ordered the touchscreen watch display yesterday, so it should be here in a few days, and once it arrives I'll have all the components to start building the body (I think), stay tuned!

EDIT: I must apologise to everyone I have mislead in my claims that I was using a singing card's speaker, that **was** the speaker I experimented with, the one I'm currently using comes from a build-a-bear. I found the official product names for both (the singing card speaker is more or less [COM-15350](https://www.melopero.com/en/shop/sensors/audio/thinspeaker0dot5w/) and the build-a-bear speaker is probably [13ry328qf203](https://www.amazon.com.au/Aexit-Electroacoustic-External-13ry328qf203-Loudspeaker/dp/B07BDPJTB2)), as they seem like good options until I find a real product, but I will be using the measurements for the build-a-bear speaker in my CAD modeling.

## July 7, 2024
I was fooling around with my tts function and the audio randomly stopped working, which prompted me to have a small mental breakdown and also transfer my speaker to the GPIO pins, adding
```dtoverlay=pwm,pin=13,func=4``` to the bottom of `/boot/config.txt`. In the end the actual problem was that raspi-config sometimes likes to have little menty-B's and change pretty standard settings, so I had to go into the system settings and [change the output back to jack](https://www.raspberrypi.com/documentation/computers/configuration.html#audio-2:~:text=passphrase%22%200%200-,Audio,-Specify%20the%20audio). Well that's good to know I guess, and it looks pretty cool and saves needing external batteries, so I'm (kinda) glad it happened.

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/21720103-b9aa-44c0-8042-e7db532cf4d5)

In other news I spent way too long being bad at try-except statements and kept getting confused when raising an error caused an error to show up, but in the end I made a quick function to check for internet connection, which will be useful to switch between voices (gTTS is sooooo much better than pyttsx3, but it needs interwebs), or just to prevent errors when looking for texts or other web-based things.
```import requests
try:
req = requests.get('https://github.com/boatartist') #shameless self-promo
except:
print('Uh oh no interwebs')
#do something else here
```
Lastly, I was annotating and collating notes from the demo python code for my round display which is coming tmw (probably), I might put up those notes in future.

## July 8, 2024
EEEEEEEEEEEEEEE!!!! I just got the display and it's so cute! I'm obsessed. It is very good and once you figure out the code it's pretty intuitive, I'm going to put up a guide at some point, mostly to remind myself, but for now here's how it (more or less) works, based on [the python example](https://files.waveshare.com/upload/b/bb/1.28inch_Touch_LCD_Demo.zip) from [the official wiki](https://www.waveshare.com/wiki/1.28inch_Touch_LCD#Raspberry_Pi_User_Manual) (thank you Waveshare ily <3):

(nvm I moved it to a file of its own because I kept coming up with improvements, check out the code example in `code/round_display_demo.py`)

## July 9, 2024
I *think* that I've finally gotten to the bottom of the stupid audio error, which was based on the raspberry pi not defaulting to the right output, after completely overhauling my entire tts setup haha. In trying to fix my setup, I've moved to a different tts module (again), which is espeak. Actually I didn't really change anything, I'm just using the command line interface rather than the pretty library setup to run it for me. What I did was identify the sound card and device number of my speaker by running `aplay -l` in the command line, and then to output text I give the command line this: `espeak "Some text" -s 120 -ven+f3 --stdout | aplay -D hw:2,0`, which is a lot of fancy symbols for, "espeak please say 'some text' at 120 wpm with the third english female voice" followed by "aplay please play this out of sound card 2 device 0". Oh yeah I found more voices which is nice, I can even make it ✨whisper✨ ooooooh. So that's fun.

In other news my round display is working great, I made a class for it so I didn't have separate touch, display, image and draw objects, I'll post that in the code folder. At the moment I'm working on making a menu that shouts at you but doesn't keep shouting (I don't know why it won't shut up 🫠), but at least we're going somewhere. I also found that there are lots of pretty colours, because PIL uses the html colour list, which is very expansive and a great opportunity for me to demonstrate my lack of graphic design skills, yay!
Here are some photos from my experimentation:

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/c50826b6-b19e-4c51-af32-56459de858f7)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/7bf2ec96-256e-4c73-8f3f-868e46f6befe)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/edaaab23-14eb-4984-afe0-a2a5233fe968)

## July 11, 2024
Yesterday my brain said: "Do some CAD modeling", so I did that even though I didn't have a mouse or any plans, leading to the jankiest prototype ever, but I've got a mouse-adaptor now so I'm going to fix it, but for now I'll put up all the files in a folder:

![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/9fa8c14b-bf77-4a58-954f-f5c3bb6d3c33)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/d403a580-9750-4538-9c6f-8e3b15887748)
![image](https://github.com/boatartist/Robo-spy-pigeon-phone/assets/78235705/d46dd77b-5e29-4c06-9ee9-a54b2c62ee6a)

## July 22, 2024
It might be easy to think, from the fact that I haven't updated this page in 11 days, that I've been busy doing schoolwork and not procrastinating, but no that would be a mis-guided naive optimism. In fact, I told myself that I would not work on this project until I'd finished my homework, which was a sure-fire way to ensure I worked on it constantly during momentary lapses in my willpower. So, what have I achieved?
1. I made a blocky little case to think about positioning and hold the screen up while I messed around with some code, not sure if it was worth it but it looks cute (or it did before I melted holes in it for all the ports I forgot I needed access to).
![image](https://github.com/user-attachments/assets/0a3ee5b5-53f9-4d67-b24c-f270c3054b20)
![image](https://github.com/user-attachments/assets/05e85769-2ae9-45e5-ab12-47076824ab2f)

2. The audio stopped working (again) and I realised that, although using the GPIO pins is very convenient, it only produces square wave digital outputs, which is a bit too janky, so I reverted to using the 3.5mm jack, which is a bit annoying but it does link to my next point
3. I thought a **lot** about how the user could change between audio output modes, experimenting (unsuccessfully) with having a bluetooth mode, which I might come back to later, but in the end I came up with a decent solution, which basically has a socket into which you can plug in wired headphones at any time, they don't turn off, and also a switch/settings option to turn off the built-in speaker by way of a GPIO pin which provides power through my fun transistor solution from earlier.
4. So obviously that meant that I bought a 3.5 mm socket, a usb socket, a couple of switches, and a prototyping solderable board. That last part is the most useful, as it lets me combine all the components, and it was also incredibly convenient because I put all the pins from the display in a line, so I no longer have to worry about the fiddly order every time.
![image](https://github.com/user-attachments/assets/a1c334ac-8015-433a-af90-0bcc50f93ab6)

I think I messed up the speaker somehow, might be the transistor, but it's looking better already.
![WIN_20240722_13_20_55_Pro](https://github.com/user-attachments/assets/256ab43f-c27b-4d69-9352-05340205c2cf)
![WIN_20240722_13_20_48_Pro](https://github.com/user-attachments/assets/61d31eab-b3e9-461c-9238-fd0eaf398bc4)

Once I've fixed the built-in speaker I'm going to install the sockets and switches, which will be able to be moved to wherever I want my peripherals, I'm thinking under the wing in the final product, that would be cute. Another plan I have for the end is to get a custom PCB made, which will plug all my components in really nicely and easily, and look a bit smaller and more professional, but I should probably get my prototype working first. I feel like there was some code I did, but I don't think I have any big updates.

Oh, that's right, I wanted to shout out the guys at Core Electronics, the online store where I've been buying a lot of my stuff, because I sent them a really wacky and unedited email asking them whether this project might be worth getting published on their projects section one day, and they came back in a couple of days with a really helpful and encouraging email about how I could transform this blog/log thingo into a proper tutorial, which I'm really grateful for and will definitely be applying when I get around to finalising all the documentation. Thank you! :)

## August 4/5, 2024
The speaker not working was apparently just because I used the wrong transistor by accident, oops. I think it would have worked if I'd turned it around, but for consistency's sake we're sticking with the BC557, which is a PNP rather than the NPN BC547 I accidentally used. So that's good news, we now have the speaker shouting at us, and it turns off when it's not, so that there's no buzzing.
![WIN_20240804_15_00_18_Pro](https://github.com/user-attachments/assets/76a7c29f-05ef-4340-a707-e39b4ec1dabb)
This means that I almost have enough functionality to mock up another prototype, but I might quickly solder my sockets first, and put in some header pins for servos. I am a little worried because I only have about 3 GPIO pins, since the prototyping board only includes the first half of the pins, but I think this should be enough to do claw movement and maybe head rotation, which is quite exciting.

Things I need to fix/do (as of my brain rn):
- solder all sockets (3.5mm audio and usb input, maybe hdmi at a later date)
- stop the screen from freaking out and thinking that I'm infinitely pressing wherever I last pressed, I just want to press once and then it stops
- get a useable requests interaction with the modem's webpage, so that I can send and receive texts without using minicom, since the fancy modem is based on windows software. (alternatively I could invest in a less sophisticated/linux compatible modem that does use minicom)
- look at making a pcb/getting a new and bigger prototyping board
- figure out camera -> display live streaming, this should be possible but it doesn't seem to like it
- consider balance, weight and how complex the design should be, so that I stop wasting filament and am more consistent with my design
- possibly remarket the pigeon as a galah, because they're much prettier, their heads are bigger and closer to their bodies, and if I sell them in Australia one day I can frame it as a limited edition native birds line
- start documenting this project properly before it gets too chaotic (I probably won't do this tbh)

## August 11, 2024
I figured out how to stop the display taking infinite input, by reasoning that it probably wasn't a problem unique to my project, and that it likely just doesn't reset to 0,0 ever, despite my best hopes. Basically, when you press the display once, it reads that and keeps outputting it forever, or until there's a new input. To counter that I kept track of the previous input and have a flag which says if there's been any new input to worry about.

With this problem under control, I optimised (slightly) my code and put it in a class, I'll replace previous code uploads with the working current files, you can turn the speaker on or off, change the wifi mode, and listen to the speaker scream at you if you press any function which isn't active yet, I'm pretty impressed with myself. `bird.py` is the main file, and it imports all the other modules including `offline_tts`, `display`, `wifi` and `check_for_internet`. Remember that display also imports the display's module, so if anyone is running this and getting errors, it's probably that. At some later date I'll look into how requirements.txt files work, because there are a lot of random modules to import, and if anyone is ever copying this project I don't want them to have to debug everything line by line.

I also implemented the camera app, apparently the only thing I needed to change was refreshing the stream every time, but it now works, showing an only slightly laggy feed from the camera, which saves to `final.jpg` on the Desktop (or wherever the main file is) when you click the screen, I'm pretty happy with it. :)

I still don't have a plan for the modem, I think I might have to put my issue on stack overflow, but that's definitely a last resort. In the meantime, I'll keep weighing up the value of just getting a software-less modem, stay tuned!

## August 13, 2024
I am incredibly excited rn, because I showed this project to my awesome friend Darcy a little while back, and she's offered, with all her amazing DT, CAD and Blender skills, to design all the cases for my newly rebranded galah, because she actually knows how to make it look incredible. I'm going to have to give her all the specs, but she's already mocked up a ✨stunning✨ aesthetic prototype, look at it!!! I'll put all the screenshots/renders she sent me in a folder, but here are some of the highlights :)
![Birb1angle](https://github.com/user-attachments/assets/b7f88fb3-f10a-4a90-bc71-5ee1bee42aa4)
![Birb1front](https://github.com/user-attachments/assets/30507e70-481e-40ce-8741-940aebb462b8)
![birbflat1](https://github.com/user-attachments/assets/24cd2deb-1348-4c55-9913-7da4cebd6e3b)
![birbodyholetopflat1](https://github.com/user-attachments/assets/0df2118a-491c-4d63-afc0-be1e00966ccc)
![birhed1](https://github.com/user-attachments/assets/d5975ba8-9161-4930-a7dc-410b8a750863)

EDIT:

Stack Overflow is the best thing ever and I may have solved all of my modem problems. Literally, I posted [a question](https://stackoverflow.com/questions/78864009/is-there-a-way-to-access-the-sms-capabilities-and-modem-webpage-of-a-usb-4g-mode) and mere minutes later a response from a bored computer scientist popped up, suggesting that I use Selenium to dynamically load the webpage, which I think might be exactly what I needed, so good!

## August 14, 2024
Heh heh heh, it's 9pm on a school night and I only just managed to install all the correct drivers for selenium, but (I think) it's finally ready to actually use, yay! I spent just a little itsy bit of time crying dejectedly when the raspberry pi was being a stupid little child and not being okay with any of the normal procedures, but after searching up something along the lines of 'How to Selenium Raspberry Pi Python beginners easy guide diy step by step someone else do it for me' I *finally* found [a useful tutorial](https://patrikmojzis.medium.com/how-to-run-selenium-using-python-on-raspberry-pi-d3fe058f011). No well actually it was [the link in the comment on that tutorial](https://ivanderevianko.com/2020/01/selenium-chromedriver-for-raspberrypi) which solved my problem but whatever. If anyone wants to know how to install selenium and all it's required drivers, here's what I've learnt (against my will), as a quick 2-step method.

Step 1: Install the actual Selenium module: `pip3 install Selenium`

Step 1.1: Doubt yourself when this doesn't immediately work and install all sorts of different versions, only to realise that this was not at all the problem

Step 2: Try to install all manner of legitimate Firefox and Chrome drivers

Step 2.1: Get desperate and try illegitimate and vaguely sketchy installation methods for said drivers, looking for the right version which matches the version of your browser (you can find what this should be with `chromium-browser --version`)

Step 2.2: Find a more genuine way and finally get the right driver which magically has the correct version and you didn't need to scroll through 50 pages of releases `sudo apt-get install chromium-chromedriver`

Step 3 (extra fun bonus): Use `chromedriver --version` to check that you've got it right all in one and try to push back exhausted tears as you rush to document this because otherwise it's bound to get lost and have to be re-done. Yippee! 🙃✨❤️

While I was being optimistic and hadn't tested for base functionality I started coding a function to log into and retrieve data from the website, so I might be able to finish it tmw and implement it slightly, but it's 9.25, I should probs go to bed now.

## August 15, 2024
So, even though Selenium and I are besties now, the telstra webdesign people are my opps, with their user-friendly complex html layouts, unbelievable, smh. I would like to introduce these people to high school students and the level of complexity that there is not in any of my html endeavours, but I guess I'll just have to deal with it. It is going relatively well tho, and for paranoia about losing files sake I'm gonna paste the dodgy thing I've got here:
```
#password input: id=txtPwd, password = Admin
#login button: id=btnLogin
#each text conversation on the main page's id starts with smslist-item- then a long number
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time

print('installed the things')
#driver = webdriver.Chrome(ChromeDriverManager().install())
#driver = webdriver.Chrome('/usr/bin/chromedriver')
driver = webdriver.Chrome()
print('driver exists')
driver.get('http://192.168.0.1/index.html')
print('got a webpage')
try:
login = driver.find_element(By.ID, 'txtPwd')
login.clear()
login.send_keys('Admin')
login_button = driver.find_element(By.ID, 'btnLogin')
login_button.click()
except:
pass
while True:
try:
sms_link = driver.find_element(By.LINK_TEXT, 'SMS')
sms_link.click()
break
except:
pass
try:
right_sms_mode = driver.find_element(By.LINK_TEXT, 'Device SMS')
right_sms_mode.click()
except:
pass
while True:
try:
new_sms_button = driver.find_element(By.ID, 'smslist-new-sms')
new_sms_button.click()
break
except:
pass
while True:
try:
contact_input = driver.find_element(By.ID, 'chosenUserSelect_chzn')
contact_input.click()
break
except:
pass
contact_select = driver.find_element(By.CLASS_NAME, 'chzn-results')
contacts = {}
try:
for i in range(59):
person = driver.find_element(By.ID, f'chosenUserSelect_chzn_o_{i}')
name = person.get_attribute('value')
contacts[name] = f'chosenUserSelect_chzn_o_{i}'
except:
pass
for name in contacts:
print(name)
contact = input('Contact: ')
contact_input = driver.find_element(By.ID, 'chosen-search-field-input')
contact_input.send_keys(contact + Keys.RETURN)
message = input('Message: ')
text_input = driver.find_element(By.ID, 'chat-input')
text_input.send_keys(message)
send_message = driver.find_element(By.ID, 'btn-send')
send_message.click()
time.sleep(60)
driver.close()
```

So ja, it's a bit special and sometimes it lags a whole bunch so I have to implement dodgy loops, but this code *mostly* works, except for some reason the contacts don't like me and that's still broken, but I can navigate to the texts page and try to send a message, just to nobody. So yay!

Oh and I also remembered, I'm gonna take my setup to school tmw and Darcy might have a look at measuring and designing stuff (maybe).

## August 23, 2024
I bought [a super cheap usb microphone from officeworks](https://www.officeworks.com.au/shop/officeworks/p/otto-usb-c-wired-lapel-microphone-otcck15lm) to look at getting speech-to-text, and I can now record audio and interpret it using the speech-recognition module and google speech recognition. However, I didn't have much luck with the module's built-in microphone, and I don't want to have to rely on an internet connection to be able to talk to the robot. So then I messed around with mozilla deepspeech and sopare, and neither of those were very good either. I was just about to give up when I found [vosk](https://alphacephei.com/vosk/), which is a miracle and now I have speech to text:
```
import os
import time
def get_audio(length=5):
os.system('arecord --device=hw:2,0 --format S16_LE --rate 48000 --duration={length} test.wav')
print('got audio')

def translate():
try:
os.system('vosk-transcriber -i test.wav -o test.txt')
f = open('test.txt', 'r').read().strip('/n')
return f
except:
print('error')
return None

while True:
input()
get_audio()
time.sleep(2)
translate()
```
This isn't implemented yet because I'm not really sure what the best way to record the audio is, whether I can tie it to a button being held down or record for a set time after recording, or whether it's best to listen all the time. Not hugely keen on the last two, but we'll have to see what I dig up. My solution is also quite file-heavy, but I think it should be possible to bypass the audio file like with the tts, we'll see.

## August 24, 2024
I finally got around to changing the settings page to include an internet status and abandoned the idea that you might plug in headphones to a literal bird. I also made a very janky little interface for the notes app where you can speak for 5 seconds and get some text saved to a file, just as a proof of concept really, it's not very useful rn. But I'm feeling very happy that I unlocked another feature, even if it isn't perfect. The stt functions and updated code have been uploaded, and I also uploaded a requirements.txt file. I found a geeks for geeks article which had an automated function to create one, so this is just what it spat out from the folder of all of my code, but this doesn't include command line modules that I access through the os module, and assumes that you run all the code as it exists in the code folder on this github, including having the display functions in the lib folder, so I'll see how I can improve it to make it more useful later on. Anyway, here's some photos of the most recent interfaces (I think I wasn't close enough to the mic, it doesn't seem to have picked up my 'hello this is some test audio' very well but at least it got something) :

![image](https://github.com/user-attachments/assets/c4e9a320-dab3-40a0-9b85-969b4c9a1e98)

![image](https://github.com/user-attachments/assets/a9ea3743-135b-4b29-bf38-5c40de9f6e8a)

## September 04, 2024
I've spent a *lot* of time recently researching power methods, because it occured to me that this is going to need to be wireless, and the shape of the thomas the tank engine battery pack we found in the park isn't going to cut it.

![image](https://github.com/user-attachments/assets/d62f30d5-61ed-4688-879b-dd00feb6c201)

So I need to make my own battery charger circuit. There are heaps of boards online, and my only requirements are that they supply at least 5V and 2.5A, and have sockets for charging and powering the pi. [This one from Core Electronics](https://core-electronics.com.au/mp2636-power-booster-charger-module.html) looks pretty good, but I'm not 100% sure if that's the best option. If I get that board or similar, I can use a few rechargeable Li-ion batteries from my local Jaycar, but I can also get some online if there's a different shape I need.

Another option, which seems just an itsy bit dodgy is to use this board I stole from an old drone:

![image](https://github.com/user-attachments/assets/a14671ae-3802-42be-8c1c-ae18017ea062)

It's super tiny, which is great, but I have no idea if it will work or just catch on fire. At any rate I'd have to botch together a supicious cable for powering the Pi. Also, I just read the specs from the battery casing (I had to bin the original battery because it was on the brink of explosion), and it says that it outputted 3.7V and 600mAh. Sooooo, that's probably not enough, but a fun idea nonetheless. I will continue looking for stingy ways to make this powerbank, and I also realised that I have no sort of tilt sensors, so I'll look for some of those at the same time. Finally, I want some smaller servos, so I'm going to hunt down a hobby/rc store and find some.

## September 07, 2024
I went to Jaycar to look for some batteries and I ended up getting [a battery charger](https://www.jaycar.com.au/duinotech-arduino-compatible-lithium-battery-usb-charger-module/p/XC4502), [a 5V output board](https://www.jaycar.com.au/duinotech-arduino-compatible-5v-dc-to-dc-converter-module/p/XC4512) as well as [a 3.7V 2600mAh Li-Ion battery](https://www.jaycar.com.au/18650-rechargeable-li-ion-battery-2600mah-3-7v-solder-tag/p/SB2313). So that's a great haul which I combined into this dodgy little circuit which hasn't fully caught on fire yet, it only smoked once when I touched both ends of the battery together through my third hand.

![image](https://github.com/user-attachments/assets/6edf12cb-36e6-4829-91b6-9dd34474995b)

While it is outputting the required 5V, it doesn't seem to have very much current, I managed to charge my phone by 2% over half an hour, but it didn't fully turn on the Raspberry Pi and I turned it off as it got pretty hot while charging, by attaching a random switch I had. I'll try attaching more batteries in parallel, but in the meantime I'm just keeping it away from flammable materials and searching for alternatives.

In other news, I found some coreflute my brother was hiding and I used it to make a super basic model of the galah shape so that I can do some feet later. I had lots of fun layering bits of scrap to make a round head, and I reckon it looks pretty good!

![image](https://github.com/user-attachments/assets/e9fb8bb3-b6ec-4ad9-bde9-898591ed65b3)

![image](https://github.com/user-attachments/assets/70eac124-ae9f-4574-ab8a-0dd9d494a47b)

![image](https://github.com/user-attachments/assets/93f91c3a-e033-4e4e-9f87-25cfbea2ee98)

![image](https://github.com/user-attachments/assets/d2da01e2-cfb4-4806-8e22-98439ad8817d)

## September 20, 2024
Took a huge risk yesterday and edited the `/home/pi/etc/rc.local` file so that the program runs on startup, which is very stressful and last time I tried to do that my raspberry pi died and I had to create a new micro-sd card with an image and buy an sd-card adapter to remove the edit so it would turn on again. This was very traumatic, I would not recommend. But this time I spent ages debugging and ended up adding `sudo python3 /home/pi/Desktop/galah/bird.py &` to the file, and also added some absolute path references, but now it does that.
I also tried to improve my claw design by making it smaller so it grips smaller things, but this did not actually do anything, I think I need to add joints to the foot and make it less gear-slippy. But it looks pretty cute sitting dangerously on top of my monitor.

![image](https://github.com/user-attachments/assets/2fa8368b-f718-4876-8937-394989f67156)
![image](https://github.com/user-attachments/assets/14f86a7d-c5f4-4bac-b98a-cdb877074c21)

## November 19, 2024
Oops it's been a while since I posted. Haven't done much, I think. Actually no I did some code a while ago but I didn't get around to documenting it. I used a weather API and the datetime module to make a timed out screen.
![image](https://github.com/user-attachments/assets/a5f3cd5f-776d-403f-84e8-4c93ca226fdf)
![image](https://github.com/user-attachments/assets/8231a67b-a670-48f6-9ffd-f1281c368ca1)
All the code for that is in the files, maybe I changed something else I don't remember.

More recently, I bought some armature wire and made a new wireframe of the shell, to think about scaling and stuff in a more 3D way after my coreflute adventures were a bit of a flop. I'll probably paper mache over it or something, but it's quite pretty sitting on my desk for now.
![WIN_20241116_18_14_46_Pro](https://github.com/user-attachments/assets/3605c500-f85c-4560-ab50-0711fcbd551c)
![WIN_20241119_19_11_23_Pro](https://github.com/user-attachments/assets/dd0840c3-5720-42c4-af3f-383d8036ec01)

Note for self: researched into raspberry pi's rules about using it in product, I only need to put "Powered by Raspberry Pi" or similar on the packaging [link](https://www.raspberrypi.com/trademark-rules/#:~:text=4.%20What%20other%20restrictions%20apply%20to%20use%20of%20the%20Raspberry%20Pi%20Marks%3F), [other link, make sure to actually apply](https://www.raspberrypi.com/for-industry/powered-by/)