# Listener software (Mplayer + drivers)

## Summary

User: grace
Hostname: listener.local
Password: emergence
Running mplayer, soundcard library, lcd graphics library, and custom python code for text printing logic.

## Bill of Materials

- Raspberry pi zero 2 wh - https://www.waveshare.com/product/raspberry-pi/boards-kits/raspberry-pi-zero-2-w-cat/raspberry-pi-zero-2-w.htm?sku=21038
- 32GB Micro SD card - https://www.waveshare.com/raspberry-pi-sd-card.htm.
- Waveshare UPS with 1000mah battery - https://www.waveshare.com/ups-hat-c.htm
- Waveshare sound card hat with speakers- https://www.waveshare.com/wm8960-audio-hat.htm
- 1602 LCD screen - https://www.waveshare.com/lcd1602-i2c-module-blue.htm?sku=30496
- Jumper wires - https://www.waveshare.com/product/accessories/adapters-cables-antennas/jumper-wires/jumper-wire-1-pin-2.54-pitch-200mm.htm
- mini HDMI to hdmi cable - https://hosatech.com/products/video/hdmi/hdmc-400/
- micro USB male to usb a femail adapter - https://www.amazon.com/dp/B01C6032G0
- Keyboard with usb a cable - https://www.amazon.com/AmazonBasics-Matte-Keyboard-QWERTY-Layout/dp/B07WJ5D3H4/

## Hardware assembly

- Solder header to the pi if not pre-soldered
- Plug the battery into the UPS board
- Screw the UPS to the pi
- Screw a next level of standoffs to the pi
- Put the audio hat on the pi's headers, and screw it to the standoffs
- Plug in the speakers
- Plug the jumper wires into the screen and the pi according to the [screen-wiring.png](screen-wiring.png) file (via https://peppe8o.com/1602-lcd-raspberry-pi-display/).

## Pre work

You will need a micro SD card reader and computer to complete the next step.

1. Download the raspberry pi imager from [raspberrypi.com/software](https://www.raspberrypi.com/software).
2. Install raspian lite 64 bit for raspi zero 2.
   A. Make sure to configure user and wifi and turn on ssh services when you install.
   B. If you don't already have an ssh key, make one with `ssh-keygen -t ed25519 -C "your_email@example.com"` and then copy it with `cat ~/.ssh/id_ed25519.pub` and paste it into the ssh service in the services section of the imager.
3. Boot the pi.

## Setup instructions

Running the setup script from the command line

### Using node and npm

If you have node and npm installed, you can run this command from inside this repository:

```
npm run setup:listener
```

Type "yes" when prompted to continue connecting and the press enter.

If you'd like to install node and npm try installing https://volta.sh and then running volta install node@latest.

### Using the terminal

If you do not have node and npm installed you can run this command from inside this repository:

```
rsync -av --exclude-from='exclude.txt' ./ grace@listener.local:portal && ssh grace@listener.local -t 'cd portal/setup/listener && chmod +x install.sh && sudo ./install.sh; bash -l'
```
