Like most Canadians, I watch a bit of hockey. Recently I have been looking for a way to automatically express my joy when my team scores a goal.With old truck horns, air solenoid valves, compressors and raspberry pie (Raspberry Pi Zero W can work), we can create an automatic air horn that will sound every time your team scores a goal, letting everyone in your family (and your neighbors) know.
What do you need for this project
How to make a Raspberry Pi NHL air horn
1. Set up your Raspberry Pi. If you don’t know how to do this, check out our story on how to set up a Raspberry Pi for the first time or how to set up a headless Raspberry Pi (no display or keyboard).
2. Install git as needed, then Clone repository To your Raspberry Pi.
cd ~/ sudo apt-get update && sudo apt-get -y install git git clone https://github.com/rydercalmdown/raspberry_pi_goal_horn.git
3. Go down to the cloned repository and run the install command Install all lower-level and python-based requirements for the project.
cd ~/raspberry_pi_goal_horn make install
4. Connect the air horn to the solenoid valve Use any method that best suits your specific type of air horn. Because I found me in the garbage dump, I used a combination of polyethylene pipe and push connection fittings to bridge the gap between the solenoid and the horn. Make sure everything you use is of a stress level.
5. Connect the male quick connect fitting to the input of the 12 volt solenoid valve, Make sure to use PTFE tape to prevent any leakage.
6. Connect one end of the solenoid to a 12 volt power supply. This will power the solenoid to turn it on.
7. Connect the other end of the solenoid to the normally open port of the relay module. This ensures that when the power to the relay module is turned off, the solenoid will not turn on and the horn will not sound.
8. Connect the common port of the relay module to the ground terminal of the 12 volt power supply. This completes the circuit, with the solenoid acting as a load and the relay acting as a switch.
9. Connect the VCC and ground pins of the relay board to the Raspberry Pi, Use board pins 4 (VCC) and 6 (ground) respectively.
10. Connect the data pin on the relay from the channel that connects the solenoid to Raspberry Pi BCM pin 22 (board pin 15). This allows our pi to communicate with the relay, closing and opening the circuit.
11. Connect the air compressor to the quick connect input on the solenoid valve. Adjust the compressor regulator pressure as needed-my truck horn is set to about 50 PSI.
12. Set the abbreviation of the team you want in src/app.py, This will ensure that the horn will only be triggered if you change your team’s score.
from score_manager import ScoreManager if __name__ == '__main__': print('Starting system...') sm = ScoreManager('TML') # Change to whatever your team’s abbreviation is (example: MTL) sm.run()
13. Run the application to test the settings. At startup, the system will trigger the solenoid valve to briefly activate the horn before it starts requesting your team’s score. To exit, use Ctrl + C.
14. Run the application during the game.
If your team does not have a live match listed, the system will check every 30 seconds until there is one. During the game, it will check every 30 seconds whether your team scored a goal. If the score has changed since the last time, please cover your ears to celebrate.