Last Updated: 2 Oct. 2017
History (newest on top):
2 Oct. 2017 - link to source code added
16 Jan 2016 - first written
A Few Other Articles:
- The Power of Arduino
- 100+V Arduino/AVR Microcontroller Input/Output (I/O) Pin Over-Voltage Protection Using a *Single* Resistor!
- Restoring/Recharging Over-discharged LiPo (Lithium Polymer) Batteries!
- Parallel Charging Your LiPo Batteries
- Beginner RC Airplane Setup
- Thunder AC680/AC6 Charger & Computer Data-Logging Software
In these two videos, I do a quick desktop demo of playing a siren sound through first a "fixed frequency" car horn, and then through a standard car audio speaker, rated at 120W peak, 60W RMS, and 4 Ohms. Using an Arduino, a relatively simple, custom transistor-based amplifier circuit, and the Arduino core tone() function in my code, I drive the horn and speaker to play a siren sound by sinusoidally varying the driving frequency. I also show the signal to the devices on an oscilloscope, and briefly discuss and hook up a Schottky diode in a "snubber diode" configuration to knock down the inductance-induced voltage spikes created each time the square wave has a falling edge.
First, watch the "fixed frequency" type car horn play a varying-frequency siren sound:
SOURCE CODE: http://www.electricrcaircraftguy.com/2017/10/arduino-sine-wave-siren-code.html
END
This comment has been removed by the author.
ReplyDeleteI watched your video very successful, I want to do the melody work in the car horn (I tried to run the horn on different frequencies but the volume is low) How can I increase the horn decibel? I am very pleased if you can help me very importantly.
ReplyDeleteTry driving the speaker through a high-power H-bridge designed for driving DC motors. To power it, use a LiPo battery of the correct voltage for the speaker. Also consider placing a high-capacitance (ex: 4700uF or larger) AC-coupling capacitor in series between the speaker and the H-bridge to help remove any DC bias.
DeleteAlso use the Arduino ToneAC library to drive the H-bridge/speaker so that you can dual-drive the speaker, thereby getting less DC bias and double the volume that you'd normally get from the basic "tone" library.
DeleteWARNING: for the AC-coupling capacitor, it *must* be bipolar, meaning it is electrolytic but NOT polarized. If you use a polarized capacitor and then dual-drive it, you'll blow the capacitor. It is possible to make an electrolytic bipolar capacitor from two electrolytic polarized capacitors back-to-back, with a couple of high-speed diodes too, but I'll have to explain that one more later. Try googling it or just buy a bipolar (non-polarized) electrolytic capacitor to start.
DeleteThis comment has been removed by the author.
ReplyDeleteCould add from my facebook address.https: //m.facebook.com/devotedster? Ref = bookmarks
ReplyDelete(To spammer John Snow): Send me one for free and I'd be glad to review it. But since this sounds like spam, you have 24 hrs to either send me one for free or explain how this isn't spam, or else I delete your comment.
ReplyDeleteUPDATE: I changed my mind, spammer. I've deleted your comment. If you send me a free one you can put your comment back up.
Hi Gabriel, really interesting article. I'm new to the world of arduino so some of this stuff is kinda hard to grasp sometimes. Could you upload your connections diagram to this? Also, would it be possible, if I just wanted to use the car horn, to replicate the behavior with just a pwm pin, a mosfet and a diode? If not, why not? Thank you very much for your time.
ReplyDeleteJuan
can you post a wiring diagram by any chance?
ReplyDeletehola, tendrias ademas del codigo en arduino los planos de las conexiones y una lista de materiales necesarios?
ReplyDelete