An affordable foghorn for a boat

foghorn

A high percentage of this code probably came from someone else. I do not know how to write code, but I can sometimes paste things together that work. Even if the code shown here did not come from one of the sources below, I most likely learned how to make it work with help from them. My apologies to anyone I missed. Please make use of anything you see here, but do not count on good coding practice as I have just done what was needed to make it work. But it does work, unless otherwise noted. Thanks to everyone who has shared their knowledge and good luck to those who are learning. https://www.jarutex.com/index.php/2021/12/19/8868/ https://www.arduino.cc/ https://www.sparkfun.com/ https://randomnerdtutorials.com/ https://youtu.be/3BWSSpcn95A https://stackoverflow.com/ https://youtu.be/684KSAvYbw4 https://exploreembedded.com/ https://www.youtube.com/watch?v=JmvMvIphMnY&t https://prosperityconsulting.com

/*
 Fog horn.   low tone for a few seconds than approximate 2 minute gap between tone.  plays until shut off. 
  
  - 8 ohm speaker on digital pin 8
  - but for production version feed tone into amplifier. 
*/

#include "pitches.h"

void setup() { 
  }


void loop() {
   tone(8, 185, 5000);   // approx 5 seconds 
   delay(55000);
   noTone(8);
  
}

This project has way more to do with hardware than the code, obviously. But when looking for an electronic fog horn they were first hard to find, then ridiculously priced. I will get some pictures in here at some point, but it is essentially built from a megaphone similar to the yellow one below, that I got from AliExpress for pretty cheap. I used a nano board and a buck converter to take the boat’s nominal 12 volts down to whatever the megaphone required. The prototype was 6 volts, but the production model was 12V. I still used the $1.50 buck converter for voltage stabilization as boat voltage can swing way up to almost 15 volts when the batteries are being charged and there can also be spikes. So, for a buck 50 I protect the devices. It is just a matter of snipping one of the microphone wires and putting a resister in series with the output of the board.

Turn it on, and it puts out a low tone for about 3 seconds, then waits for two minutes. This is for the “boat under way” signel. I will probably refine it to do also a “boat not moving” signal also. But that will require another switch. the switch is not expenive, (maybe a penny) but the fabrication time has to be considered.

foghorn

Loading

Please share it. Thanks!