Getting an ardiunio to count an average number of DC pulses over time.

So, I'm losing weight on a rowing machine (dropped almost 30kg so far) and I've thought of a project that will essentially force me to row at, or above a certain pace, unless a switch is flipped.

So the rowing machine I counts the amount of strokes I do using an onboard module, I figure running fires in parallel from from the beeper that beeps every time you do a stroke will be easier than removing the and coding in a counter based off however the machine gets it's stroke data.

Project works like this in theory:

Arduino counts DC pulses and gets an average of strokes per minute (SPM) , if I am doing over, say 26 SPM the ardiunio sets a pin high to light a green LED. If I drop under 26 SPM the ardiunio switches off the green LED and lights a yellow one which will give me about 15 seconds to get back up to speed. If the requisite SPM fails to increase back into the green by this time a red LED lights and a relay is switched on for about 30 milliseconds repeating every 5 seconds until you get back to the target SPM.
Said relay connects to a circuit containing a 9v battery powering a boost converter that produces voltages in around the 10-20kv range, eBay claims they do 500kv however I find this inaccurate as they can only arc over about 3cm. The high voltage leads will go to a pair of flexible electrodes attached to each ankle via a velcro strap.
In short, if you fall behind, you get one hell of a zap. I call it the motivator. It's somewhat inspired by Electroboom's motion detecting run or be zapped device, but is a little more complex.

The question is, as I am fairly new to ardiunio and coding, can an ardiunio do the calculations for an average like that or is it outside the scope of the device?

What is a DC pulse?

p.s. this project sounds very unsavory.

Fun project! Loking at old films where slaves were rowing the boats there was a drummer telling the rate of rowing. Like a metronome used by musicans.
I suggest You measure the time for each "rowing" and calculate a running average over some strokes, 2, 5 , 10 strokes.
The high voltage part..... Use Your determination to reach the goal, Your selfcritisism! Feel satisfied when You have reached the goal, else feel something that triggers You for the next pass. High voltage like that could easily get dangerous.

Reward is better encouragement than punishment and less dangerous

The punishment given by Your own selfcritisism, not being satisfied, is the best medicin to do better next time. Believe me!

skyvan:
What is a DC pulse?

p.s. this project sounds very unsavory.

Sorry I probably worded that really badly, I'm pretty much self taught in electronics, by DC pulse I mean the short 'pulse' of DC current going to the buzzer. I could try to think of a better term but I'm probably gonna dig a deeper hole by inventing my own.

pmagowan:
Reward is better encouragement than punishment and less dangerous

Agreed. The danger of these boost converters is fairly low, I've used one with a 9v battery in a project box to light my gas stove (the last owner lit the grill on fire and toasted the electronics so the push button sparker doesn't work) and have zapped myself a few times. It hurts a lot for a very short period of time but it's not caused bigger problems like electrical burns or any really dangerous effects. I originally planned to put the electrodes into the rowing machine handles but then hand to hand would make a path that could potentially go through the heart so that was discounted. Leg-leg seems safer but I could always move it to two electrodes on one velcro strap so it just runs under the skin over a few centimetres.

I've also planned out a switch on the relay side of the circuit and an emergency cutoff switch by using a pair of spring contacts and metal peg with a line running from the leg to my wrist so all I have to do is pull my arm right back and it deactivates the HV side.

As another safety feature the relay would be turned on for a fraction of a second and if it can be done in code no more than x activations can be done before it gets shut off entirely.

If I could code in a pause button for when I take a drink of water that would be good too.

@Everyone who respnded
I know it's a silly invention, but I just feel like making something really dumb. I mean if you strap yourself into the thing (and know what it does) the responsibility for accidents lie on the end user (me) or at least that's how I see personal responsibility, however I could see it being a case of "play stupid games, win stupid prizes" so I get where you're coming from.

Edit: I hooked one of those boost converters (you know, the little potted semi-cylindrical things electroboom had a whole ago that scared the crap out of him) up to a bench PSU for 'testing', on a side note, bench PSUs are dirt cheap now, a second hand linear one with 4.5 memory modes and a 'second' on switch (meaning you don't need to be ginger careful with your stuff when switching the thing on in case it was previously set to 31V 3.1A for some reason, even 10 years ago one like that would have cost hundreds.
With my 'tests' even at 1.2v it delivers quote the sting to the back of my right hand so no involuntary contractions occur, or of they do its away from the source), granted this is from bare wires, I would assume the ouch effect drops off based on electrode surface area so maybe a full 9v, whilst great at making arcs might be a little too strong for "motivation" after all you can't easily row faster if you just got a (very short) zap from a taser. I suppose a variable buck regulator could do the trick or I could go old school and use 2 1.5v cells, a voltage divider and two relays, one for full power and one for half.

As for the zap itself, if anyone is curious it's pretty uncomfortable but also very short lived. The worst I ever got was a 240v mains current shock when I was a kid, now that hurt!

I couldn't help it.

Hi,

Said relay connects to a circuit containing a 9v battery powering a boost converter that produces voltages in around the 10-20kv range, eBay claims they do 500kv however I find this inaccurate as they can only arc over about 3cm. The high voltage leads will go to a pair of flexible electrodes attached to each ankle via a velcro strap.
In short, if you fall behind, you get one hell of a zap. I call it the motivator. It's somewhat inspired by Electroboom's motion detecting run or be zapped device, but is a little more complex.

Have you felt 20kV?
Electroboom knows what he is doing and a lot of it is acting even though the arcs and sparks aren't.

You are effectively TAZERING yourself, not recommended.

Tom.. :o :o :o :o :o

TomGeorge:
Hi,
Have you felt 20kV?
Electroboom knows what he is doing and a lot of it is acting even though the arcs and sparks aren't.

You are effectively TAZERING yourself, not recommended.

Tom.. :o :o :o :o :o

To answer your question, yes I've felt 20kv or at least the voltage put out from one of these boost converters, which can draw an arc of around 3cm. I use one that I built (very simple project box design with a 9v a PTM switch and the boost converter hooked up to electrodes) to light the gas stove in my house and have occasionally unintentionally zapped myself with it. I also intentionally zapped myself with it a couple of times because I'm a curious person and the shock goes from electrode A to electrode B through the skin and doesn't pass through any vital organs.

If this were something that pushed a much higher current (such as a microwave oven transformer) I wouldn't even think of using something like that as a MOT shock can and has killed people; botched lichtenberg wood burnings come to mind and even Mehdi (Electroboom) nearly died to one when making his Jacobs ladder (which he confirmed wasn't a stunt in an AMA) however these little boost converters do little more than cause a short intense pain.

As posted above I tested one out with a bench PSU and 1.2 volts drawing roughly 1 amp was enough to give quite the shock, however as the current is stepped up to (I assume) at least 10kv this creates a current of 120 microamps if my cauculations are correct, which is far from a lethal current unless it was applied directly to the heart.

I have worked with mains and high voltages (Jacobs ladders using neon sign transformers, tesla coils, my little arcwy sparky gas lighter and more mundane things like discharging old CRT televisions) and know the usual safety precautions like the 1 hand rule and have a friend present to cut power, then rescue should something bad happen when doing any particularly risky work. I'm by no means a high voltage expert like Mehdi but I'm not a completely incompetent fool, although I'll agree that this is a foolish endaovour, which is why I've talked about putting in multiple safety backups, possibly even a "dead man's switch" built into the towing machine handle.

I appreciate your concern however.

Usual safety equipment in housholds detects if current is passing through the green-yellow wire and cuts off mains. Their current level is 30 mA. Current greater than that is considered as hazard.
Your cocking device should not be able to output any current at all. Some microamps would be enough.

If you have lost 30 kg so far, you clearly already have the required motivation, and the success of being less overweight and better fit should be reward enough.