I am trying to control a piezo-sonic motor using Arduino Uno. I am reading encoder signal with Arduino pins. My encoder reading was massively inaccurate so I checked the signal with an oscilloscope. The signal has a huge amount of noise.
When I read the signal directly from encoder instead of Arduino, there is almost no noise. Reading the same signal from Arduino pins produces unacceptable amount of noise.
While using Arduino, I removed the GND wire from Arduino and connected it to Oscilloscope GND and noise disappeared completely. I used a new Arduino kit and results are same.
Why is this happening? How can I improve the ground connection of Arduino?
(plus I double checked, all the wiring and connections are good)
I am not going to download a video to help you. You can post photos here.
Post a schematic. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
Post technical documentation (data sheet) for the encoder and other parts as necessary.
Post your test code. Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
There will be a problem with how it's wired, this might be obvious from a schematic but possibly not. Some photos that clearly show the wiring would help.
This is the ONLY signal ground you should use, ground as close to the signal as you are monitoring.
Now, you have at least 4 grounds in your video:
Scope AC chassis ground
Scope probe (signal) ground
uC Analog power GND
uC Digital power GND
Most Arduino project boards combine Analog/Digital power on the circuit board; homemade uC projects must do this, too. This GND is the point normally distributed to external components.
What I saw in the video was one huge radio antenna, perhaps of interest to NASA for deep-space radio astronomy.
Avoid ground loops. Google it.
Learn to utilize that beautiful scope correctly. Techtronic used to have a using scope guide as a PDF. Or, just review your o'scope user manual with attention to probe ground referencing.