activate relay depending on number of beeps from a buzzer

Thread Starter

MTFT

Joined Mar 6, 2020
11
the end goal is to activate one button or another, either by sending 12 to the buttons switched wire or with a relay between the buttons wires. the activation must be momentary. The source I want to use is the buzzer on a different product. When it beeps twice in quick succession i want to activate button 1, when it only beeps once I want to activate button two. How might I do this without making things too complicated or spending too much money? I could probably just get an Arduino but they are $20 ish and Ide rather not spend that much. This is also in my car and i would rather something that won't drain my car battery if I'm not careful and can run on 12v. Any help is appreciated.
 

dl324

Joined Mar 30, 2015
16,917
When it beeps twice in quick succession i want to activate button 1, when it only beeps once I want to activate button two.
Define what "twice in quick succession" means. What is the time between the two beeps?

Are you able to connect to the signal driving the buzzer? Or do you need the circuit to be able to hear the beeps? If you require audio input, what other noises might interfere with the circuit?

What is your area budget?

It will be easier to read your posts if you used paragraphs to organize your thoughts.
 

Bernard

Joined Aug 7, 2008
5,784
A few thoughts. A microphone- amplifier- detector; leading edge of pulse, P1 triggers a 2 sec. pulse followed by .5 pulse, P2 & P3. A shift register, SR, is used as a counter, outputs Q1,2 & 3, P1 is
clock, input tied hi. Button 2 is output of a 3 input AND, In. 1 = Q1, in. 2 = not Q2 & in. 3 = P3.
Button 2 is output of 2 input AND; in. 1 = Q2, in. 2 = P3. If Q3 is reached then there are more than 2 beeps in 2 sec. & SR is reset , trailing edge of P3 also resets SR. Buttons may need drivers. Out of time for now.
 
Last edited:

Thread Starter

MTFT

Joined Mar 6, 2020
11
Sorry for the late reply but,
Do you have access to buzzer drive signal, or do you have to detect buzzer
as a sound ?

Arduino nano is like $ 3,
Yes, sorry I didn't clarify, I can just solder onto the leads of the buzzer or remove the buzzer entirely, no need for microphone
also where did you see the nano for $3? Also, this will all be 12v since it's in a car and i would need a way to power the Arduino

Define what "twice in quick succession" means. What is the time between the two beeps?
beeps are (approximately, not measured) about a half-second or less each and there is maybe a quarter-second or less between them. pretty short and i might be able to go and get a recording in a bit

It will be easier to read your posts if you used paragraphs to organize your thoughts.
Sorry about that, ill edit the post if that's possible on this forum
 

Thread Starter

MTFT

Joined Mar 6, 2020
11
Arduino Nano - https://usa.banggood.com/search/arduino-nano.html?from=nav

To power it there is a reg onboard that can take 15 V in. But in a car you have to
handle load dump, so some protection on input to reg will be needed. Google
"load dump protection circuits" for some help.

Regards, Dana.
Thanks, so would the 12v go to the VIN pin i presume? Also, I just read ""Modern" vehicles have centralized load dump suppression (so I've read) either integrated within the alternator or installed close to it. This clamps any load dump voltage to 35-40V. ". Do you think that will be enough and would a 2007 car have it?
 

danadak

Joined Mar 10, 2018
4,057
You have to clamp the 12V in to the limit of the onboard reg Vinmax, so a zener would
make sense -

1583543562993.png

Rs limits current when Vz is turned on.

Note you have to calc load power (current) as well as the over voltage current
thru Vz when calculating Rs. As well as make sure you are within design
thermals for onboard Reg.

You can lower Vz voltage to take more power thru Vz than onboard reg.
Or if load is real small in current use a Vz higher than nominal car V so
thats its normally off, only on during load dump.

Regards, Dana.
 

Thread Starter

MTFT

Joined Mar 6, 2020
11
You have to clamp the 12V in to the limit of the onboard reg Vinmax, so a zener would
make sense -

1583543562993.png
I'm gonna slow ya down right there.
So I need to clamp the 12v from the car to 15v max so it doesn't fry the Arduino when I start the car, got it. Now, I have no clue how to use a zener(I'm new to DIY electronics). Could you walk me through how this circuit works and how to choose values? Also, where do you get your components? (again, new to the DIY electronics)
BTW, thanks for the help so far, I really appreciate it.
 

Attachments

Thread Starter

MTFT

Joined Mar 6, 2020
11
Most newer cars have a USB port available that would eliminate the need for load dump protection.
unfortunately, my 2007 grand Cherokee does not (I wish it did). I do have an aftermarket USB charger that goes in the cig lighter slot but I won't be able to use that with this project since I plan to place this either under the dash or inside the door panel
 

danadak

Joined Mar 10, 2018
4,057
The Zener looks like a diode in one direction, and clamps voltage to its rated value, via a breakdown
mechanism, in the other direction.So in the above circuit you will be using it in the breakdown mode.

As you can see in the breakdown direction, for varing current, or load, it stays at a relatively constant
V.

1583579893581.png

https://www.electronics-tutorials.ws/diode/diode_7.html Design method....

https://www.engineersedge.com/instrumentation/zener-diode-calculator-regulator.htm



https://www.onsemi.com/pub/Collateral/HBD854-D.PDF

http://bitsavers.trailing-edge.com/...Books/1991_Motorola_TVS_Zener_Device_Data.pdf Ap note here on designing basic V regulators page 6-6-1


To order a zener you need to know desired V to clamp at, max current thru it, and power
dissipation in it. ebay, Newark, Mouser, Futurelec.......



Regards, Dana.
 
Last edited:

Thread Starter

MTFT

Joined Mar 6, 2020
11
The Zener looks like a diode in one direction, and clamps voltage to its rated value, via a breakdown
mechanism, in the other direction.So in the above circuit you will be using it in the breakdown mode.

As you can see in the breakdown direction, for varing current, or load, it stays at a relatively constant
V.

View attachment 200887

https://www.electronics-tutorials.ws/diode/diode_7.html Design method....

https://www.engineersedge.com/instrumentation/zener-diode-calculator-regulator.htm



https://www.onsemi.com/pub/Collateral/HBD854-D.PDF

http://bitsavers.trailing-edge.com/...Books/1991_Motorola_TVS_Zener_Device_Data.pdf Ap note here on designing basic V regulators page 6-6-1


To order a zener you need to know desired V to clamp at, max current thru it, and power
dissipation in it. ebay, Newark, Mouser, Futurelec.......



Regards, Dana.
So do I have this correct:
I need to order the Arduino nano from banggood and a Zener diode,
the Zener needs to be 15v for the Arduino input, and I'm assuming current would be whatever the Arduino takes , and power is voltage times current so 15 times the Arduino's current?
also, how do I determine the resistor shown?
Finally, i am concerned that the Arduino won't be able to switch the 200mA required for the 12v relay. This may be completely wrong but ive heard somewhere that most ICs cant switch that much. Ive also heard that you cant draw ANY current from the arduino if using the regulator

Sorry for my ignorance here and, again, thanks for helping out
 

danadak

Joined Mar 10, 2018
4,057
Nano from ebay, alliexpress, or banggood.

Finally, i am concerned that the Arduino won't be able to switch the 200mA required for the 12v relay. This may be completely wrong but ive heard somewhere that most ICs cant switch that much. Ive also heard that you cant draw ANY current from the arduino if using the regulator
Yes, you probably cannot be able to draw the 200 ma from the Nano board. Some current can be drawn
from Nano, but you have to calc the thermals, for a given load, for the onboard regulator. ncp1117st25tg
says its good for 1A, but it has no heatsink so you have to calc the thermal limitation for the
part and desired load. The micro draws ~ 20 mA with no GPIO loads, 8 Mhz clk. Use 1 mA for
Izmin.


I would use a 10V zener. The calculations from 6-6-1 I referred to earlier are -

1583675692687.png


Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Relay drive circuit something like this -

1583675828531.png

Vdd is your vehicle 12 V supply. Vin from Nano output pin.

Note use a logic level MOSFET, not IRF610 shown, one that shows low Rdson at
Vgs < 5V. An IRL540 would be a good choice.


Or you could use -

https://www.banggood.com/search/relay-module.html?from=nav

These have driver and relay on a board. Make sure they have the flyback diode
and rest of circuit config as shown above.


Regards, Dana.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,163
You’re right about switching the relay. You’ll need some sort of driver. The easiest approach is to switch the relay coil’s ground connection with a logic level MOSFET. Switching the12V connection is more difficult.

I’d use a 2N7000. Look up sample switching circuits with a 2N7000. You’ll need at least one resistor from the junction of the Arduino pin and the relay, and connect a 10K resistor to ground (in parallel with the two coil pins of the relay)

NOTE: Danadak types faster than me ;)
 

djsfantasi

Joined Apr 11, 2010
9,163
Arduino Nano - https://usa.banggood.com/search/arduino-nano.html?from=nav

To power it there is a reg onboard that can take 15 V in. But in a car you have to
handle load dump, so some protection on input to reg will be needed. Google
"load dump protection circuits" for some help.

Regards, Dana.
The Nano is available for as low as $0.89... Since banggood is in China (i.e., you’re already dealing with shipping from China), you can get this one from Shenzhen in China, too.

Arduino Nano with Headers

But this item doesn’t have a programming cable. I use many Arduinos and ATTinys in various projects, but only have two cables. I share the cable between the μCs.

I only have two cables because I’ve developed a system whereby two Arduinos talk to each other and I needed two cables for testing. Otherwise, I only needed one cable.
 

Thread Starter

MTFT

Joined Mar 6, 2020
11
The Nano is available for as low as $0.89
I took a look at that and turns out the 0.89 is for cable only...

But this item doesn’t have a programming cable
What type of cable does it use, i probably have a few lying around

So, 10v zener with 1mA min,
the resistor calculation would be R= (12v-10v)/(1mA+20mA)=0.000021? does that sound right?
and the zener power would then be... wait Is 10v the Vz(max) or the Vz(min)?
These have driver and relay on a board. Make sure they have the flyback diode
and rest of circuit config as shown above.
https://www.banggood.com/5V-Relay-1...rd-p-91800.html?rmmds=search&cur_warehouse=CN
I dont think this has a flyback diode, but what would i look for if i were to get a seperate one?
 

djsfantasi

Joined Apr 11, 2010
9,163
I took a look at that and turns out the 0.89 is for cable only...


What type of cable does it use, i probably have a few lying around

So, 10v zener with 1mA min,
the resistor calculation would be R= (12v-10v)/(1mA+20mA)=0.000021? does that sound right?
and the zener power would then be... wait Is 10v the Vz(max) or the Vz(min)?

https://www.banggood.com/5V-Relay-1...rd-p-91800.html?rmmds=search&cur_warehouse=CN
I dont think this has a flyback diode, but what would i look for if i were to get a seperate one?
I don’t know where you got that idea. The link I provided definitely states it is for a Nano without programming cable. This link is to the detailed product description. It definitely states that it is for a Nano and no programming cable.

The programming cable is a simple USB to mini-USB cable.
 
Top