Tabata timer

Discussion in 'The Projects Forum' started by Treeman, May 22, 2014.

  1. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Hi all, first , great site where I will no doubt now spend vast portions of my life:D. I'm a virtual beginner in electronics but not too stoopid.
    After a spectacular motorcycle crash I was helped by a great physio who I'd like to repay with a project.
    Tabata - is a 4 minute exercise program consisting of 20 secs work 10 secs rest 8 times before collapsing. Following my accident I have played with audio circuits and preamp but I'd really like to make a Tabata timer for my physio.
    I have looked at 555, 4017 and RC circuits and am bemused slightly about flip flops but before experimenting I must admit I'm a bit conceptually lost :eek: in getting the WHOLE project to be automatic. I'd really like some pointers if possible.

    I would like my timer to do the following:
    Switch start (SPST) then 17 sec silence and 3 warning beeps (or a continuous 3 sec alarm)-total time 20 secs. After that the 10 sec timer begins, 7 secs silence then 3 more beeps (or a continuous 3 sec alarm). This repeats 8 times then stops (I imagine a boxing round type bell going off.)

    The projects may then be built into a Kendo type stick (or hand grenade!) or something bizarre.

    Many thanks.
     
    Last edited: May 22, 2014
  2. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    You can buy these online for under $30, and of course this can be done with the smallest of microcontrollers, but sticking with an all-hardware approach...

    Is this a correct restatement of the problem:

    On
    10 seconds without beeps
    10 seconds with three beeps at the end
    10 seconds with three beeps at the end
    Repeat 8 times
    Unique finish sound
    Stop

    ak
     
  3. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Hi and thanks for reply:
    I'm a make do and mend type and can't bring myself to buy one. They are also not available in kendo stick format (yet!)

    Click ON (spst on end of kendo stick)
    Timer counts 20 secs while exerciser works - last 3 secs of 20count are beep beep beep (warning that the rest period is approaching)
    Timer Flips to a 10 second count and the last 3 secs of this count are again beep beep beep (or whatever) warning that the next work period is approaching.
    Circuit then restarts the 20 second count etc etc until the 4 minute period has elapsed and 8 cycles have been completed (8 x 30 secs = 4 mins).
    Ideally I would like a different warning at the end of the 4 minute so the end is signalled and exerciser can happily collapse!

    Hope that makes better sense. Thanks
     
  4. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    So yes I think you have stated correctly (but in 10 second intervals 2x10=20!!).
     
  5. wayneh

    Expert

    Sep 9, 2010
    12,155
    3,061
    There's probably an app for that. It sounds a lot like the timers people use to get their kids to brush their teeth properly.

    It'd be trivial to get your laptop to do this chore.
     
  6. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Yes thanks Wayneh but where's the fun in that! Since being driven over I've had some time to explore many of my interests that I would never have time for before due to monkeying around in trees. The wife has been calling me a geek and I'm very proud to have earned my geek badge hacking broken stuff and making it into other things (my home made powered breadboard is (to me) magnificent).
    I just want to use it for the next project 'birthing'.
    Ok so I'm a little crazy. That's roadkill 4 ya!
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,155
    3,061
    Well, it could be fun to write your own app if you can't find one already existing. Then you could sell it to other folks that need a "tabata timer".
     
  8. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    I did a search, and there are tons of pc programs and mobile apps for this already. I'd throw all of the logic into a small CPLD, but that's not the same as building it from scratch.

    ak
     
  9. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Hi and thanks for the responses so far. I have no idea what a CPLD is(I googled and stopped reading after one line -way beyond my experience), don't own a tablet and I'm well aware that there are tons of things I can buy to fulfil this task. I'm not a computer programmer either. Where I'm coming from is: I have a load of discrete components and a funky idea for a gift for someone who helped me get back to health.
    As a beginner I figure that building this device will be a great experience in using IC's etc. I can build a 10 or 20 sec timer using the wealth of info on the net but I'm conceptually 'constipated' in how to combine the 10 sec and twenty second count with alarms and a cycle 8 times. Is all I need some 555's and an array of decade counters? How do I get a cycle to repeat and then stop, how do I get an alarm to sound 3 times before triggering another timer? Perhaps what I want is not possible from discrete components and I need to investigate Logic chips AND NAND NOT dot dot dot!
    Perhaps my ONLY choice is some micro controller (clueless on this). That's the kind of answer I was hoping for. Analog Kid broke down my twenty second count into 2x10 which suggests to me that two decade counters may be useable - I'm a beginner so perhaps my concept is too lofty?!
    Do I need to look into cascading 555's and 4017's somehow. Do I need to build two circuits that run simultaneously?
    In another post I saw that #12 stated that 'one needs to put some effort into Homework' (paraphrased). I'm happy to do that but I was hoping for some pointers on DISCRETE Components only. Truth Tables etc are probably not beyond my intelligence but do I need to investigate these RIGHT NOW or is there another way??
    I hope I'm making sense- I kind of thought that this would be an easy answer for AAC members but maybe that's my naivety talking!
    I just don't know!!!! If I have to use microcontrollers and programming it could take years!
    Please don't see my response as cheeky - Wayneh. I agree It could be fun to write my own app - if I had a clue how to start but what am I going to do with my 4017's!!!!!!!!!!!!!!!!!!
     
  10. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Interesting . . .

    I think you could do this with 4x 555 monostable timers (or 2x 556 or 1x 558 if you can get one) and a 4017. The tricky part would be the unique buzzer at the end. The 555 will not give a highly accurate time though.

    Before going too far, you said you want to put this into a kendo stick. How much room is there for a circuit in this stick? While it may be possible for a purely discrete logic solution with several IC's, I worry about the room you'll need for the circuit in the stick.

    I had to look up CPLD too - neat solution. In essence, it is a programmable logic chip. Not quite a microcontoller, but you might get away with one of these instead of the five IC's I mentioned above.

    For the limited space and timing requirements, I'd suggest a microcontroller (uC). I know, I know, you've never used one. Well, I could write the program and you could put the circuit together and load the program onto it. I like the PICAXE since the program is free, a programmer can be had for under $5 USD on eBay and a 8-pin uC would run under $5 as well. Once you had the program, you could easily change timing values (or sounds if we use a piezo) should you want to tweak it later. You still get to build something and you can "play" with programming without having to spend a great deal of time learning it from scratch.

    If I follow the thread correctly, you want:

    1. Press button
    2. Wait for 17 seconds
    3. Sound buzzer (or beep) for 3 seconds
    4. Wait 7 seconds
    5. Sound buzzer (or beep) for 3 seconds
    6. Repeat 7 times (eight cycles total)
    7. Very last buzzer/beep will be unique to signify end
    8. Wait for button press again

    This is a straightforward program to write, the fun part will be playing with a piezo or similar buzzer.

    If you decide to go this route, let us know how much space will be available for a circuit board in your stick (or grenade or whatever you decide to house this in).
     
    Treeman likes this.
  11. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,813
    1,105
    Would it upset the karma/whatever to change the timings so that the exercise period is a power of 2 times the buzzer period, i.e. timings proportional to 16 secs exercise, 2 secs buzz, 8 secs exercise, 2 secs buzz, .....? Might make the use of discrete logic simpler.
     
    Treeman likes this.
  12. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    Yes, this can be done with three 4017s, one or two 555s, and some glue (misc. logic functions that tie everything together). There will be some logic gates involved, but not too many. As for discrete circuit parts (transistors, Rs, Cs), not so much; although transistors can be used instead of inverters (NOT gates), diodes might work to combine some logic signals, and RC (resistor-capacitor) networks can be used to turn a level into an edge for triggering things. So lets break down the design into sections. Since you mentioned 4017s and 555s, we'll go with that.

    Section 1 is a ten second timer/counter/divider. This is a 4017 with a 1-second clock from Section 3, and runs continuously once started. The reason it is a 4017 instead of a binary counter is that we want a 1-second decoded output at the end. Output #10 is combined with signals from Section 2 to enable the beeper. Also, output #10 is used as the clock input to Section 2.

    Section two is another 4017 that has output #4 tied to its reset. In this way, it counts 1-2-3-1-2-3-1-2-3... Output 1 is combined with Section 1 output #10 to enable/disable the beeper. The beeper is disabled for the first 10 seconds, and beeps at the end of the second and third 10-second periods. Sections 1 and 2 combine for a 30-second cycle. The beeper is two 555s in series. The first one runs at 3 Hz to generate three quick beeps in one second. If you are using a speaker for the tone, the second 555 is an oscillator running at 1 KHz. If you use a self-oscillating piezo beeper, it can be driven directly from the first 555 and there is no need for the second one. When enabled by Sections 1 and 2 combined, the beeper chirps only during the last second of the 10- and 20-second intervals.

    Section 3 is the traffic cop that is the timebase, counts off 8 30-second cycles (4 minutes), makes a different sound at the end, and halts everything. Low frequency oscillators are difficult to calibrate and generally are not very accurate with commercial-grade components. Better to start with a higher frequency and divide it down to what you need. A great part for this is the CD4060, an oscillator and 14-bit counter all in one. With a reasonable 1% resistor and 1% capacitor it is stable, and you can add a small pot to make it adjustable for accuracy. The oscillator runs at 16,384 Hz, and the chip makes the 1 Hz clock signal that goes to Section 1. Also, this is what is disabled at the end of 4 minutes. The reset signal from Section 2 #4 clocks the third 4017. Output #9 signifies the end of the 8th cycle, and disables the 4060 timebase.

    Thems the basics. There is no start button, just a power switch. On power-up the system clears itself, runs for 4 minutes, and stops. To start another cycle, turn it off and then on again. Some interconnect logic and polarities need to be worked out, and we still need an ending sound. But that clean-up stuff comes after you decide on the basic plan.

    ak

    Edit: The 4017 datasheet labels the outputs Y0 thru Y9, not 1 thru 10. So in section 1 above, output #10 is called Y9 on the sheet. Whatever, it is the output that goes high after the 10th clock pulse. Same for the other outputs mentioned.
     
    Last edited: May 23, 2014
    Treeman likes this.
  13. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Thanks guys - really appreciate those answers. I knew you'd come thru! Thanks elec mech for the offer, I may well take you up on that and I appreciate the gentle push toward CPLD (thanks too Analogkid 4 suggestion). I did think that I may have to put the grenade on the kendo stick to fit it all in!
    Analog Kid - what can I say - ur Mom named u well. Your post will take a little time to digest I feel so I'll have a crack and see how we go. Funny but all of a sudden I can see why CPLD and micro controllers may be so popular! The 'magic smoke' is already coming out of my ears if not my circuits.
    Alec T- the karma is intact but Tabata is as Tabata does so we cant mess with the timing. Thanks for the input though.

    I don't have much to offer back but u can always PM me for Tree advice or how to do physical rehab. : )

    Cheers.
     
  14. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    I think this covers the basics. The beeper beeps 3 times at the ends of the first three 10 and 20 second periods, and 6 times at the ends of the last 10 and 20 second periods. -ish. This is not a finished or final schematic. I grabbed parts out of the library that felt close to what is needed, some of the logic might need adjusting, etc.

    ak
     
    Last edited: May 23, 2014
  15. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    I'll have to test this first to verify operation, but here is a possible uC approach. There's a little bit of math in the code in case you wanted to change the buzzer duration. In effect, three beeps come from the buzzer, but you can control how they sound and how long they sound from 10 milliseconds to 1 second (3 very short beeps to one long 3-second beep).

    I took AnalogKid's idea to simply have the circuit controlled by a power switch - turn the switch on, the program runs once and stops until the switch is turned off then on again. This keeps the design simple and avoids multiple switches (one to remove power to conserve battery life and one to start the program). Of course, one could simply have a single momentary run button and put the uC into sleep to minimize power consumption, but having a true off switch maximizes battery life.

    The LED is added to let the user know the switch is on. You could also have it blink when the cycle was finished to remind the user to turn the switch off.

    The code is written in BASIC, but I can draw up a flowchart showing you exactly what the program is doing if you'd like.

    Again, this isn't to steer you away from a purely hardware solution - just want to point out the benefits of a uC controller for certain applications.
     
  16. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Guys that's really very generous. Thumbs up all round.
    I was browsing the rest of the site and I'm very impressed with what you all (y'all) have going on here. Such a change from tree surgery forums.

    My plan is to work through AnalogKids initial reply first and see what I can come up with before going ahead with both Elecs and Analogs schematics. The uC approach is as you both said very compact and more approachable than I initially thought. Give me a few days to digest this and i'll come back to you- have to squeeze it in between being a busy dad and my AAC addiction.

    If only I had a tablet - I could read in bed!!!!!!!!!! An ashamed philistine learns his lesson.
    Elec - i'll try to guess/write my own flow chart and we can compare later.

    Thanks.
     
  17. Treeman

    Thread Starter Member

    May 22, 2014
    158
    15
    Ok , quick update. I'm busy building AK's schematic and all seems ok so far. I lack a few parts which I need to order (Cd4060 and the schottkys). Obviously I will buy at same time but I wondered if using an ordinary diode will be ok or will slow down the timer due to response speed. I'm using 12v so also wondered if the extra voltage drop across an ordinary SilD would cause any problems. Also the BAS 40 is in a package I'm not used to seeing (beginners complexities) - how to mount to breadboard?
     
  18. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    AnalogKid will have to confirm, but in the meantime, I don't see any reason a standard small signal diode won't work - 1N914, 1N918 or 1N4148 all should work. Won't hurt to try them anyway.

    Are they surface mount? It won't be pretty, but you can solder short lengths of solid 22AWG to the leads to connect to a breadboard.
     
  19. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    I went with shottkeys because I didn't know the power supply voltage. With 12 V and all CMOS parts, normal 1N diodes will be fine.

    There is a small error in the 555 enable logic. Updated sch coming, 1 fewer diode.

    ak
     
Loading...