Servo causing unexpected Analog Signals

I am attempting to build a knock detector using a piezo that will trigger a servo when the knock is correct. I am using these instructions as a guide: https://www.instructables.com/Secret-Knock-Detecting-Door-Lock/.

The positive side of the piezo is connected to Analog pin 0. I have run into a problem where if the servo (MG90S) has movement resistance (like slightly pushing on the arm), I get high reads on Analog pin 0 which looks like more knocks to my code. Everything works great if the servo is disconnected.

I am new to Arduino project and hope someone more experienced can help me solve this mystery. :slight_smile:

Don't power a servo from the Uno 5V regulator.

Thanks for the reply! It crossed my mind too that I should try an external power supply for the servo. Does powering a servo from the Arduino Uno risk damaging the board?

How is the controller powered, by USB as in the picture or via Vin/barrel jack?

Maybe. The regulator should shut itself down if too much current is drawn through it or if powered by USB the polyfuse will, hopefully, open. But there is no guarantee. Use an external supply. A 5V 0r 6V supply with at least 1A for a small servo or a 4 AA cell battery pack. For larger servos, consult the servo data sheet and use a supply that can handle the servo's stall current. Connect the grounds.

Update! The separate power supply to the servo solved my issue. Thank you for the help!

When I first connected the servo to a separate power supply, it was doing crazy jitter movements. I watched this servo intro video Using Servo Motors with Arduino - YouTube and he said to connect the grounds together. That solved the jittering servo. Finally, I tried both the Arduino and the Servo connected to the same USB power bank, but the original issue returned. Turns out that separate power supplies truly are needed.

This is what it looks like now:

Yes, I have been using USB. Are there any benefits to using a barrel jack over USB?

No. I only wanted to the way the power problem came in.