So after some comments on my last post, some great comments on my Adafruit forum post about the actual robotic arm project I’m working on, some help from Twitter followers and some awesome fellow NYC Resistors, I realized there were a few more things I needed to do before getting meaningful current data from this robotic arm. I looked at the signal with a fancy oscilloscope with the help of a friend at NYU-Poly, and there was a great looking signal beneath the noise. So…
Step 1) Filter the noise
It was pretty clear from the comments that I would need to do some hardware filtering even before I worked with software filtering, so that meant creating an RC low pass filter. In order to verify that the RC filter was working, I finally had a good reason to figure out how to use my DSO Nano v2. I watched this video that talks through updating the firmware and getting started. There’s also some good info on the forum. I used a “real” oscilloscope from another lab here as a sanity check that what I was seeing on the DSO Nano was real. This is what the current for the robotic shoulder motor looks like with no filtering:
I then used an RC low pass filter at the output of the op-amps to get rid of some high frequency noise. From some limited experience, I decided to shoot for a cutoff frequency of around 45 Hz – that should take care of any ambient 60 Hz noise from lights, etc. Using Adafruit’s awesome Circuit Playground app, I chose values of components I had on hand (R value of 330 ohm and a C value of 10uF) and designed the circuit to have a cutoff frequency of 48.229 Hz. That’ll do to start.
So the 48 Hz low pass filter was better, but not great. I then decided to use the R and C values suggested by coffey in the Adafruit forum post above (R = 570 ohm and C = 47 uF) to create a cutoff frequency of 5.941 Hz. I didn’t have those exact values, so I kept the 10 uF caps in and swapped the resistor for a 2.2k ohm to get a cutoff frequency of 7.234 Hz.
Much better! Now let’s see what it looks like if I log this data through Cool Term as fast as Arduino is spitting it out:
Great! I graphed the Cool Term data in Excel quickly and you can see that even at the slow speed that I can log data with (about 265 Hz in this trial) I’m getting a pretty representative signal.
I’ll update this or make another post when I’ve finalized all the filtering, scaling, and math about it, but it’s getting pretty close to done.