Using ADXL345 3-axis accelerometer/Arduino Nano to count bounces of a pogo stick

Yeah. I am able to read the serial display and the features this code utilizes are working.

So you're reading sensor data from the accelerometer ?
Did you understand my previous comments about using the APEX of the upward trajectory as your Index ? (for the counter)

Haven't read any data no. Just like in the picture I am just seeing the printed statements at the end of the code. My next step will be to print the actual data to see what's going on.

That means what ?
You are operational now but haven't done any real testing ?

Correct. Over the couple of days I hope to make some headway

So it only took 23 Replies to get to the point where you could run the program correctly (we hope).
Well , that's not bad. It was a little more than 24 hours. Could have been worse.
Good luck...!

mtrapuzz:
So, from this I gather that at the apex of a jump the accelerometer should read 1G if this is the 0 you are talking about. So count the number of times the 1G value is attained? However, I feel like this will cause a problem while the pogo stick is idle. Maybe sensing variations from the 1G caused by small movements and then counting those subtle movements as bounces.

Some of this discussion is getting a bit confused.

Whilever the pogo stick and its occupant are not in contact with the ground, the measured acceleration will essentially be zero.

The frame of reference of the accelerometer is of course itself accelerating at this time, constantly downward at the acceleration of gravity. When the stick contacts the ground, it undergoes a sort of sinusoidal surge of force corresponding to the compression of the spring which will be reflected in the accelerometer reading, reaching a peak in a downward direction of something more than twice the gravitational acceleration (presuming that the pogo stick spends more time aloft than in contact with the ground.) This acceleration will never go (significantly, as follows) in the opposite direction, and will average exactly 1g.

Now this presumes that the pogo stick - and the accelerometer - accurately reflects the centre of mass of the stick plus rider, but of course the rider performs some additional manipulation - mostly during the ground contact - to add energy to the motion and this will alter the acceleration profile, including the possibility of some small acceleration (but only whilst aloft) in the opposite direction. Averaging and "debouncing" will be required to accurately distinguish each phase.

In fact, raschemmel is incorrect in identifying the "apex" of the aloft stroke as being critical or distinctive (if that is what he was saying) as by and large, the acceleration (generally zero) during the whole aloft phase is by definition, fairly constant.

In fact, raschemmel is incorrect in identifying the "apex" of the aloft stroke as being critical or distinctive (if that is what he was saying) as by and large, the acceleration (generally zero) during the whole aloft phase is by definition, fairly constant.

That is what I am saying . . The impact with the ground is going to have ringing that is difficult to work with while the upward trajectory caused by the springforce is totally free of such disturbance as soon as it leaves the ground and as the upward acceleration decrease to zero as it approaches the apex will be smooth and tapering to zero. The apex is clearly the point where that upward acceleration goes to zero and sampling for a "quiet"period (after the acceleration goes to zero, devoid of acceleration or deceleration) marks the downward phase indicating the impending impact with the ground. In short look for no signal for x mS and then the first large spike of the ground impact is the "mark" point to increment the count. When you collect the data and graph in Excel , it will be clear as day. BANG!..upward acceleration , zero g's for x mS , wait for it...BANG! Any time after 0 g's for x mS (when x is determined in the first test, it will be clear that "IF g-force = 0 for >x mS , increment count and disable counter until impact g's > y (75% of impact amplitude). When impact amplitude goes to zero and the direction of motion reverses, ENABLE counter and begin looking for the quiet period. There is no one point in time that is the best time but in my opinion, upward g's going to zero is as good a place as any . You have to keep in mind that if you are going increment a counter in the middle of the quietest period , you have to set a boolean flag that prevents the count from being incremented again until some major event occurs. I don't think you are going to argue that the impact with the ground is the most major event, but where my opinion differs from yours Paul is that I'm not interested in anything after the impact g's go beyond 50% of any max reading measured during calibration phase. I think it is a waste of time to process the ringing after the impact. The threshold (50%) is good enough.I've done a lot of work with accelerometers using very expensive equipment and we always set threshold after looking at initial measurements after which we rarely changed them. The Excel graph will tell the whole story. I wouldn't carve any code in stone until you see that.

I am still puzzled as to what you are actually saying, or how you are trying to explain it.

Ah! I've spotted the problem - you are confusing acceleration which is what the accelerometer is measuring, with velocity.

Except for movement of the pogo stick relative to the rider (or the rider's centre of gravity), the acceleration measured by the pogo stick will be zero from the time the stick loses contact with the ground, until it touches ground again. Where in the air the system is anywhere between those points is irrelevant, it is in "free fall" (even while it is travelling upward). Note the "Zero Gravity flights".

Are you suggesting otherwise?

Let's keep it simple. They're accelerometers so they only measure g-force. If we go through this step by step I think it is fairly clear.
T=0 jumper jumps up (meaning he pulls his legs up and coils his legs and then pushes down as hard as he can. Any g-force in this ? no, or nothing worth considering. T=200mS : stick hits the ground and compresses to the maximum compression g-force Definately maximum g-force we will ever measure (or close to it , because jumper is fresh and not tired out yet. This g-force will dimish as he tires. T= 400mS stick and jumper are moving up but going against gravity . He is not weightless (yet) so I think it is safe to say he is not in a zero-g state, so yes there is some g's but very small amplitute compared to T=200mS. . T=600mS Jumper is at apex. z-g's T=800mS Jumper starts coming down, gradually of course so very little g's but more than T=600mS and very small compared to T=200mS T= 1000mS stick hits the ground (END OF CYCLE) maximum g's That's pretty much it. There is only one place that is easily measurable , but as I stated before, this impact will have duration so at what point do you no longer care about the data ? (I said before at 75% of the very first measurement collected)

From a purely physics point of view, possibly in addition to other forces, all objects on or close to the Earth's surface are subject to 1 g acceleration or force = mass*(1 g) due to gravity, at all times, regardless of whether they are moving up, falling or standing still.

What is confusing to almost everyone about accelerometers is that they do not measure this acceleration directly. Instead, they measure the difference in acceleration between the accelerometer package and the sensing element within, which can be thought of as a mass suspended by a spring. In free fall, this difference is zero, so the accelerometer reads zero even though everything is accelerating at 1 g. At rest (on a table, for example) the accelerometer reads 1 g because the table is pushing up with force = mass * (1 g) on the package, while gravity is pulling down with force = mass * (1 g) on both the sensing element and the package.

This is of course irrelevant to counting bounces of a pogo stick, but it comforts me to think about why, when I'm in free fall, my sports watch accelerometer should read zero when in fact I'm hurtling ever faster toward the ugly splat at the end.

I think you touched on the most relevant point. My only experience using accelerometers was measuring shock. I have never tried to use one to measure movement and as jremington points out, they are useless for that so after reading his post I would have to say that anything I said previously that contradicts that is incorrect and more than likely the ground impact will register as 10+ g's and that will be the ONLY detectable measurement. This doesn't mean that my previous suggestion wouldn't work because I said you needed a definitive marker (the impact) to enable the next count and then you have half a second to increment it and start the
next cycle when it hits the ground. The count will be the same. Where my opinion varies now is that for the reasons jremington pointed out , there will be no diminishing aceloration in the up direction. There will be no measurement at all.

This isn't accelerometer data, but this is data collected from a motion study of a pogo stick using an eight-camera infrared Vicon visual system that collects and analyzes three-dimensional movement data. I plotted spring length and acceleration with respect to ground in MATLAB and used a digital filter to get rid of some of the high frequency noise on the acceleration data.

The green line is the length of the spring. At the beginning of the plateau the pogo stick leaves the ground, and at the rear of the plateau the pogo stick comes in contact with the ground again. Right in the middle of this plateau you can scan down and see the acceleration value cross the x axis where the acceleration is zero at the peak of the bounce. The acceleration value again crosses the x axis when the spring is fully compressed.

The acceleration data was taken from the top of the pogo stick which follows spring motion, rather than at the bottom of the stick.

I think your accelerometer data is going to look pretty sparse compared to this graph. You'll see period spikes in the 10 - 15 g (or higher ) range but not much in between.

Hi, trying to read through all this, has anybody simply thought of using the free fall facility of the accelerometer, I gather that it is a simple output that tells you when it is in free fall.
This occurs once in a bounce. SImple.
Forget frames of reference, zero accel, accel peaks, the accelerometer does it all for you...

Tom........ :slight_smile:

The only problem with this is that we are designing this for a consecutive bounce record in which the person attempting the record will be bouncing at a frequency of about 3 Hz only coming off the ground an inch or two at a time. I would have to see if the accelerometer would measure a free fall this fast. Not a bad idea to try though.

That wouldn't by any chance happen to be at the Apex of the upward trajectory would it ?

Free fall detection is on page 12
See attached

ADXL345.pdf (482 KB)