# PiGlass v2

## Overview

https://youtu.be/rUvOdNnxrvo

PiGlass v2 is a remake of an [older project on the Adafruit Learning System](https://learn.adafruit.com/piglass-wearable-raspberry-pi-computer). I made v1 back in 2018 and ran into a lot of performance issues, so I couldn't make it do everything I wanted it to.

When I heard that the Pi Zero 2 was coming out, I knew I had to try this again. My experience with v1 greatly assisted me in the process of making v2. I redesigned it completely and created new software.

The Pi is now located on the back strap of a hat. the audio hat has the exact output using a bone conduction transducer and the hat also has 2 mems microphones. I am using the same 5mp Zero spy cam in the same spot. There is an 8BitDo Bluetooth gamepad as the input device. The display is the same as before, a Vufine+ 720p HDMI display.

When assembled and setup, you can watch shows/movies/YouTube, play retro games, livestream, record videos and take different types of pictures. It takes longer to setup the software than it does to build one. At the heart of this project is a button on the audio hat which is at the back of the head. it does 2 things when pushed, it will either:

1. Start the launcher program
2. Kill any running programs

The launcher and camera related programs all use the gamepad for input. Kodi and Retropie use the gamepad as well and can be started from the launcher program. The commands are stored in a toml file that you can edit to customize what your PiGlass v2 does.

# PiGlass v2

## Parts and Tools

### Raspberry Pi Zero 2 W

[Raspberry Pi Zero 2 W](https://www.adafruit.com/product/5291)
 **Raspberry Pi Zero 2 W** is the latest product in Raspberry Pi's most affordable range of single-board computers. The successor to the breakthrough Raspberry Pi Zero W, **Raspberry Pi Zero 2 W** is a form factor–compatible drop-in replacement for the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5291)
[Related Guides to the Product](https://learn.adafruit.com/products/5291/guides)
![Angled shot of a Raspberry Pi Zero 2 W.](https://cdn-shop.adafruit.com/640x480/5291-00.jpg)

### Zero Spy Camera for Raspberry Pi Zero

[Zero Spy Camera for Raspberry Pi Zero](https://www.adafruit.com/product/3508)
Is your house haunted? Or, rather, are you convinced that your house is haunted but have never been able to prove it since you've never had a camera that integrated with your Raspberry Pi Zero&nbsp;but was still small enough that the ghosts wouldn't notice it?  
  
Luckily, the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3508)
[Related Guides to the Product](https://learn.adafruit.com/products/3508/guides)
![Angled shot of Zero Spy Camera for Raspberry Pi Zero connected to a ribbon cable.](https://cdn-shop.adafruit.com/640x480/3508-04.jpg)

### Raspberry Pi Zero FPC Camera Cable - 30cm long

[Raspberry Pi Zero FPC Camera Cable - 30cm long](https://www.adafruit.com/product/5211)
This **30cm long**  **camera cable** is specifically designed to work with the **Raspberry Pi Zero** series (including Zero W and Zero WH) Just plug it into your Pi Zero's camera port and then the other end into one of the official <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5211)
[Related Guides to the Product](https://learn.adafruit.com/products/5211/guides)
![Raspberry Pi Zero FPC Camera Cable - 30cm long connected to a Pi zero and Pi camera ](https://cdn-shop.adafruit.com/640x480/5211-04.jpg)

### Bone Conductor Transducer with Wires - 8 Ohm 1 Watt

[Bone Conductor Transducer with Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/1674)
Drown out the voices in your head with a bone conduction transducer! This incredible speaker does not have a moving cone like most speakers you've seen, instead, a small metal rod is wrapped with the voice coil. When current is pulsed through the coil, the magnetic field causes a piece of...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1674)
[Related Guides to the Product](https://learn.adafruit.com/products/1674/guides)
![Small Bone Conductor Transducer with Wires](https://cdn-shop.adafruit.com/640x480/1674-00.jpg)

### Yichip Micro Mini Bluetooth® Keyboard – Black

[Yichip Micro Mini Bluetooth® Keyboard – Black](https://www.adafruit.com/product/3601)
Sure, you have a keyboard. Maybe it's wireless.&nbsp;Maybe it's even&nbsp;Bluetooth®. But do you have a _mini_ Bluetooth® keyboard? Like Halloween candy, this keyboard is fun-size! If Shakespeare had this wee chiclet keyboard back in the day, he...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3601)
[Related Guides to the Product](https://learn.adafruit.com/products/3601/guides)
![Mini Bluetooth Keyboard – Black colored](https://cdn-shop.adafruit.com/640x480/3601-00.jpg)

### Part: 40 pin header
quantity: 1
header for pi zero
[40 pin header](https://www.adafruit.com/product/2822)

### Part: Micro to Micro USB cable
quantity: 1
used to power the display
[Micro to Micro USB cable](https://www.adafruit.com/product/3610)

### Part: Vufine+
quantity: 1
The heads up display
[Vufine+](https://www.amazon.com/Vufine-006011-Wearable-Display/dp/B01MZ89QXF)

### Part: Safety Glasses
quantity: 1
glasses with strap
[Safety Glasses](https://www.amazon.com/gp/product/B003UYESRY)

### Part: Hat with plastic strap
quantity: 1
hat for mounting pi zero
[Hat with plastic strap](https://www.makershed.com/products/maker-zap-embroidered-baseball-cap)

### Part: 8Bitdo Zero 2 Gamepad
quantity: 1
Bluetooth gamepad
[8Bitdo Zero 2 Gamepad](https://www.amazon.com/Bluetooth-Gamepad-Turquoise-Nintendo-Raspberry/dp/B083GJQPZ4)

### Part: Waveshare WM8960
quantity: 1
Audio hat
[Waveshare WM8960](https://www.amazon.com/Waveshare-Raspberry-Encoding-Recording-Interface/dp/B07KN8424G)

### Part: 15 to 22 pin camera cable joiner
quantity: 1
camera cable joiner
[15 to 22 pin camera cable joiner](https://thepihut.com/products/camera-cable-joiner-for-raspberry-pi-15-pin-to-22-pin)

### Part: Micro to Mini HDMI cable
quantity: 1
display cable
[Micro to Mini HDMI cable](https://www.amazon.com/gp/product/B08BFZFT7R)

### Part: 64GB Micro SD Card
quantity: 1
SD card
[64GB Micro SD Card](https://www.amazon.com/gp/product/B07FCMBLV6/)

## Tools

Soldering Iron  
Heat gun  
Ruler  
Scissors  
Small flathead screwdriver  
Xacto knife

## Materials

4x 2.6mm wide - 6 inch long zip ties  
2x paper clips (or other clips)  
2mm heat shrink (1x 4" piece)  
1/4 inch heat shrink (2x 1.25" pieces)  
3/4 inch heat shrink (1x 1.25" piece)  
Double sided adhesive

# PiGlass v2

## Assembly

Note: You'll want to be careful handling certain parts of the build. The mechanically weak points of the hardware are:

- The **Pi Zero camera cable.** The connection to the Pi can pull out when you try it on the first time, and
- The **bone conduction transducer**. The heat shrink will move the point of failure from the transducer itself breaking to the wires popping out of the audio hat, which is an easy fix.

First thing: solder your 40 pin header onto your Pi Zero 2.

## Bone conduction transducer mounting

Gather the following:

Safety glasses  
Bone conduction transducer  
1x 4" piece of 2mm heat shrink  
2x 1.25" piece of 1/4 inch heat shrink  
1x 1.25" piece of 3/4 inch heat shrink

Put the 4 inch piece of 2mm heat shrink on the transducer wires and move it close to the transducer without putting tension on the connections and use a heat gun to snug it up to the wires.

![](https://cdn-learn.adafruit.com/assets/assets/000/110/572/medium800/camera_Untitled.png?1649187016)

Put one of the 1/4" pieces on heat shrink over the right side of the glasses frame then use the heat gun. This layer will help the others stay in place.

![raspberry_pi_PXL_20220329_170335062.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/348/medium640/raspberry_pi_PXL_20220329_170335062.jpg?1648578743)

Use the 3/4" heat shrink to attach the transducer to the frame. Place the transducer inside of the heat shrink and slide it onto the frame. The transducer should be oriented with the rectangle facing your head and the transducer on the same side of the frame as your head. This is what it's going to look like after you use the heat gun.

![raspberry_pi_PXL_20220329_170859107.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/352/medium640/raspberry_pi_PXL_20220329_170859107.jpg?1648579002)

Take the last 1/4" piece of heat shrink and put it over the transducer wires and over the frame. You'll want to push it on the frame until it just reaches inside the 3/4" piece then shrink it with the heat gun.

![raspberry_pi_PXL_20220329_173144968.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/353/medium640/raspberry_pi_PXL_20220329_173144968.MP.jpg?1648579139)

When you are done, it should look like this. Don't forget to cut a hole on the outside of the frame for the head strap of the glasses, it doesn't have to be perfect, just make sure the strap fits on.

![raspberry_pi_PXL_20220329_173453470.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/354/medium640/raspberry_pi_PXL_20220329_173453470.MP.jpg?1648579240)

## Assembly
Attach the audio hat to the transducer. A small flathead screwdriver will be needed. You will want to put some of the wire casing into the terminal so that it doesn't pull out easily, then attach the audio hat to the Pi.

![raspberry_pi_PXL_20220329_173647935.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/356/medium640/raspberry_pi_PXL_20220329_173647935.MP.jpg?1648579491)

Attach the camera to the camera cable adapter then zip tie the camera cable adapter to the Vufine. I have made two of these prototypes, one of the cameras had an adhesive backing and one did not, so you may or may not need a little double sided adhesive to mount the camera to the Vufine.

![raspberry_pi_PXL_20220329_173716179.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/357/medium640/raspberry_pi_PXL_20220329_173716179.MP.jpg?1648579597)

Attach the Vufine mount to the glasses as close to the hinge as possible. This picture shows the maximum distance you want to be from the hinge, closer is better.

![raspberry_pi_PXL_20220329_174021499.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/358/medium640/raspberry_pi_PXL_20220329_174021499.MP.jpg?1648579713)

Take the glasses under the hat and have the hat right side up. The Pi is mounted to the hat strap with 2 zip ties, the bottom of the Pi goes against the strap of the hat. Make sure it is centered before tightening them.

![raspberry_pi_PXL_20220329_174300670.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/360/medium640/raspberry_pi_PXL_20220329_174300670.MP.jpg?1648579927)

Take the camera cable and your choice of clips. I used 2 paperclips, but you can use whatever you like.

![raspberry_pi_PXL_20220329_175253208.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/361/medium640/raspberry_pi_PXL_20220329_175253208.MP.jpg?1648580073)

The camera cable is going to go into the Pi, then 2 clips evenly spaced from the Pi to the start of the brim of the hat.

![](https://cdn-learn.adafruit.com/assets/assets/000/110/362/medium800/raspberry_pi_PXL_20220329_175503042.MP.jpg?1648580147)

Take the vufine and attach it to the mount from earlier.

![raspberry_pi_PXL_20220329_175536880.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/364/medium640/raspberry_pi_PXL_20220329_175536880.MP.jpg?1648580220)

Add a zip tie to secure the vufine to the frame.

![raspberry_pi_PXL_20220329_175636509.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/365/medium640/raspberry_pi_PXL_20220329_175636509.MP.jpg?1648580320)

You will have to bend your camera cable a little. The first bend is at the paperclip located near the brim, then bend it towards the front again. The cable will look like this.

![raspberry_pi_PXL_20220329_175836144.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/371/medium640/raspberry_pi_PXL_20220329_175836144.MP.jpg?1648580468)

Attach the camera cable to the camera cable adapter.

![raspberry_pi_PXL_20220329_175815117.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/372/medium640/raspberry_pi_PXL_20220329_175815117.MP.jpg?1648580517)

## Finishing up

Turn the hat/glasses upside down. Attach the micro to micro USB cable and the micro to mini HDMI cable.

![](https://cdn-learn.adafruit.com/assets/assets/000/110/577/medium800/camera_Untitled.png?1649187343)

The last step is to attach the straps for the glasses, the straps are optional. The straps help with the bone conduction audio. With the straps on, the audio sounds like you have a headphone in your ear. Without the straps it is still pretty good, the sound quality doesn't change, the intensity does.

![raspberry_pi_PXL_20220329_180137400.MP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/110/377/medium640/raspberry_pi_PXL_20220329_180137400.MP.jpg?1648580674)

# PiGlass v2

## Prerequisite Software Setup

Flash your sd-card with [2021-05-07-raspios-buster-armhf.zip](http://ftp.jaist.ac.jp/pub/raspberrypi/raspios_armhf/images/raspios_armhf-2021-05-28/2021-05-07-raspios-buster-armhf.zip) as this version has been tested with this hardware configuration.

Setup your [WiFi connection preferences](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/setting-up-wifi-with-occidentalis). My recommendations are you add your home network and your phone's hotspot. You should ssh in from some other device to do the installs, you will need a monitor later on to setup Kodi and RetroPie.

Enable Camera

```auto
sudo raspi-config
```

## Install the audio hat driver

The Audio Hat Manual is [here](WM8960_Audio_HAT_User_Manual_EN.pdf). The manual was missing a step, install `rpi-source` before following the steps, this will take a bit.

```auto
sudo apt update
sudo apt install rpi-source
```

```auto
git clone https://github.com/waveshare/WM8960-Audio-HAT
cd WM8960-Audio-HAT
sudo ./install.sh
```

Reboot.

Check that driver was installed:

```auto
cd WM8960-Audio-HAT
sudo dkms status
```

You should see  
`wm8960-soundcard, 1.0: added`

Pair The Bluetooth Pro Controller then repeat the pairing steps for the keyboard.

```auto
bluetoothctl
```

Type `scan on` then  
`pair` mac of 'Pro Controller'  
`trust` mac of 'Pro Controller'  
`connect` mac of 'Pro Controller'

Pro Controller UDev rules

```auto
sudo nano /etc/udev/rules.d/99-input.rules
```

Replace the file with:

```auto
KERNEL=="event*", SUBSYSTEM=="input", GROUP="input", MODE="0660"
KERNEL=="event*", ATTRS{name}=="Pro Controller", SYMLINK+="input/by-id/Gamepad"
```

Edit this file to allow the programs to have access to the xserver:

```auto
sudo nano /usr/share/dispsetup.sh
```

Add the next line above the last line and below the first:

```auto
xhost +
```

Edit this file to change the default sound card to be the waveshare hat at index 1:

```auto
sudo nano /usr/share/alsa/alsa.conf
```

Look for these lines:  
`defaults.ctl.card 0`  
`defaults.pcm.card 0`  
Replace with:

```auto
defaults.ctl.card 1
defaults.pcm.card 1
```

Edit this file to set the default display.

```auto
sudo nano /etc/environment
```

Add:

```auto
DISPLAY=:0
```

Install ttyecho:

```auto
git clone https://github.com/osospeed/ttyecho.git
cd ttyecho/
make
sudo make install
```

Add these lines to **/boot/config.txt** to set the framebuffer and overclock.

```auto
framebuffer_width=640
framebuffer_height=480
over_voltage=4
arm_freq=1300
core_freq=500
```

Remove the welcome to Raspberry Pi wizard:

```auto
sudo rm /etc/xdg/autostart/piwiz.desktop
```

`Lightdm` is disabled to save resources, it is not needed for Kodi, RetroPie or the programs.

```auto
sudo systemctl disable lightdm.service
```

The message of the day can be customized, you can make one or you can use mine.

```auto
sudo nano /etc/motd
```

```terminal
______  _  _____ _                      ___  
|  __ \(_)/ ____| |                    |__ \ 
| |__)  _| |  __| | __ _ ___ ___  __   __ ) |
|  ___/| | | |_ | |/ _` / __/ __| \ \ / // / 
| |    | | |__| | | (_| \__ \__ \  \ V // /_ 
|_|    |_|\_____|_|\__,_|___/___/   \_/|____|
                                                     
Made with love by Matt the Maker
```

# PiGlass v2

## PiGlass v2 Software Tutorial

Install Python libraries, this will take a bit:

```auto
sudo apt install vlc python3-evdev python3-alsaaudio python3-vlc python3-opencv python3-toml fbi
```

Clone PiGlass v2 Repo:

```auto
git clone https://github.com/matt-desmarais/PiGlassv2.git
```

Copy service file to the system location and enable:

```auto
sudo cp /home/pi/PiGlassv2/button.service /etc/systemd/system/
sudo systemctl enable button.service
```

The bumpers are volume up/down.  
The dpad with up/down will cycle options.  
Select will launch the currently selected option.  
Press Y to toggle rainbow mode.

Everything the launcher does is controlled by a file called **piglasscmds.toml**.

The working directory is **/home/pi/PiGlassv2**.

The format of the launcher's file is:  
[Title]&nbsp; &nbsp; &nbsp; &nbsp; The name of the option you want to display.  
color&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The color for this item for rainbow mode.  
cmd&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The command you want to run/shell script/program.  
process&nbsp; &nbsp; The processes to kill related to the command.

```auto
[Kodi]
color = "red"
cmd = "sudo ttyecho -n /dev/tty1 kodi"
process = "kodi.bin_v7"

[RetroPie]
color = "green"
cmd = "sudo ttyecho -n /dev/tty1 emulationstation"
process = "retroarch emulationstatio"

["Funny Camera"]
color = "purple"
cmd = "python3 funnycamera.py"
process = "python3"

["Video w/Audio"]
color = "brown"
cmd = "sh videosound.sh"
process = "raspivid ffmpeg"
```

You can test a command before you add it by using this command followed by yours, if your command is more than one word (has spaces) make sure to put it in quotes

```auto
sudo ttyecho -n /dev/tty1 "sudo apt update"
```

# PiGlass v2

## RetroPie

You can play retro games with RetroPie. I have NES and SNES installed and have hundreds of games for them.

After installing RetroPie, you will need to put games into the proper folders in order to play them. Some games load with a black border around the game, you can press the Vufine's button to change the display mode, which will make the game take up the whole display

![Mario](https://images.ctfassets.net/2lpsze4g694w/3E1rDn6Ej3qKD6FqJjzEF9/eed0d23fccd3715c3098c3bae3fdd5eb/Screenshot_2022-02-21_at_05.49.31.png?w=800)

**RetroPie Manual Install: [RetroPie Install Instructions](https://retropie.org.uk/docs/Manual-Installation/ "RetroPie")**

```auto
git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git
```

```auto
sudo apt install libegl1-mesa-dev libegl-mesa0 libgbm1 libudev-dev libxkbcommon-dev libsdl2-dev libusb-1.0-0-dev libx11-xcb-dev libgbm-dev libavcodec-dev libavformat-dev libavdevice-dev
```

```auto
cd RetroPie-Setup
chmod +x retropie_setup.sh
sudo ./retropie_setup.sh
```

Manage packages  
Install core packages

Manage main packages  
Install SNES (snes9x) NES (nestopia)

You should hook your Pi up to a monitor to setup RetroPie.

Run Emulationstation

```auto
emulationstation
```

Setup controller: [Controller Configuration](https://retropie.org.uk/docs/Controller-Configuration/)  
When you get to the welcome screen, hold a button to start the controller configuration process.  
  
Transfer roms: [Transferring Roms](https://retropie.org.uk/docs/Transferring-Roms/)  
You will need to put the ROMs for the consoles you installed into the proper folders. _It is out of the scope of this tutorial on obtaining game ROMs._  
  
If you have any questions, I suggest looking at the [RetroPie Docs](https://retropie.org.uk/docs/).

# PiGlass v2

## Kodi

Kodi&nbsp;is a free and open source media player application developed by the&nbsp;Kodi&nbsp;Foundation. It can be used to view all of the images and videos (including launcher footage) recorded by PiGlass, make sure to add **/home/pi/Pictures** as a picture source and **/home/pi/Videos** [as a video source](https://kodi.wiki/view/Adding_video_sources).

You can [install any add-ons](https://kodi.wiki/view/Add-on_manager) that you want. I have [YouTube](https://github.com/anxdpanic/plugin.video.youtube/wiki/Installation) and [Netflix](https://github.com/CastagnaIT/plugin.video.netflix/wiki/How-install-the-addon), but there are many others available. You can also install the Kore app ([Android](https://play.google.com/store/apps/details?id=org.xbmc.kore), [iOS](https://apps.apple.com/us/app/official-kodi-remote/id520480364)) on your smartphone and control Kodi from that.  
  
You should hook your Pi up to a monitor to setup the add-ons you want.

```auto
cd RetroPie-Setup
sudo ./retropie_setup.sh
```

Manage packages  
Manage opt packages  
Install Kodi `#166`

Run Kodi:

```auto
kodi
```

Because the the controller was setup with RetroPie, the controller will just work when Kodi is installed through RetroPie.

The Vufine has one button. You hold it to turn it on/off. When the Vufine is on, if you press the button it changes the viewing mode. It has 3 modes. If you aren't in the fullscreen mode, then when Kodi loads you will get a black screen, press the button on the Vufine until you can see Kodi.

# PiGlass v2

## Camera

The Camera program can take pictures/record silent video, Pictures are copied to **/home/pi/Pictures** , Videos are copied to **/home/pi/Videos**.

The bumpers are zoom in/out  
The dpad will pan up/down/left/right while zoomed  
Hold X button: take picture  
Hold A button: record silent video  
Hold X button: reset zoom

https://www.youtube.com/watch?v=lzEnauHU_FY

No Zoom

![](https://cdn-learn.adafruit.com/assets/assets/000/110/324/medium800/raspberry_pi_1.jpg?1648564444)

Halfway Zoomed

![](https://cdn-learn.adafruit.com/assets/assets/000/110/325/medium800/raspberry_pi_2.jpg?1648564457)

Fully Zoomed

![](https://cdn-learn.adafruit.com/assets/assets/000/110/326/medium800/raspberry_pi_3.jpg?1648564468)

# PiGlass v2

## Funny Camera

This camera program called “funny camera” uses OpenCV to overlay images on detected faces. It is also fed by a toml file to make it easy to add your own images and put them where you want on peoples faces.

To add more, you have to upload the .png to the PiGlassv2 directory and add an entry in **piglass.toml**. When you take a picture and faces are detected, the funny image gets generated and then displayed to the wearer for 4 seconds.

The bumpers are zoom in/out  
The dpad will cycle the overlay options with up/down  
The dpad left/right will pan left/right when zoomed  
Hold X button: take a picture  
Hold B button: take funny picture  
Hold A button: take random funny picture  
Hold Y button: reset zoom  
  
The format of the toml file is:  
[Title]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is the name you want to display for this option  
display\_name is what you would call the item as a plural.  
file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is the name of the .png file you want to overlay  
location&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is a word representing the general location of the image on the face  
  
Locations include:&nbsp;  
top, center, bottom, top-left, top-right, center-left, center-right, bottom-left, bottom-right

There is also a location called face which is scaled differently to replace a face versus fit on it.

```auto
[brainslug]
display_name = "Slugs"
file = "mask2.png"
location = "top-right"
```

![](https://cdn-learn.adafruit.com/assets/assets/000/110/306/medium800/raspberry_pi_slug.jpg?1648504644)

```auto
["brain blender"]
display_name = "Blenders"
file = "mask4.png"
location = "top"
```

![](https://cdn-learn.adafruit.com/assets/assets/000/110/307/medium800/raspberry_pi_blender.jpg?1648504730)

```auto
["dum sticker"]
display_name = "Dum"
file = "maskdum.png"
location = "center-right"
```

![](https://cdn-learn.adafruit.com/assets/assets/000/110/308/medium800/raspberry_pi_dum.jpg?1648504768)

This video shows the options and what happens when you select one when no faces are found.

https://youtu.be/HKfixXOF6RQ

# PiGlass v2

## Live Streaming

There are two commands involved in live streaming: raspivid and ffmpeg. The streams are 720p 25fps 44kb stereo audio, streams are silent for the first 6 seconds

```auto
raspivid --timeout 0 --width 1280 --height 720 --rotation 270 --profile high --level 4.1 --bitrate 2250000 --framerate 25.375 --intra 90 --annotate 4 --annotate 8 --output - | ffmpeg -i - -f alsa -channels 2 -sample_rate 22050 -itsoffset 6 -i hw:1 -c:v copy -af "volume=8.0,aresample=async=1" -c:a aac -b:a 48k -map 0:v -map 1:a  -f flv rtmp://URL and KEY go here
```

YouTube **rtmp://** segment, located in **youtube.sh**

```auto
rtmp://a.rtmp.youtube.com/live2/KEY goes here
```

Add YouTube streaming as an option by editing **piglasscmds.toml**.

```auto
["YouTube Stream"]
color = "orange"
cmd = "sh youtube.sh"
process = "raspivid ffmpeg"
```

Facebook **rtmps://** segment, located in **facebook.sh** :

```auto
rtmps://live-api-s.facebook.com:443/rtmp/Key goes here
```

Add Facebook streaming as an option by editing **piglasscmds.toml** :

```auto
["Facebook Stream"]
color = "orange"
cmd = "sh facebook.sh"
process = "raspivid ffmpeg"
```

Twitch **rtmp://** segment, located in **twitch.sh** :

```auto
rtmp://live.twitch.tv/app/Key goes here
```

Add Twitch streaming as an option by editing **piglasscmds.toml** :

```auto
["Twitch Stream"]
color = "orange"
cmd = "sh twitch.sh"
process = "raspivid ffmpeg"
```

I also setup my own rtmp server and page to view the stream using a VPS.  
  
This part sets up the streaming to the server: [Nginx RTMP Streaming setup](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-video-streaming-server-using-nginx-rtmp-on-ubuntu-20-04).

This part is used to make a page that your stream can be viewed from [Dash JS](https://github.com/Dash-Industry-Forum/dash.js?).

# PiGlass v2

## Future Features

I am working on voice commands using hotwords and offline sentence recognition. I have had success using the program [spchcat](https://github.com/petewarden/spchcat). It does offline sentence recognition. I still need to find a way to do hotwords. Hotwords would trigger commands or start spchcat. I want to be able to trigger [Picture screenshot combo](https://learn.adafruit.com/piglass-wearable-raspberry-pi-computer/picture-screenshot-combo) feature from v1 with a hotword.  
  
I am working on a program called pet camera which like the funny picture program will overlay images on pets faces.  
  
If you make your own PiGlass and make it do something new please [tell me about it on GitHub](https://github.com/matt-desmarais/PiGlassv2/issues).


## Featured Products

### Raspberry Pi Zero 2 W

[Raspberry Pi Zero 2 W](https://www.adafruit.com/product/5291)
 **Raspberry Pi Zero 2 W** is the latest product in Raspberry Pi's most affordable range of single-board computers. The successor to the breakthrough Raspberry Pi Zero W, **Raspberry Pi Zero 2 W** is a form factor–compatible drop-in replacement for the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5291)
[Related Guides to the Product](https://learn.adafruit.com/products/5291/guides)
### Micro USB to Micro USB OTG Cable - 10-12" / 25-30cm long

[Micro USB to Micro USB OTG Cable - 10-12" / 25-30cm long](https://www.adafruit.com/product/3610)
This cable is a little unusual, rather than having a USB A plug on one end, it has _two_ Micro B USB connections! What is this for? It's for when you have a "USB On-The-Go (OTG)" device, and you want to plug in another USB device. For example, a Pi Zero or Pi Zero W has a...

In Stock
[Buy Now](https://www.adafruit.com/product/3610)
[Related Guides to the Product](https://learn.adafruit.com/products/3610/guides)
### Bone Conductor Transducer with Wires - 8 Ohm 1 Watt

[Bone Conductor Transducer with Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/1674)
Drown out the voices in your head with a bone conduction transducer! This incredible speaker does not have a moving cone like most speakers you've seen, instead, a small metal rod is wrapped with the voice coil. When current is pulsed through the coil, the magnetic field causes a piece of...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1674)
[Related Guides to the Product](https://learn.adafruit.com/products/1674/guides)
### Zero Spy Camera for Raspberry Pi Zero

[Zero Spy Camera for Raspberry Pi Zero](https://www.adafruit.com/product/3508)
Is your house haunted? Or, rather, are you convinced that your house is haunted but have never been able to prove it since you've never had a camera that integrated with your Raspberry Pi Zero&nbsp;but was still small enough that the ghosts wouldn't notice it?  
  
Luckily, the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3508)
[Related Guides to the Product](https://learn.adafruit.com/products/3508/guides)
### Raspberry Pi Zero FPC Camera Cable - 30cm long

[Raspberry Pi Zero FPC Camera Cable - 30cm long](https://www.adafruit.com/product/5211)
This **30cm long**  **camera cable** is specifically designed to work with the **Raspberry Pi Zero** series (including Zero W and Zero WH) Just plug it into your Pi Zero's camera port and then the other end into one of the official <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5211)
[Related Guides to the Product](https://learn.adafruit.com/products/5211/guides)
### Break-away 0.1" 2x20-pin Strip Dual Male Header

[Break-away 0.1" 2x20-pin Strip Dual Male Header](https://www.adafruit.com/product/2822)
If we could eat headers, we'd have them for breakfast, lunch, and dinner. &nbsp;But we can't :( So&nbsp;we're making the best of it and selling them!

This **2x20-pin strip&nbsp;male header** is a great way to add pins to 2x20 0.1" holes in a PCB....

In Stock
[Buy Now](https://www.adafruit.com/product/2822)
[Related Guides to the Product](https://learn.adafruit.com/products/2822/guides)

## Related Guides

- [PyPortal Hurricane Tracker](https://learn.adafruit.com/pyportal-hurricane-tracker.md)
- [Coffee Rater](https://learn.adafruit.com/coffee-rater.md)
- [Superhero Power Plant](https://learn.adafruit.com/superhero-power-plant.md)
- [Glowing Mirror Mask](https://learn.adafruit.com/glowing-mirror-mask.md)
- [Glowing Skullcandy Headphones Mod](https://learn.adafruit.com/glowing-skullcandy-headphones-mod.md)
- [MakeCode Arcade with Raspberry Pi Zero](https://learn.adafruit.com/makecode-arcade-with-raspberry-pi-zero.md)
- [AdaBox 014](https://learn.adafruit.com/adabox014.md)
- [PyPortal WFH Busy Sounds Simulator](https://learn.adafruit.com/pyportal-wfh-busy-sounds-simulator.md)
- [Kali Linux on the Raspberry Pi with the PiTFT](https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft.md)
- [Wakanda Forever Game](https://learn.adafruit.com/wakanda-forever-game.md)
- [Python Edge Speech Recognition with Voice2JSON](https://learn.adafruit.com/edge-speech-recognition-with-voice2json.md)
- [FLORAbrella](https://learn.adafruit.com/florabrella.md)
- [CircuitPython displayio Setup for TFT FeatherWings](https://learn.adafruit.com/using-circuitpython-displayio-with-a-tft-featherwing.md)
- [PyPortal Voice Controlled Smart Switch and Time Display](https://learn.adafruit.com/pyportal-voice-controlled-smart-switch-and-time-display.md)
- [No-Sew LED Wristband](https://learn.adafruit.com/no-sew-led-wristband.md)
