2020-12-14 13:20:54 +00:00
|
|
|
# Announcement Box
|
|
|
|
|
|
|
|
Linux box with a loudspeaker and an emergency light to be used for announcements and notifications.
|
|
|
|
|
|
|
|
## Hardware
|
2020-12-17 19:08:59 +00:00
|
|
|
### Overview
|
2020-12-14 13:20:54 +00:00
|
|
|
* SBC with GPIOs and sound output :: OrangePi Zero with an expansion board
|
|
|
|
* PA system
|
|
|
|
* speaker :: 30W, 4 Ohms horn loudspeaker
|
|
|
|
* sound amplifier :: mono 18W sound amplifier
|
|
|
|
* relay module :: 12V low trigger relay
|
|
|
|
* Warning Light system
|
|
|
|
* warning light :: 12V 10W rotary orange warning light
|
|
|
|
* relay module :: 12V low trigger relay
|
2020-12-17 19:08:59 +00:00
|
|
|
* System Activity Light system
|
|
|
|
* indicator LED
|
|
|
|
* Human Activity Sensor system
|
|
|
|
* PIR module
|
|
|
|
|
|
|
|
### Building
|
|
|
|
TBD
|
|
|
|
|
2020-12-14 13:20:54 +00:00
|
|
|
## Software
|
2020-12-17 19:08:59 +00:00
|
|
|
### Overview
|
2020-12-14 13:20:54 +00:00
|
|
|
* Operating System - Linux :: Armbian Bullseye for the OrangePi Zero
|
|
|
|
* PA System
|
|
|
|
* Voice Synthesizer :: Festival / ESpeak
|
|
|
|
|
2020-12-17 19:08:59 +00:00
|
|
|
### Installation
|
|
|
|
Run as root:
|
|
|
|
```bash
|
|
|
|
cp toolkit/* /usr/local/bin/
|
|
|
|
|
|
|
|
cp etc/systemd/system /etc/systemd/system
|
|
|
|
systemctl enable --now system-activity-light.service
|
|
|
|
systemctl enable --now human-activity-sensor.service
|
|
|
|
```
|
|
|
|
|
2020-12-14 13:20:54 +00:00
|
|
|
## Implementation Notes
|
|
|
|
|
|
|
|
### Armbian + OrangePi Zero Installation
|
|
|
|
|
|
|
|
#### Enable analog soundcard
|
|
|
|
```
|
|
|
|
sudo armbian-config
|
|
|
|
# System > Hardware > [*] analog-codec
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Software Dependencies
|
|
|
|
##### OS Packages
|
|
|
|
```bash
|
|
|
|
apt install mplayer espeak-ng
|
|
|
|
```
|
|
|
|
|
|
|
|
##### GPIO toolkit
|
|
|
|
```bash
|
|
|
|
# upstream:
|
|
|
|
#git clone https://github.com/orangepi-xunlong/wiringOP
|
|
|
|
# enhanced:
|
|
|
|
git clone https://github.com/Dejvino/wiringOP
|
|
|
|
cd wiringOP
|
|
|
|
./build clean
|
|
|
|
./build
|
|
|
|
```
|
|
|
|
|
|
|
|
### PA System
|
2020-12-14 16:25:16 +00:00
|
|
|
#### Enabling mixed sound output
|
|
|
|
```bash
|
|
|
|
cat ~/.asoundrc
|
|
|
|
pcm.!default plug:dmix
|
|
|
|
```
|
|
|
|
|
2020-12-14 13:20:54 +00:00
|
|
|
#### Text to Speech
|
|
|
|
```bash
|
|
|
|
## Festival
|
|
|
|
# reading
|
|
|
|
...
|
|
|
|
# to file
|
|
|
|
text2wave text.txt > wave.wav
|
|
|
|
|
|
|
|
## ESpeak
|
|
|
|
# voices:
|
|
|
|
ls /usr/lib/arm-linux-gnueabihf/espeak-data/voices/
|
|
|
|
# reading
|
|
|
|
espeak -f text.txt -p 40 -s 160 -v "en-us"
|
|
|
|
# to file
|
|
|
|
espeak -f text.txt -p 40 -s 160 -k15 -g 1 -w wave.wav
|
|
|
|
# using SSML (e.g.: https://www.xml.com/pub/a/2004/10/20/ssml.html)
|
|
|
|
espeak -f ssml.txt -m
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Converting into a low-quality broadcast audio
|
|
|
|
```bash
|
|
|
|
sox infile.wav outfile.wav downsample echo 0.5 1 1 1
|
|
|
|
```
|
|
|
|
|
2020-12-17 19:08:59 +00:00
|
|
|
### Human Activity Sensor
|
2020-12-14 13:20:54 +00:00
|
|
|
|
2020-12-17 19:08:59 +00:00
|
|
|
#### Reading File Timestamp
|
2020-12-14 13:20:54 +00:00
|
|
|
```bash
|
2020-12-17 19:08:59 +00:00
|
|
|
stat /var/tmp/human_last_seen --format=%Y
|
2020-12-14 13:20:54 +00:00
|
|
|
```
|
|
|
|
|