We are trying to detect mice's licking using a piezoelectric attached to a metal spout tube that delivers water.

It's kind of working in the sense that we can detect licking, but it suffers from strange slow oscillations in the baseline (see screenshot 1 below).

The sinusoidal or spindle-like shape is the baseline signal without licking, and larger spikes are the detected licking of a mouse. As you can see in this image and the one below without licking, the frequency of the spindle-shaped oscillations is slowly fluctuating between <0.1 to 0.25 Hz.

The readout of licking is still visible, but it looks as though the amplitude of the signal is proportional to the amplitude of the spindle-shaped baseline oscillation. The licking spikes are smaller at the edge of the spindles, but become larger at the belly of the spindles.

So we cannot really know the exact amount of deflection of the piezoelectric by the mouse's licking. It appears that the signal gain of the piezoelectric is fluctuating, rather than the fluctuating noise is simply added to the signals.

We have tried to fix this problem by trying various ways of grounding, but so far not working.

Couple of things we've considered/tested are:

  • The piezoelectric attached to the metal spout tube is not insulated from the metal tube, and the metal tube is creating problems?

  • Is this still a grounding problem? How can grounding affect the gain of piezoelectric?

  • Could the metal tube or piezoelectric work as an antenna and pick up signal/noise from distant objects?

  • What is the source of this weird rhythm?

  • The sampling frequency of the piezo readout is 100 Hz.

  • Mains frequency is 50 Hz.

If you have any advice on this, or have seen something similar, let us know, please! Thanks.

Screenshot 1

screenshot 2

Added on 30th October

There were comments about the gain change or piggybacking on baseline noise.

I can do a proper analysis using the recorded data later, but for now just a quick look at the screenshot above demonstrates that the amplitude of licking "spikes" subtracted with the "spindle shape baseline noise" is increasing towards the belly of the spindle (see the red numbers; they would be more or less constant if it were piggyback and if the pressure given by licking is stable, but it steadily increased).

We can't be sure about whether the pressure of licking is constant from this small example, but I've seen this pattern of evolving spike height in relation to, or in the spindle-like baseline, and that's why I think it is not piggyback for the moment.

enter image description here

  • 1
    \$\begingroup\$ I'd first look for the obvious, acoustic signals which may be coupling into the containment structure. It looks like around 250-400Hz, quite likely resonating with a similar vibration or with a part of the structure to produce the beat pattern shown above. I don't think the gain is changing, it's more that the peaks of the signal are piggybacking on the noise. This leads me to suspect your scope speed is too low for the noise source and you might be aliasing higher frequency signals down with your slow scope sampling speed. \$\endgroup\$ Oct 29, 2019 at 20:33
  • 2
    \$\begingroup\$ Mains hum aliasing with your sample rate. \$\endgroup\$ Oct 29, 2019 at 22:33
  • \$\begingroup\$ How are you amplifying the piezoelectric element? \$\endgroup\$ Oct 30, 2019 at 14:27
  • \$\begingroup\$ I concur with @BrianDrummond; if you were to lock your sample rate to the mains frequency (so it is truly double the mains frequency) it would be (mostly) eliminated. \$\endgroup\$ Oct 30, 2019 at 14:56
  • \$\begingroup\$ Thank you, guys. Mains hum noise is at 50 Hz and the sampling rate is 100 Hz. I thought aliasing is most prone to happen when the sampling rate is lower than the signal, but maybe not necessarily? In our case, Nyquist frequency is 100/2 = 50 Hz, so it's just at the borderline to get aliasing noise?. \$\endgroup\$ Oct 30, 2019 at 21:35

1 Answer 1


It looks like aliasing of some higher frequency signal (perhaps mains frequency). Compare your sample rate to mains frequency and other relatively high frequency noise sources.

  • 2
    \$\begingroup\$ If aliasing is the problem, another troubleshooting method (and solution) is to add an RC filter adapted for your signal frequency. \$\endgroup\$ Oct 29, 2019 at 20:57
  • 1
    \$\begingroup\$ If it's hum you can average all the samples in 1/50th of a second (or 1/60th of a second), Then the interference averages out to zero (since a full cycle of the interference is averaged). \$\endgroup\$
    – user69795
    Oct 30, 2019 at 3:34
  • 2
    \$\begingroup\$ As the recent edit shows (so you couldn't have known about it), there are TWO samples in 1/50th of a second -- hardly enough to make a dent. If there were enough samples to prevent the aliasing, aliasing probably wouldn't be a problem --- almost by definition. Usually better to deal with aliasing before sampling. \$\endgroup\$ Oct 30, 2019 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.