You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Announcement Box
  2. Linux box with a loudspeaker and an emergency light to be used for announcements and notifications.
  3. ![Hardware](hw.jpg)
  4. ## Hardware
  5. ### Overview
  6. * SBC with GPIOs and sound output :: OrangePi Zero with an expansion board
  7. * PA system
  8. * speaker :: 30W, 4 Ohms horn loudspeaker
  9. * sound amplifier :: mono 18W sound amplifier
  10. * relay module :: 12V low trigger relay
  11. * Warning Light system
  12. * warning light :: 12V 10W rotary orange warning light
  13. * relay module :: 12V low trigger relay
  14. * System Activity Light system
  15. * indicator LED
  16. * Human Activity Sensor system
  17. * PIR module
  18. ### Building
  19. TBD
  20. ## Software
  21. ### Overview
  22. * Operating System - Linux :: Armbian Bullseye for the OrangePi Zero
  23. * PA System
  24. * Voice Synthesizer :: Festival / ESpeak
  25. ### Installation
  26. Run as root:
  27. ```bash
  28. cp toolkit/* /usr/local/bin/
  29. cp etc/systemd/system /etc/systemd/system
  30. systemctl enable --now system-activity-light.service
  31. systemctl enable --now human-activity-sensor.service
  32. ```
  33. ## Implementation Notes
  34. ### Armbian + OrangePi Zero Installation
  35. #### Enable analog soundcard
  36. ```
  37. sudo armbian-config
  38. # System > Hardware > [*] analog-codec
  39. ```
  40. #### Software Dependencies
  41. ##### OS Packages
  42. ```bash
  43. apt install mplayer espeak-ng
  44. ```
  45. ##### GPIO toolkit
  46. ```bash
  47. # upstream:
  48. #git clone https://github.com/orangepi-xunlong/wiringOP
  49. # enhanced:
  50. git clone https://github.com/Dejvino/wiringOP
  51. cd wiringOP
  52. ./build clean
  53. ./build
  54. ```
  55. ### PA System
  56. #### Enabling mixed sound output
  57. ```bash
  58. cat ~/.asoundrc
  59. pcm.!default plug:dmix
  60. ```
  61. #### Text to Speech
  62. ```bash
  63. ## Festival
  64. # reading
  65. ...
  66. # to file
  67. text2wave text.txt > wave.wav
  68. ## ESpeak
  69. # voices:
  70. ls /usr/lib/arm-linux-gnueabihf/espeak-data/voices/
  71. # reading
  72. espeak -f text.txt -p 40 -s 160 -v "en-us"
  73. # to file
  74. espeak -f text.txt -p 40 -s 160 -k15 -g 1 -w wave.wav
  75. # using SSML (e.g.: https://www.xml.com/pub/a/2004/10/20/ssml.html)
  76. espeak -f ssml.txt -m
  77. ```
  78. #### Converting into a low-quality broadcast audio
  79. ```bash
  80. sox infile.wav outfile.wav downsample echo 0.5 1 1 1
  81. ```
  82. ### Human Activity Sensor
  83. #### Reading File Timestamp
  84. ```bash
  85. stat /var/tmp/human_last_seen --format=%Y
  86. ```