Team-BHP > Technical Stuff > DIY - Do it yourself
Register New Topics New Posts Top Thanked Team-BHP FAQ


Reply
  Search this Thread
24,815 views
Old 24th May 2022, 20:50   #1
Senior - BHPian
 
clevermax's Avatar
 
Join Date: Jun 2006
Location: Tvm/Amsterdam
Posts: 2,086
Thanked: 2,640 Times
How I automated the 'Courtesy Honk' in my car

This thread will detail how I automated the "Courtesy Honk" or the 'Friendly Honk' in my car. I got the idea from my daughter - she watched a YouTube video demonstrating the courtesy honk, and she asked me if I can implement it.

So this is my own implementation of the courtesy honk. Wrote my own microcontroller code and did my own electronic circuit design.

First of all, what is a 'Courtesy Honk'?

Going by the western definition of it, a courtesy honk is used to get the attention of other drivers in a non-emergency scenario. It's two quick chirps of the horn that is friendly sounding, and not very irritating as a longer or continuous honk.

In the Indian context, this has more use cases for sure. For example, you're cruising on a highway and you sense that the two-wheeler guy in the front is showing symptoms of an unannounced right turn or a lane change. You can then trigger this in order to grab the attention of the rider with two quick chirps instead of a longer honk.

Why Automate it?

Two reasons.

First reason - One can always press the horn pad two times in succession with a very short interval in between. However, you won't be able to consistently reproduce the pattern all the time. Sometimes, you will end up honking a little longer and that will sound irritating to other road users. The horn pad is a bit 'hard-to-press' in many cars and this makes it nearly impossible to do a very consistent courtesy honk all the time.

The second reason - If I can automate it, then why not?

I do understand that good driving manners include extremely minimal usage of the horn. But on our roads, sometimes a honk can save a life - this can be an absent-minded rider in front of you taking a right turn without indicators, or someone who is crossing the road without checking if there are oncoming vehicles. The courtesy honk will grab their attention but at the same time, it won't be very irritating. I have noticed that almost 98% of my horn usage is actually to make very quick and short chirps.

There may be commercially off-the-shelf horn solutions out there with different types of horn patterns and sounds, but I did this for the fun and satisfaction that a DIY project can give. I hope the DIY'ers on the forum will find it interesting and useful. Disclaimer: It is over-engineered for the need! The upside is that there is a microcontroller inside the car now, which can be used for a few other purposes as well, in the future.

Last edited by clevermax : 25th May 2022 at 13:46.
clevermax is offline   (61) Thanks
Old 24th May 2022, 21:17   #2
Senior - BHPian
 
clevermax's Avatar
 
Join Date: Jun 2006
Location: Tvm/Amsterdam
Posts: 2,086
Thanked: 2,640 Times
Solution Approach & High Level Design

When I started thinking about a solution, the first thing that struck my mind was the Arduino which was lying around, unused. So I decided to use it as the controller. As I mentioned in the first post, will this be an over-engineered solution for the need? Of course yes. Will it be fun? Yes!

The design considerations were:
  • The design should not have any impact on the existing horn functionality. When the steering horn pad is pressed, the horn should sound just like before.
  • The design should not introduce any new points of failure for the existing horn circuitry.
  • It should not drain the car's battery when the car is parked.

This shows a typical horn circuit.
Name:  Horn_circuit.jpg
Views: 1012
Size:  18.6 KB

If you had to have a second horn switch for the same horn, without impacting the existing system, this is how you could achieve it.
Name:  Horn_circuit_two_switches.jpg
Views: 1095
Size:  28.9 KB

From this, it is very easy to visualize the high-level design of the required system. We just need to visualize a controller controlling the secondary switch, that can produce any pattern of honking as programmed. In this particular case, the pattern will be the courtesy honk pattern - two quick chirps.
How I automated the 'Courtesy Honk' in my car-design_of_courtesy_honk_2.jpg

Last edited by clevermax : 25th May 2022 at 13:40.
clevermax is offline   (32) Thanks
Old 24th May 2022, 23:42   #3
Senior - BHPian
 
clevermax's Avatar
 
Join Date: Jun 2006
Location: Tvm/Amsterdam
Posts: 2,086
Thanked: 2,640 Times
Low Level Design & Breadboarding

This stage has two parts.
  1. Microcontroller programming
  2. Driver circuit design for driving the horn's relay

Microcontroller programming

The microcontroller board that I had (Arduino UNO) has several GPIO pins, but for this project, we only need to use two pins. One of the pins is to be set as an input pin, where the command from the driver's command button (a tactile switch) is to be sensed. The other pin will be a digital out pin, which should be used to drive the horn's relay.

Since the button press has to be sensed almost instantaneously, I decided to make use of the ISR (Interrupt Service Routine) capability of the Arduino. ISR will trigger a hardware interrupt to stop whatever the microcontroller is doing, to process the command button press instantly. This is essential since the horn should instantly when you press it.

In order to develop the code, I made a PoC circuitry using a breadboard, where the digital output pin will directly operate an active buzzer. This gave me the platform to play around with while coding the microcontroller.

How I automated the 'Courtesy Honk' in my car-poc_circuit.jpg

Here's the final source code, which underwent a few iterations to perfect the delays and the beep timings.
Quote:
int hornPin = 3;
int buttonPin = 2;
long unsigned int lastPress;
volatile int buttonFlag;
int debounceTime = 250;
bool startFlag;

void setup() {
pinMode(hornPin, OUTPUT); // Input pin for the command button
pinMode(buttonPin, INPUT_PULLUP); // Drives the optocoupler
lastPress = millis();
buttonFlag = 0;
attachInterrupt(digitalPinToInterrupt(buttonPin), InterruptRoutine, FALLING);
}

void loop() {

// Perform a courtesy honk if the driver has pressed the command button
// after the button debounce time has elapsed, after the previous press
if (((millis() - lastPress) > debounceTime) && buttonFlag)
{
lastPress = millis();
CourtesyHonk();
buttonFlag = 0;
}
}

// Produces the courtesy honk pattern
void CourtesyHonk() {
digitalWrite(hornPin, 1);
delay(60); // Timings are tuned over a few iterations to make it sound cool
digitalWrite(hornPin, 0);
delay(45);
digitalWrite(hornPin, 1);
delay(50);
digitalWrite(hornPin, 0);
}

// Interrup service routine - this will be called instantly
// when the driver presses the command button.
void InterruptRoutine() {
buttonFlag = 1;
}
Here is a video of how the buzzer circuit worked after this stage.



The Horn Relay Driver Circuit

Now, it was time to look at how I will hook up the microcontroller with the car's horn relay system. The car's electricals work with a 12 volts system and that includes the horn's relay as well. The Arduino GPIO has a max output voltage of 5 volts. Moreover, the horn's relay is ground-based, and it is not expecting a voltage to drive it. Instead, it needs to be grounded to trigger the horn. The relay consumed about 300-350 mA of current when the horn is triggered, so the project needed a grounding mechanism that could handle at least 500mA of current.

This called for designing a driver circuit, which will ground the horns relay with the input from the microcontroller. Using another relay to drive the horn's relay was out of the question since I didn't want to use a relay to drive another relay. The simplest circuit I could think of was to use a capable PNP transistor that could effectively ground the line when its base is grounded. I also wanted to electrically isolate the microcontroller's GPIO from the driver circuitry, so I decided to use a combination of an optocoupler and a transistor.

The idea was to drive the optocoupler from the output line of the Arduino, which in turn will trigger the transistor which will 'ground' the horn's relay line.

The other question was on powering the Arduino. The documentation says that it can work with a 12v input on its Vin pin, however, the car's battery voltage will go up to more than 14 volts while the engine is running. So I decided to use a voltage regulator to limit the maximum input voltage to the Arduino to 12 volts.

After considering all these factors, here is the schematic of the final circuit that I came up with. Of course, this required a few iterations on the breadboard to iron out a couple of bugs, including the unpredictable behavior from the tactile switch which resulted in an unwanted double triggering. The capacitor placed in parallel with the tactile switch solved this issue perfectly.

How I automated the 'Courtesy Honk' in my car-schematic.jpg

A video of the breadboard test.

Last edited by clevermax : 25th May 2022 at 16:35.
clevermax is offline   (44) Thanks
Old 24th May 2022, 23:43   #4
Senior - BHPian
 
clevermax's Avatar
 
Join Date: Jun 2006
Location: Tvm/Amsterdam
Posts: 2,086
Thanked: 2,640 Times
Final Implementation & Integration

The very first point I started looking at was the type of command button I will use; and how I will fix it on the dashboard. Amazon offers a variety of buttons for bikes and cars but none of them appealed to me. Some may even require drilling holes on the dash. While searching for a button within my own inventory, I stumbled across the 'save video' button from my previous DDPai dashcam lying around, and that looked perfect for the need. This button can be fixed onto the dashboard using double-sided tape and it looked quite premium.

This is the button I am talking about.
How I automated the 'Courtesy Honk' in my car-ddpai_button.jpg

Opened up the switch and removed the existing circuitry to place a new tactile switch.
How I automated the 'Courtesy Honk' in my car-img20220522111359.jpg

Soldering stage - the relay driver circuit.
How I automated the 'Courtesy Honk' in my car-img20220521095414.jpg

The driver circuit at its finishing stages, with the interfacing ribbon cable to the microcontroller.
How I automated the 'Courtesy Honk' in my car-img20220521141253.jpg

Here's the video of the final circuit getting tested for the first time.


It was time to package the Arduino and the driver circuit and install it within the fusebox, under the dashboard. The PCB was Tape69'ed to Arduino's case. This went inside the fusebox. It was securely cable-tied to one of the sides. This was powered via the OBD port.
How I automated the 'Courtesy Honk' in my car-img202205221219092.jpg

And here is the command button placed on the dash, adjacent to the steering column. I was thinking of using it like this for a few days to see if I need to optimize the button placement later.
How I automated the 'Courtesy Honk' in my car-img20220522125554.jpg

The line from the horn's really going into the steering column was tapped to provide the connection to the controller.

Finally, I could test the courtesy honk while driving the car


And this is how it sounds from the outside.

Last edited by clevermax : 25th May 2022 at 16:45.
clevermax is offline   (116) Thanks
Old 25th May 2022, 17:51   #5
GTO
Team-BHP Support
 
GTO's Avatar
 
Join Date: Feb 2004
Location: Bombay
Posts: 70,512
Thanked: 300,692 Times
Re: How I automated the 'Courtesy Honk' in my car

Thread moved from the Assembly Line to the DIY section. Thanks for sharing!

Going to our homepage tomorrow
GTO is offline   (11) Thanks
Old 26th May 2022, 09:04   #6
BHPian
 
Join Date: Mar 2021
Location: Kanyakumari
Posts: 45
Thanked: 86 Times
Re: How I automated the 'Courtesy Honk' in my car

Wow. A honest question: Is there any other way to do this? Or only geniuses who are into coding can do it?
Joelinf is offline  
Old 26th May 2022, 09:42   #7
RYP
BHPian
 
RYP's Avatar
 
Join Date: Nov 2013
Location: Bangalore
Posts: 108
Thanked: 490 Times
Re: How I automated the 'Courtesy Honk' in my car

OMG. I never knew there's a term for this - Courtesy Honk. I instinctively do it whenever I feel a nearby vehicle may come too close or sway lanes exactly as described - two short honks! Been doing this for years since the time I started with a humble gearless two wheeler decades ago. I think this is the equivalent of honest to a fault in movie lingo. I believe you have achieved two honk nirvana with this mod. Kudos
RYP is offline   (12) Thanks
Old 26th May 2022, 09:46   #8
BHPian
 
Naveen_0181's Avatar
 
Join Date: Jan 2018
Location: St.Louis, USA
Posts: 53
Thanked: 61 Times
Re: How I automated the 'Courtesy Honk' in my car

Good one, I like it! any specific reason for powering it from OBD port? is it beacuse of the readly available 5V supply?
I beleive the OBD port is constantly powered on even when the ignition is off (atleast thats what my i10 did), wouldn't that cause a battery drain?

I would prefer to tap the power from the fuse box with a in-line buck converter to stepdown to 5V or add the buck convertor to the board which you already did!

Also can you show how exactly you tapped into the horn relay on the car?

Last edited by Naveen_0181 : 26th May 2022 at 09:53.
Naveen_0181 is offline   (3) Thanks
Old 26th May 2022, 09:47   #9
BHPian
 
Join Date: Dec 2005
Location: bang
Posts: 878
Thanked: 3,117 Times
Re: How I automated the 'Courtesy Honk' in my car

Well thought of and done.

On reading the thread subject line i was under the impression that the whole system was fully automated i.e the horn went off all by itself without any manual intervention. Even now its not that difficult to incorporate a proximity sensor to just trigger the horn by itself. Of course, it wont be easy to get the intended effect.

Arduino has certainly lowered the effort it takes to make a circuitry now a days. In our times, it would have taken a 555 based astable multi vibrator and a counter to do what you have done.

Only one suggestion. The car horn relay is a mechanical contact. Its not designed for fast switching. If you could fit an auxiliary horn triggered by a transistor with the arduino circuit it would be more long lasting.

But hey you did good.
srini1785 is offline   (10) Thanks
Old 26th May 2022, 09:51   #10
BHPian
 
Naveen_0181's Avatar
 
Join Date: Jan 2018
Location: St.Louis, USA
Posts: 53
Thanked: 61 Times
Re: How I automated the 'Courtesy Honk' in my car

Quote:
Originally Posted by Joelinf View Post
Wow. A honest question: Is there any other way to do this? Or only geniuses who are into coding can do it?
There are other ways to acheive this but that involves some electronics knowledge, as the original poster already mentioned this a bit over enginnered, however using the micro controller will give a lot of flexibility to customize.
Naveen_0181 is offline   (3) Thanks
Old 26th May 2022, 09:53   #11
Senior - BHPian
 
clevermax's Avatar
 
Join Date: Jun 2006
Location: Tvm/Amsterdam
Posts: 2,086
Thanked: 2,640 Times
Re: How I automated the 'Courtesy Honk' in my car

Quote:
Originally Posted by Joelinf View Post
Wow. A honest question: Is there any other way to do this? Or only geniuses who are into coding can do it?
Not all geniuses are into coding and not all who code are geniuses! I am sure I am in neither of these categories

Coming to your question - as I mentioned in the first post, this is an over-engineered but extendible solution and there are definitely other ways to achieve this.

1) You can omit the microcontroller part of it (no coding) and design an electronic timing circuit to trigger the transistor. I think this could be achievable using a couple of 555 ICs and other essential components that are required in timing circuits.

2) You can follow this Mark Rober video, which is a completely different implementation of this, he uses a custom board that stored custom audio files and plays them out via a loudspeaker. In fact, this is what my daughter watched, and that resulted in me doing this DIY project. My solution just uses the existing car horn, which is quite simple.

3) There may be commercially off-the-shelf horns with this kind of horn pattern.

Quote:
Originally Posted by srini1785 View Post
Well thought of and done.
On reading the thread subject line i was under the impression that the whole system was fully automated i.e the horn went off all by itself without any manual intervention.
Thank you! When I say 'automated', think about automatic weapons - they still require the human command, but they fire continuously when pressed

Quote:
Originally Posted by Naveen_0181 View Post
There are other ways to acheive this but that involves some electronics knowledge, as the original poster already mentioned this a bit over enginnered, however using the micro controller will give a lot of flexibility to customize.
Exactly.

Last edited by clevermax : 26th May 2022 at 10:04.
clevermax is offline   (8) Thanks
Old 26th May 2022, 10:38   #12
BHPian
 
lordtottuu's Avatar
 
Join Date: Oct 2019
Location: BER, MEL, & MAA
Posts: 64
Thanked: 312 Times
Re: How I automated the 'Courtesy Honk' in my car

This is really incredible work. Well done, sir!

As someone who exclusively works with software, most of these hardware DIY projects seem like arcane magic! Any books you recommend for a beginner in this area? I have a few RPis and maybe an Arduino that I bought to learn but never got started.
lordtottuu is offline   (4) Thanks
Old 26th May 2022, 11:24   #13
BHPian
 
Ranger747's Avatar
 
Join Date: Jan 2014
Location: Bangalore
Posts: 52
Thanked: 89 Times
Re: How I automated the 'Courtesy Honk' in my car

Wow! nice! I want to make one of these now

I have spent a few years outside india and I would have probably honked a couple of times in that whole time while driving ( something like 80K km of driving over this time ). I am not a fan of in-your-face honking that we encounter daily on our roads. But in India, you can't live without honking often. It can become plain dangerous. Other on road expect it. And the problem is just like what he says in video. Horn is so one dimensional, most of the time what you convey with it ( like, thank you for stopping for me or , hey dude I am on your left lane... etc ) could be understood as aggression by the other party. First time hearing the term courtesy honk! This thing should be standard offering on cars!!
Ranger747 is offline   (3) Thanks
Old 26th May 2022, 12:07   #14
Senior - BHPian
 
ghodlur's Avatar
 
Join Date: Sep 2009
Location: Thane
Posts: 6,010
Thanked: 4,199 Times
Re: How I automated the 'Courtesy Honk' in my car

Although an appreciable effort from the OP, how effective can this courtsey horn be on the India roads is what needs to be checked. Not to sound negative here, but the example which the OP mentioned about the 2 wheeler guy, it is seen that inspite of using the normal horn, they tend to ignore and take the intended/unintended turn at their will.

If I ever wanted to implement this, I will program some words like "hello" "Oh Bhaisaahab" etc instead of the normal honk.

These changes will void any warranty?
ghodlur is offline   (4) Thanks
Old 26th May 2022, 13:13   #15
BHPian
 
Join Date: Sep 2021
Location: Bangalore
Posts: 60
Thanked: 64 Times
Re: How I automated the 'Courtesy Honk' in my car

Quote:
Originally Posted by clevermax View Post
2) You can follow this Mark Rober
You got me at this,

Just a small point from my end, can't we use the already provided barrel jack to power the system? This may shed some of the bits from the circuit.

PS: thanks for the inspiration.
banana is offline   (1) Thanks
Reply

Most Viewed


Copyright ©2000 - 2024, Team-BHP.com
Proudly powered by E2E Networks