Know if a device is shaking with the accelerometer

I’m making a script that shakes an object with the accelerometer.
I’ve achieved this making a psudomovement.
I’ve made an animation and when i shake my mobile (up or down) the animation plays, but it feels fake ^^’ (because it is). The shake is only important in the Y axis, but can I know the velocity the mobile is shaking? I think the Input.aceleration.y value is the diference between the last position and the current.

To be clearly, I want an object that when i shake up slowly, it moves slowly (The direction i shaked) and when I shake up fastly, it moves fastly, and when im not shaking or the object has arrived to a max position, return to the center smoothly.

Thank you in advance!

A bit of an old post but make sure you call Input.gyro.enabled = true; at some point in your code.