Counter Relay Help

My head hurts, and I need help with a project (noobie alert)...

I have 4 buttons, each button sets a different counter interval...

I press a button it turns on a lamp (110Vac), and depending on which counter it represents, the lamp stays on until a 5th button is pressed as many times is needed to turn off the lamp again.

When one of the 4 buttons is pressed, the other buttons are disabled until the count down is reached, turning off the lamp and reseting itself.

Does that make sense? Can someone help me with this (I am to the point of paying someone to sketch and build it for me... lol)

The fifth button intrigues me.
The rest is easy with millis timing.

Welcome!
Five buttons, one lamp. I could sketch it, but.

  1. wire your buttons from input pin to ground, and enable INPUT_PULLUP.
  2. I hope your lamp is an LED. Presuming that, wire the LED ouputpin to LED+ , resistor LED- to GND.

With the above in mind, your five button pins will be LOW when read using digitalRead(pin).
Your LED will be ON when a HIGH is written to the digital output, using digitalWrite(pin,value).
That should be a good start, let us know what doesn't make sense, or better, post your first code attempt using that info.

Why are you making this project ?


FYI



Show us the sketch you are working on.

Draw a circuit schematic of your proposed project.

Have you tried with just one button setting a counter?

Think of it like a game, and this is a first part.

Let's say I press Button 1 and it sets a counter to 100. I put someone on Button 5 and tell them to slap it as fast as they can until the light turns off.

I realize that I will need a 5V relay to switch the 110Vac Marquee on and off, instead of an LED and Resister.

Ultimately I would like to add more Slapping Buttons and Marquees for players to race each other. Picture me setting a Counter to 300, and 4 Drumpads where Drummers race to see who can turn their Lights off (or on saying Winner!) first.

I want to keep it simple until I understand the initial concepts.

I am using a CT 1.1 Counter Controller Module right now, but it offers no real expandability. I will upload a pic of the module that I am going by.


Yes, but I think I am getting confused by the difference between Counter and Timer. It seems that they are used as the same thing in some of the sketches I am seeing.

Let's keep it simple:

You have 4 push button switches.

  • At some point, the 4 switches are to be pushed.

  • What is the trigger condition that says to the users to push a switch ?

  • When the first switch press is detected, what is to happen ?

Why are you making this project ?

Here are the steps I am wanting...

I will push one of the 4 buttons, and say, "you have 300 slaps to turn on/off your light"

The player will slap at the button 300 times until the light turns on/off.

I don't need a display or audible sound. I just want to have 4 preset counters to make it easy to change the counts.
Button 1 = 50 slaps
Button 2 = 100 slaps
Button 3 = 300 slaps
Button 4 = 500 slaps

Button 5 is the slap button
When first slap is detected on Button 5, Buttons 1-4 are disabled

There is a relay to turn on/off an external 110Vac Marquee flashing "Winner!" when the player reaches 300 slaps.

When I push a Button, the Relay for the Marquee switches on/off
(the Relay will need to be NO/NC SPDT where the coil is NC when energized)

When Button 5 is done, the game resets itself, turning on/off the Marquee Relay and re-enabling Buttons 1-4

Future Desires:
Button 6-8 added for more players to race
Those Buttons have their own Marquee Relays

I hope that I am making sense

Sorry, I am making this for my grand kids to play, to burn energy... lol

  • What hardware and software experience do you have ?

  • What kind of Arduino do you have ?

  • What kind of switches do you have ?

Please confirm all the steps below and change as necessary

  • There a 4 switches that can change a slap counter.

  • Switch 1 sets this counter to 50

  • Switch 2 sets this counter to 100

  • Switch 3 sets this counter to 300

  • Switch 4 sets this counter to 500

  • A push on one of the first 4 switches turns ON the light and sets the counter

  • A 5th switch has to be pressed (slapped) the number times that you set on one of first 4 switches.

  • The first slap on the 5th button will disable the first 4 switches until the light turns ON

  • When the user slaps the 5th switch equal to the set number of slaps, the light turns OFF

Suggest you have a LCD display that shows how many slaps are needed to end the process

OK, well I am an old guy who's knowledge is stuck back in 386 DOS days... NT4 MCSE Certified and A+ Certified... Used to train and teach...

Got out the business in 2000 after Y2K brought down the entire planet... lol

I then moved to Mac and worked as a Web Developer, Photographer, Graphic designer and Video Editor for about 10 years....

When my health started to limit me, I started to be a tinkerer to keep my brain working.

I play with Raspberry PIs, Arcade Machines (I am currently working on a scratch built Jukebox, Jamma 60in1 Arcade, Slot machine, coin pushers, and carnival type games for children's church outreaches)... Oh and I am working on plans to build a HotDog Cart and Kettle Corn Popper...

I have a basic Arduino UNO R3 kit but this has been my biggest challenge and the weakest link in my tinkering experience... I understand the basics, but this is new to me and frankly my brain has me scratching my head... lol

I use arcade switches...

I have my hands in a lot of things, but I am starting to fee like a mumbling old man... lol

Oh and I cannot solder and like the breadboard building the Arduino offers... It reminds me of the old Radio Shack Electronic toy I had as a kid...

YES! lol I guess a LCD would be an option that would benefit me... and maybe a countdown display to see how many slaps are left...

Old man here too.

Gee there are a lot of us here :wink: :man_white_haired:

1 Like

I bet, but I learn a lot from teenagers on YouTube... I wish Arduino was available back in the day... I would have gotten into it..

Does this make sense to you ?

If you use an LCD display, you only need one switch to set the counter.
Each time this switch is pressed, it could cycle thru a list of values 50-500 which then sets the counter if the switch is held for longer than say 2 seconds.
The display would show the value that is currently in the counter.

  • What is supposed to trigger the user to start slapping switch #5 ?

With a SPDT Relay, I figure that one side would light the arcade button when ready to start, and light the marquee when count is reached (turning off the button).

I got about 75% of that diagram, but it looks like I could figure it out. Not sure what the Heartbeat LED is for...

It seems that if I went with the 1 Button/Display option, I would free up the 3 Buttons for 3 additional players..? Just copy/paste the commands for Button 1 changing the pins for the 3 new buttons?

The heartbeat LED is there to show us if the Arduino code is executing, it is optional.

This LED also is a good indication that the code is not being blocked as it should toggle every 1/2 second.