Doorbell pulse counter with Arduino nano to direct the ringtone to an intercom handset

Hi,
For my first project on Arduino Nano, I would like to make an automatic counter of the number of ring presses on a wired intercom.

I want to be able to ring the bell on one of the three handsets depending on whether the bell button is pressed once, twice or three times at the entrance to the building: 1 press -> handset 1, 2 presses -> combined 2....

Does anyone know if this is doable with limited knowledge or have any advice to give?

Thanks !

Sure, first you'll have to provide a list of parts you have (or are considering), the circuit as you (at minimum) envision it, either schematic, hand drawing or very detailed description.
Post your code here. Don't forget code tags to make it easier to read. CTRL+T in the Arduino IDE will auto format your code.
Also, what you've tried, what worked and what didn't work.
Don't forget to use code tags.

Hello igeantvert

Welcome to the world's best Arduino forum ever.

This is a very nice project.

To decouple the intercom from the Arduino, the use of an optocoupler is recommended.

The programme requires a timer module for debouncing of the input signal if needed and for monitoring the number of input pulses.

Here is a software design based on the IPO model:

INPUT: Debounce input
if (input goes high) counter++ and start timer
PROCESSING: When the timer has expired, signal a new doorBellEvent
OUTPUT: Execute doorBellEvent

Which interface is used for the handsets?

Have a nice day and enjoy coding in C++.

Would you draw a chart? "One press handset one two presses combined 2 ellipsis" confuses me.

Hi xfd, thanks for the answer.
It's a translation mistake :

  • 1 press -> handset 1 rings (handset 2 & 3 stay silent)
  • 2 presses -> handset 2 rings while handset 1 and 3 stay silent)
  • 3 presses --> handset 3 rings .

This can be written many ways. Here is one to consider...

  1. Was the button pressed?
  2. What state is it in? (0, 1, 2 ,3)
  3. Set a new state?
  4. Do things in this state.
  5. Clear state?

Nice idea.

You'll have to wait a bit after the first press to see if a second (or third) is on its way soon enough that you should ring two2 (or three3) instead of one1.

Can you now write a sketch that simply counts the number of times you have pressed a button, and prints the number each time it goes up?

Until you can do, you should work on that. It will necessarily drag you over some very basic issues, and coding techniques, involved with listening to buttons and reacting as you wish.

At least

  • button debouncing
  • state change (or "edge") detection

Both are covered all over the place, google and read a few articles on those sunjects, look also at the IDE examples code.

And trust me when I say nothing you learn on that side trip will be a waste of your time. In fact, just the opposite. You will have bnaked a key skill, which skill will be handy when you turn your attention back to the real goal.

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.