loading

Looking for help with a simple enough idea?

I say simple enough, but obviously not simple enough for me.  But for someone out there this is probably something you could do in your sleep....

Looking for a setup that has two buttons. When button 1 is pushed, button 2 must then be pushed to register a count of "1" on a display. 
And then button 1 and 2 must be pushed again (in that order) to register a count of "2" - and so on....

It would be nice then if a target figure could be set to trigger an action when the target number is reached.

The application is for exercise - for example burpees. Button 1 is on the ground and button 2 is above the head. Triggering both buttons gives a count of 1. And when a target such as 30 is reached an alarm or light can be activated to show completion of exercise.

It is important that two pushes of either button in a row doesn't give a count of "1" - a count is only valid if the buttons are pushed in sequence.

I'm guessing an Arduino board of some sort would be required, but its all new to me and I'm guessing its a simple enough programme if you have the know how. But I don't even know what board to purchase to get started. And while I'm purchasing the board I may as well know what else I'll need for the entire project and order all that at the  same time.


So can anyone help?



sort by: active | newest | oldest
Question: What do you want to display the count on ?
ajamesr (author)  steveastrouk4 years ago
Display count on a digital display.
LED, LCD, Size ?
ajamesr (author)  steveastrouk4 years ago
LED or LCD - doesn't really matter. Is there an advantage of one over the other? I presume LED would require less power?

Size is not all that important either. A small calculator size would do just fine. We could upscale at a later stage if required.


Other way round. LEDs would be easier to see, but need more power.
maewert4 years ago
If you have only the functions you listed and prefer TTL logic, you could feed the Head and Toe switches into a RS flip flop which could feed two cascading count up/dn 4 bit counters. One Set switch could be pressed to make the counters count up to the desired number and the head/toe switches would count down to 0. While TTL chips are old-school :-) they do work well and do not require programming. Myself, I would prefer the Arduino or PIC microcontroller method mentioned above.

Best Wishes
rickharris4 years ago
Button 1 AND 2 or 1 then 2?

Count display how?

What is your experience of logic circuits or microprocessors?

As an example for you using the Picax microprocessor (about £1.50)

This should do what you want. www.picaxe.com

; Assumes button 1 on input 1

;Button 2 on input 2

;Output 3 for alarm/light.

;Picaxe 08M used.

;B1 =count


START:

If input 1=1 then B1pressed
goto start


B1pressed:
If input 2=1 then count
b3=b3+1
wait 1
if b3>5 then toslowalarm

goto B1pressed

count:

B1=B1 +1
If B1=30 then alarm
goto start

Alarm:

For B2=1 to 20
High 3
wait 2
low 3
wait 2
next b2

B1=0

goto start

toslowalarm:
for b2=1 to 10
high 3
wait 1
low 3
next b2

b3=0
b1-0
goto start
ajamesr (author)  rickharris4 years ago
It would be a perfect setup if we could use a digital keypad to enter the amount of exercise reps required to set of the alarm.
So instead of a fixed value of 30 which is programmed in, is it possible to, upon power up ask the device to wait until a value is entered on the keypad, say 50, and then perform all of the above actions but with the target value of 50 now?

I'm presuming this line is altered
If B1=30 then alarm
iF B1=(keypad) then alarm

where (keypad) refers back to a part of the script labelled KEYPAD which scripts taking an input value from the keypad when the unit is powered up.

Excuse my rough description and inaccurate use of the proper terms but this is all pretty new to me....


The 30 refers to the number of presses that have been made (REPS)

You could add a key pad or indeed change the number with a couple of buttons if you have a display.

If you want to use a keypad then you will need to use a bigger micro.
ajamesr (author)  rickharris4 years ago
NIce one, thanks. I'll get reading on their website and try get my head around building it from scratch. But this certainly seems like a good start. Thanks for your reply and the code. Excellent.
I presume this setup would be capable of displaying the count on an LCD display?
Time to start looking at their manuals - Free. Their forum support is good as well.
ajamesr (author)  rickharris4 years ago
Button 1 THEN 2 . So you push button 1 when you get to the ground and push button 2 when get up and jump in the air. Hence 1 round of that exercise.

Display on digital display I guess.

No experience with logic circuits or microprocessors. But I am alright with a soldering iron and basic electronics. And I'm a quick learner. Also decent enough on a computer and am using a Mac. But no real programming skills.