squawk
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
squawk [2016-10-09 22:31] – tim | squawk [2016-10-10 15:59] – rob | ||
---|---|---|---|
Line 9: | Line 9: | ||
Examples for testing might be something like: | Examples for testing might be something like: | ||
+ | Play a sound file: | ||
+ | < | ||
+ | mosquitto_pub -h mqtt -t ' | ||
+ | </ | ||
+ | Text-to-speech message (with a subtle notification bong): | ||
< | < | ||
- | mosquitto_pub -h mqtt -t ' | ||
mosquitto_pub -h mqtt -t ' | mosquitto_pub -h mqtt -t ' | ||
</ | </ | ||
+ | Text-to-speech message (with a clear airport/ | ||
+ | < | ||
+ | mosquitto_pub -h mqtt -t ' | ||
+ | </ | ||
+ | |||
+ | **Theory:** You could direct sound two only two rooms at once by playing the left or right channel only. By default mpg123 is called with the -m option to ensure that the output is mono and thus the same sound comes out every speaker. | ||
===== Raspbian ===== | ===== Raspbian ===== | ||
Line 46: | Line 56: | ||
< | < | ||
- | su -c "mpg123 | + | su -c "/ |
su -c "/ | su -c "/ | ||
</ | </ | ||
Line 122: | Line 132: | ||
candidates.append(f) | candidates.append(f) | ||
if len(candidates) == 0: | if len(candidates) == 0: | ||
- | | + | |
+ | return | ||
filename = random.choice(candidates) | filename = random.choice(candidates) | ||
else: | else: | ||
# single file requested | # single file requested | ||
if filename not in allfiles: | if filename not in allfiles: | ||
- | | + | |
+ | | ||
base, ext = os.path.splitext(filename) | base, ext = os.path.splitext(filename) | ||
if ext == ' | if ext == ' | ||
- | command = [' | + | command = [' |
call_with_timeout(command, | call_with_timeout(command, | ||
else: | else: | ||
Line 329: | Line 340: | ||
play -q / | play -q / | ||
rm -f / | rm -f / | ||
+ | </ | ||
+ | |||
+ | ==== / | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | sleep 3 | ||
+ | _IP4=$(hostname -I | cut -d ' ' -f 1) || true | ||
+ | |||
+ | mpg123 -m -q / | ||
+ | / | ||
</ | </ | ||
===== Audio files ===== | ===== Audio files ===== | ||
- | These live in / | + | These live in / |
< | < | ||
Line 369: | Line 391: | ||
===== Hardware ===== | ===== Hardware ===== | ||
+ | {{ : | ||
+ | The " | ||
+ | |||
+ | There are four speakers connected, two per channel, located in each of the rooms on the ceiling. The speakers are 8 Ohm moisture resistant cheap ceiling speakers that have exceeded expectations and produce a surprisingly full sound. This opens up the potential for using them for background music in the future (e.g. via MPD). | ||
+ | |||
+ | ==== Raspberry Pi ==== | ||
+ | |||
+ | Standard pi other than having some wires soldered on the underside of the board to connect to the 3.5mm audio jack. Powered via the header rather than USB. | ||
+ | |||
+ | ==== Amplifier ==== | ||
+ | |||
+ | * TPA3116 | ||
+ | * "100 W" | ||
+ | * 12-24v (more volts = more power) | ||
+ | * Volume pot | ||
+ | * 3-pin header input or 3.5mm socket | ||
+ | |||
+ | Audio is input via the 3-pin header. | ||
+ | |||
+ | Power is input on the centre screw terminal, with left and right speaker outputs either side. | ||
+ | |||
+ | ==== Power Supply ==== | ||
+ | |||
+ | The system runs off a 19.5v laptop PSU located in the ceiling space. This is directly connected into the amplifier board, which is rated up to 24v. A spur from this connects to a DC-DC buck converter, supplying the Raspberry Pi with 5v. The original mini converter used was overheating and melting the heatshrink. It's now been replaced with a larger type which so far is running relatively cool. | ||
+ | |||
+ | Care should be taken when re-wiring as connecting the laptop PSU accidentally reverse polarity, to the speaker terminals, or to the speakers themselves will likely result in one or more of those being instantly destroyed. | ||
+ | |||
+ | {{ : | ||
+ | ==== Speakers ==== | ||
+ | |||
+ | * 8 Ohm | ||
+ | * 80 W | ||
+ | * Spade terminals | ||
+ | * Dual cone | ||
+ | |||
+ | Two wired in parallel to each channel, as per the following diagram. This roughly equates to 4 Ohm per channel, which is within the 4-8 Ohm spec of the amplifier. | ||
- | Pi lives above door. Connected to shit amp board. Amp board and speaker being replaced very soon - will document this then. | + | {{: |
squawk.txt · Last modified: 2023-11-25 23:45 by jaso55555