Hello. I am using an Arduino Uno and a Memsic 2125 Dual Axis accelerometer. I am trying to get them to count one vibration as a 1 on a 7 segment display. It would work kind of like a fitbit. Is there any way to do this with what I have?
you would need to start defining what a vibration is and what it looks like for your sensor
It measures in terms of g. I just want it to input anything over 0.5G vibration it as a 1on the counter.
If it helps at all, we may not need both axis to input. The goal is the put the device on a wall and count each time a ball hits it.
You can't define vibration by using the word vibration
so we already know it has to record something above 0.5G. Wouldn't timing play a role too?
Timing of what? Do you mean timing of each vibration or timing in between vibrations. I really dont know much about these things that's why I'm asking for help. The datasheet for the accelerometer isn't really helping. All it says is +-3g as a measurement.
forget programming and your sensor for a bit.
if you had to explain to someone in plain English what a vibration is. how would you explain that?
For this project, a vibration would be the very slight movement of a wall caused by a ball hitting it.
OK, getting there
A movement is defined by a distance.
if the wall moves by 1mm and comes back to original position in 1 hour. is that a vibration?
if the wall moves by 1mm and comes back to original position in 1 ms. is that a vibration?
if the wall moves by 1mm and comes back to original position in 1 µs. is that a vibration?
➜ your sensor measure acceleration, so it's the speed over time or distance over time2
if you measure an acceleration above 0.5G 10 times in a row, is that the same vibration or do you count 10 vibrations?
To detect a ball hitting a wall or target, use a piezo "knock sensor". Plenty of examples on line.
Write a sketch to just Serial.print() X, Y values from the accelerometer. Mount the accelerometer on the wall and use Serial Plotter to visualize the data. Look for the signal that tells you when a ball hits the wall. THEN figure out how to detect THAT signal in software.