SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By Mee_n_Mac
#141299
dkulinski wrote:So I looked at samples between 1488 and 1788. This is actually pretty clean! The period seems to be all wrong though.
Dan
Interesting. What data file did those come from ?
By dkulinski
#141300
#4 with the PWM at 86% duty cycle. I said the cyclic rate looked wrong, but I withdraw that. Over .3 seconds it fired 6 shots. That is about 20 shots per second which matches up well to an 86% duty cycle.

Dan
By Mee_n_Mac
#141302
dkulinski wrote:#4 with the PWM at 86% duty cycle.

Dan
Period looks near right to me, perhaps 50 msec or so ? I note it also has "quiet" periods and "noisy" periods during each cycle period. Perhaps one is spring being compressed (sector gear engaged) and the other is sector gear disengaged ? Which would be which if true ?
By dkulinski
#141303
Sorry this came from dataset #3, not 4. I would suspect that the quiet periods are during compression. The AEG has a lock to prevent the motor from reversing due to spring tension. So you immediately need a lot of torque to keep the motor moving. With the motor unloaded you see the quick spike to drive it and then a very little spike to keep it moving?

Dan
By dkulinski
#141305
Ok, so I slid my range over by another 300msec and the data becomes more noisy but still pretty recognizable. I am not going to paste it here as I am sure Mee_n_Mac is working on it himself!

Dan
By dkulinski
#141308
Alright, so I made another chart. 10 period moving average from the samples in the range of 2090 to 2390. The moving average looks pretty smooth.
chart2.png
Dan
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
#141309
dkulinski wrote:Alright, so I made another chart. 10 period moving average from the samples in the range of 2090 to 2390. The moving average looks pretty smooth.
Dan
Now that looks usable ! When I get back later I may do the same on the other data sets.
By dkulinski
#141310
Yeah I knew I wanted a trendline and when I saw moving average I thought that would be a good place to start. Excel has a default 2 period moving average but I found this too easily influenced. Stepping through it looks like a 6 period moving average may capture the best parts of the data. 10 was just my first swipe at it and looking at it again may have smoothed it a bit too much. Luckily a moving average should be pretty easy to compute on the arduino also! Now hopefully my instructions didn't blow Static's arduino. :pray:
By Mee_n_Mac
#141330
I played with some digital implementations of low pass filtering (LPF) and I don't get as smooth a result as the 10 pt moving average. But having said that I'm filtering "noise" which may already be aliased, so I can't stress enough that the current sensor bandwidth (BW) should reduced from it's present 80+ kHz to something more reasonable. I'd say 100 Hz and perhaps even 50 Hz, but I'd collect some data at the 1'st first. Adding a 1uF cap should do just about that. Then some form of digital, post-sampling filtering/averaging can be done if needed (should be less intensive if needed).

I note that the quiet region seem to persist across all the data sets and it orresponds to a region of higher current draw, presumably when the spring is being compressed. So why is the region where (presumably) the spring has been released and the sector gear not engaged and the motor is just "loafing" along so noisy ? Off the top of my head I would have predicted just the opposite.

I note the PWM frequency seems high enough that it doesn't interefere with the desired current measurements. The motor must be filtering out the PWM, just as it's expected it should.

Lastly I wonder if the range of max to min currents, after being smoothed, is large enough and stable enough to be of use in determining where in a gearbox cycle the gun is. I guess I'd wait until seeing the data after the cap has been added to the sensor.
Last edited by Mee_n_Mac on Sat Mar 17, 2012 1:55 pm, edited 1 time in total.
By Mee_n_Mac
#141331
Here again is a plot of the Log4 data. Of the sets so far, it looks the best after DK's moving average, when it comes to "seeing" the gearbox cycles. The raw and LPF'ed data are also in the plot but are (both) very noisy, even with the LPF = 50 Hz.
AmpTestLog4.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by Mee_n_Mac on Sat Mar 17, 2012 1:51 pm, edited 1 time in total.
By leodi
#141334
What about try to do the average of each 2-3 plots to get a less noisy signal and store plots in an array of integet, to send it by serial after ? (if the serial transmission is a limiter at 1ms ?)
By dkulinski
#141338
Actually serial wasn't a limitation in the final sets of readings. We reduced the amount of data sent and I implemented my own code to output ASCII numbers. This should have reduced overhead enough that we are receiving true data. In fact from the trends we have noticed there does seem to be valid data at proper intervals.

Now the task is to figure out the noise issues. Mee_n_Mac has done a bunch of analysis on the data and pointed out that in just about every case we can see some relatively stable readings during what we are assuming is the spring compression period.

Dan
By StaticDet5
#141347
We may have a couple of issues.

First is parts. I need to go through what I have and find caps. I don't know that I have any in the right range.

Second, since this is a prototype build, can I solder a header or screw terminal in place on the filtering points, so that we can easily swap out the caps?

Finally, I'm going to kit bash a sound analysis rig this afternoon, and get that rate of fire plot with a serial log. I'll try and run a couple of plots and get things up. If there is a duty rate you folks want to see with the PWM, let me know. I'm reluctant to go too low.
By dkulinski
#141348
I don't believe there is a target duty cycle. We were just trying to get clean data.

As for swapping out parts, you could use a couple of screw terminals and crimp in the capacitor leads.
By Mee_n_Mac
#141349
StaticDet5 wrote:First is parts. I need to go through what I have and find caps. I don't know that I have any in the right range.
Second, since this is a prototype build, can I solder a header or screw terminal in place on the filtering points, so that we can easily swap out the caps?
Anything in the range of 0.2 to 2 uF will help and multiple caps in parallel add up. For what you're doing, I don't see why a simple screw-in jig wouldn't work. Perhaps keep the wire leads from the sensor board to the jig as short as possible, 2" or less would be fine. If the noise is in any way reduced, it points towards a solution. As for PWM ... I think you want to be able to run the gun w/o any to get full speed so do the test with that. If you want also run it with the 86% (used in data set #4) as it produced cleaner looking data and we know the gearbox was happy with that. The RoF went from ~22 rps to 19.6 rps, not exactly a huge difference but as DK pointed out, about as expected.
  • 1
  • 11
  • 12
  • 13
  • 14
  • 15
  • 32