If you haven’t seen Avengers Endgame or Spider-Man Far From Home – You don’t want any part of this!

Final warning – possible spoilers ahoy!

…

Uneasy lies the head that wears the crown.

So in Far From Home Peter gets the torch passed onto him from Stark via some super AR glasses that allow him to see real time data and call in all sorts of super Stark Industries gear. As soon as I saw these in the film I knew I needed to do a project on them so as soon as possible I got my hands on the glasses from eBay and got to work on plans and parts.

Lets go.

It’s storing energy from the earth’s core!

Make aesthetically accurate EDITH Glasses from Far From Home/IW.

Make it display to the users eye and have speech rec capability.

Have it do some cool things.

Even Dead, I’m The Hero.

Parts:

First up I attached the Powerboost 500c to the Pi Zero, I covered up some of the exposed parts with electrical tape to prevent shorts and soldered it onto the Pi, using the image here as a guide:

1 / 2

•

IMG_4016

I put on the heatsink:

Then attached the screen – VCC to 3v, GND to GND and SDA to SDA1 and SCL to SCL1 on the Pi – and measured against the lens and the glasses to get the right distance and angle:

Both were glued on with hot glue.

Next up the camera attached and glued onto the front:

And the Pi glued onto the side with plenty of hot glue as well as glue around the Powerboost:

IMG_4022

IMG_4023

As you can see above the battery is also attached and taped onto the back.

IMG_4024

IMG_4025

IMG_4027

IMG_4028

I also put some blue tack onto the nose parts, as they were quite slippery and kept falling off my nose due to the weight.

and that’s the hardware done!

You’re embarrassing me in front of the wizards.

I did the usual setup – this time via NOOBS to ensure I got the latest Buster installation.

A lot of the software I’ve used from my The Nvidianator project – such as the chatbot and the PyTorch based facial recognition. You can grab the code from my GitHub.

It should be kept in mind that this project is designed to run on python3 rather than 2 which I’ve always previously used. So any code from this will need to be run with the ‘python3’ command.

The coolest part of this build is Wolfram – which is a computational answer engine which can be used to get information about various things; so if asked how large is the Earth it will return the info etc.

I signed up for the Wolfram Alpha API here and the installation instructions are here, the module I coded for getting the data from Wolfram simply takes in a text string for the request and returns one for the answer.

The screen module is of course used to draw images on the small LCD, when imported it can have its main class instantiated which then allows the main code to draw text and images to it; when another draw command is called it draws the new item next to any previous ones. This allows chaining of images and text and can be cleared and position reset with the screenClear function. It can draw text and shapes and even show the stats of the Pi, although this is a little hard to read on the small screen in the eye.

As previously mentioned the other modules are from The Nvidianator so you can go there and see what else is being used and how they work. The only exception is the object detection, which would require TensorFlow which as far as I know will not run on a Pi Zero.

I had to compile PyTorch on the Pi Zero itself as since there was an error (illegal instruction) while trying to run the install compiled from another Pi (3 A+) – this took like 3 days; if any one knows how to cross-compile PyTorch based around these instructions – let me know! I also had to apply the fix here in order for it to compile.

I’m also using the Chatbot that I made so check that out for instructions and requirements.

The news scraper is something I got from here – so thanks to them; all I did was add in some code so that it can be run individually for testing and that it returns a list of all the headlines for use in the main program.

For setting up the TTS/STT stuff check out The Nvidianator where I used wit.ai for STT, you can go to the link there an sign up for an API key. The installation instructions are here.

For the TTS I am using espeak you can get the installation instructions here. I also installed these as well:

sudo apt install espeak python3-espeak speech-dispatcher-espeak

Once again this is all modular so each individual function has its own.py file which is imported from the main file and these can be run independently for a form of unit testing.

The main program first asks for the users name that can be configured in a kind of access list, if the name is on that list it will allow them onto the next part.

This is where the menu listener function kicks in and displays the users name showing that they are able to use the glasses, at this point if the user says one of the menu key words it will open the menu function. It will show the user that it is ready for commands and will also ask via TTS what the user wants to do.

This is where the user is able to select from:

Taking a photo

Talking with the chatbot

Asking Wolfram Alpha something

Showing news headlines

Taking a photo and ID’ing who is in it

Retraining the PyTorch Neural Net on any new faces

Rebooting

Shutting down

If the user says an unknown command the menu just loops around.

At the moment I’m using lists to hold and compare for the keywords – I may move onto something more advanced in future so that the user does not have to be so specific in what they are saying, but at the moment it is serviceable and works.

I added the main.py program to /etc/profile with the line, this causes it to launch on login and ensures that it runs within the correct directory:

Update!

cd /home/pi/EDITH && python3 main.py&