Você está na página 1de 50

Detecting Vibration and Chatter

Using Sensors and


Microcontrollers

UC Davis
Department of Mechanical Engineering
Submitted: 3.13.14
Alexander Fung
Babak Kianmajid
Raphael Zack

Table of Contents

Project Summary
The goal of this project was to develop a system that could detect chatter
vibrations during machining using low-cost sensors and microcontrollers. Initially, a
piezo vibration sensor, accelerometer, and microphone were going to be connected to
an Arduino Uno microcontroller and used to detect chatter vibration. However, the
accelerometer purchased was a small surface mount chip that could not easily be
soldered with wires to create the connection necessary to the Arduino Uno
microcontroller. Furthermore, the microphone selected required additional circuitry to
amplify and filter the signal which would require the use of operational amplifiers with
wide bandpass frequency ranges. Unfortunately, the group did not possess such
operational amplifiers, so a commercially available microphone with integrated gain
circuit was used instead. In addition, a Teensy 3.1 microcontroller was obtained and
integrated with the microphone. The piezoelectric vibration sensor that was purchased
required little in terms of circuitry. The readings appeared sensitive enough in testing to
not need gain in the circuit and so the fitting of the sensor onto the workpiece was the
larger concern.
The initial plan also called for being able to identify chatter in real-time which
would be accomplished by integrating additional open-source computer software with
the Arduino. In the case of the Teensy, a LCD would be used to display the FFT
spectrum plot and the chatter vibration frequency when chatter occurred. Both proved
to be difficult to apply as the open-source software only worked with specific versions
and operating systems while the LCD library did not work with the Teensy. Instead, the
data was transferred to a laptop where it was later analyzed using Matlab. The data
collected from the Teensy appeared in 256 point bursts sampled at 9000 Hz while the
data collected from the piezo vibration sensor was collected continuously at a sampling
rate of 3636 Hz.
To test the ability of the sensors to detect chatter, several experiments were
performed using a Bridgeport mill in the Engineering Fabrication Laboratory (EFL). As
the exact conditions to produce chatter were unknown, three different spindle speeds
and depths of cut parameters were used in different combinations on a 1045 aluminum
bar. The spindle speed ranged from 1500 to 2500 RPM, based on the limitations of the
Bridgeport milling machine. The depth of cut ranged from .05 to .2, based on our
desire to get chatter while not excessively wearing the tool. Eight cuts were performed
in total with both sensors collecting data simultaneously. Attempts were made to
standardize the distances between sensors and the cutting area across the different
tests. The vibration sensor was attached to the non-rotating part of the spindle and the
microphone was attached to a stand near the endmill.
The data collected needed to be preprocessed prior to analysis. A Hanning
window was used before performing a discrete Fourier transform to identify the
frequencies present in the signal. Due to the low sampling frequency of the piezo
vibration sensor, no chatter was identified. With the microphone, chatter was identified
in three trial runs. The chatter frequency varied from 3000-4000 Hz. The top five

recommended spindle speeds were calculated for each chatter run and varied from
2487 RPM to 2250 RPM in roughly 50 RPM increments.

Project Description
Chatter is a well known phenomenon where the interaction between the machine
tool and the workpiece generates self-excited vibrations which result in a poor surface
finish and increased tool wear. Therefore, it is critical to identify chatter immediately and
alter the machining parameters to eliminate it. Some machine tools are able to identify
chatter vibration and automatically adjust the spindle speed to stop it.
Chatter vibrations can be detected through sensors such as accelerometers and
acoustic sensors. The accelerometers can measure the vibrations of the machine tool
and identify when chatter is occurring. Acoustic sensors such as a microphone can
detect the audio sounds generated by the chatter vibration [Sekhon].
For this project, the group wanted to determine if they could detect chatter
vibrations during machining using low-cost microcontrollers and sensors that are readily
available for non-commercial uses such as with hobbyists. The sensors selected
consisted of an accelerometer, piezo vibration sensor, and microphone while the
microcontrollers consisted of an Arduino Uno and a Teensy 3.1. The accelerometer and
vibration sensor were planned to be attached to the machine tool while the microphone
collected the acoustics of the machining process. The accelerometer purchased was a
triple-axis MPU-6050 that had a bandwidth of 2000 Hz. Unfortunately, the
accelerometer was a surface mount integrated circuit without a breakout board. Given
the small size of the accelerometer, soldering wires to it was not a viable option so it
could not be integrated with the microcontrollers and was not used. The piezo vibration
sensor (Spark Fun Electronics SEN-09196) selected outputs a voltage that is
proportional to the amount it is deflected, see Figure ###. For example, a 2 mm
deflection will produce a 7V output while a 90 degree deflection will produce >70V
output.

Figure ### (Spark Fun Electronics SEN-09196)


The piezo vibration sensor was connected to an Arduino Uno. The Arduino Uno
utilizes an 8-bit Atmel AVR microcontroller and 10 bit analog to digital converters. The
Arduino has an easy-to-use programming interface and can be powered and do serial
communication through a USB connection.
The microphone selected for the project is a generic CZN-15E omnidirectional
electret condenser microphone which has a bandpass frequency range of 20-16000 Hz.
The output of the microphone is on the order of millivolts; therefore an amplifier circuit is
required to increase the signal to levels that the microcontroller can distinguish.
However, the amplifier circuit requires the use of an operational amplifier. The available
op-amps did not have the necessary bandpass frequency range for audio signals. As a

result, a different microphone had to be used which was an electret microphone with
adjustable amplifier sold by Adafruit (part number 1063) shown in Figure ###. This part
comes with an electret condenser microphone with a slightly wider bandpass frequency
of 20-20000 Hz and an adjustable gain that amplifies the signal by a factor 25-125. This
part also introduces a DC offset centered at half of the input voltage.

Figure ###: Adafruit electret microphone with adjustable gain


The Teensy 3.1 microcontroller was used with the microphone. The Teensy 3.1
uses a 32 bit ARM Cortex microprocessor, has 64 Kb of RAM, and has a 50 MHz clock
speed. This makes it significantly more powerful than the Arduino Uno which uses an 8
bit ATmega328 microcontroller, has 2 Kb of RAM, and has a 16 MHz clock speed. As a
result, the Teensy is capable of performing discrete Fourier transforms which would
enable the chatter detection system to operate without a laptop as long as there is
another way to display the information. A ks0108 liquid crystal display (LCD) was
initially planned to interface with the Teensy; however, the various libraries developed
for using LCDs had not yet been updated to interface with the Teensy 3.1. Attempts
were made to adapt the library for the Teensy 3.1; however, the resulting modifications
only resulted in assembly code errors. Given the limited time frame for the project, the
LCD was abandoned in favor of the computer.
Several software languages such as Processing and Python had open-source
code generated from projects that enabled the real-time frequency analysis; however,
these required the use of numerous add-on and additional libraries that all had their own
unique specifications for working. Debugging errors proved to be difficult as it could not
be easily determined where the error originated from. Once again, due to time
limitations, a simpler option was selected in which data was transferred from the
microcontrollers to the computer through serial port communication.

Figure XXX
For the vibration sensor/Arduino combination, 192 data point blocks (selected
based on the total number of data points and desired resolution) were created by
separating the data points into groups after they had been transmitted to the computer.
The data sampled from the sensor at 3636 Hz and so the resulting frequency resolution
from the artificial grouping was about 19 Hz. A timer interrupt function was used based
on the real time clock to transmit the data (also used as the basis for the frequency
values). From there it was fed through a circular buffer before accessing the serial
communication at the baud rate. Hyper Terminal software was used as a serial monitor
for the string data (as opposed to the more efficient character bytes), which permitted
copying into any software as shown in Figure XXX. The 3636 Hz frequency was at
about the maximum that the Arduino could handle without freezing the data collection.
The Teensy sampled at 9000 Hz in 256 data point blocks which resulted in a
frequency resolution of 35 Hz. While the Teensy was able to sample at a higher rate, it
could not store more data points which would have resulted in a poorer frequency
resolution. Furthermore, 9000 Hz is approximately the maximum sampling frequency of
the Arduino if the code is optimized which meant that the results generated by the
Teensy could theoretically be generated by the Arduino. The data blocks generated
were transmitted to a laptop through serial communication where the data was stored in
a text file to be analyzed by Matlab at a later time. To simplify the data collection on the
Teensy circuit, a push button was added which enabled data to be recorded (to a visibile
serial monitor) only when the push button was engaged to prevent an overflow of data
containing no experimental information. Furthermore, an LED circuit was included to
indicate if the microphone maxed out its operating voltage range of 3.3 V. Thus, if the
microphone reached 0 or 3.3V, the LED would turn on to suggest decreasing the gain.
During all of the experiments, the LED never turned on. Also, a passive low-pass filter
was added to the microphone circuit using a 33k Ohm resistor and a 1000 pF capacitor.
These components resulted in a cutoff frequency of 4823 Hz. The Teensy circuit is
shown in Figure ###.

Figure ###: Teensy circuit setup

Experimental setup
As the group was uncertain at precisely what machining parameters would
produce chatter, several different combinations of different spindle speeds and depths of
cut were used. As all machining was done in the Engineering Fabrication Laboratory
(EFL), the range in varying the machining parameters was limited. The experiments
were performed at parameters that were around the maximum recommended by the
EFL which consisted of spindle speeds between 1500 and 2500 RPM and depths of cut
between 0.05 and 0.2. A total of 8 different combinations were tested and are
summarized in Table XXX.
Table XXX: Machining Test Parameters

All of the tests were performed using a Bridgeport Mill with a 2 flute diameter
endmill with a feedrate of 5 per minute. The workpiece was a single piece of 2x4x8
1045 aluminum stock which was held by a vice grip and extended 1 past it as shown in
Figure XXX. Each edge was planned to have a total of 2 one inch length cuts 1 apart
from each other for a total of 8 cuts. However, piezo vibration data was not collected
during Test 3 so a second run needed to be done which resulted in an extra cut on one

edge.
Figure XXX
The microphone sensor was placed 1 from the edge of the workpiece while the piezo
vibration sensor was placed above the rotating spindle (Figure XXX). When it appeared
that the vibration was not picking up data, it was lowered to be closer to the machine
tool but only after it had accidently been placed on the rotating spindle, Figure XXX.

Figure XXX

Figure XXX

Figure XXX
For the data analysis, both the microphone and piezo vibration sensor data first
used a Hanning window to prevent frequency leakage from occurring in the discrete
Fourier transform. For the microphone data, after the discrete Fourier transform was
performed, the data was trimmed to remove the DC offset and end-of-run noise. After
visually inspecting the resulting frequency data, a threshold magnitude of 45 was
selected to determine if chatter had occurred. For ease of calculation, the chatter
frequencies that were detected were averaged together to obtain the test chatter
frequency; however, the first chatter frequency detected was excluded from the average
because it was typically 1000 Hz above the remaining detected chatter frequencies.
Once the chatter frequency was determined, the recommended spindle speed was
calculated using the following equation:

where c is the chatter frequency and N is the number of flutes, two in this case, on the
endmill. If this RPM was above the maximum spindle speed, in this case 2500 RPM,
then the following equation was used.

where i is an integer starting with 2 and increasing by 1 until a suitable spindle speed
was found. The first five recommended spindle speeds were determined to identify the
tolerance of selecting a suitable spindle speed.

Results and Discussion


Test cuts (Figure XXX) show various depths of cut on the test metal.

Figure XXX
Microphone Data
From the microphone data, three runs were determined to have chatter. These
runs were trials 1, 6 and 7 whose discrete Fourier transforms are shown in Figures ######.

Additionally, two other runs had initial chatter which dissipated once the tool was fully
engaged in the workpiece shown in figures ### and ###. Figures depicting all of the
raw data of the runs and the discrete Fourier transforms of the runs are in the Appendix.
The runs with chatter are summarized in the table below.
Table ##:
Trial
Trial
Number Conditions
1
1500 RPM
0.05 Depth
6
2500 RPM
0.05 Depth
7
2500 RPM

Minimum Chatter
Frequency [Hz]
3375

Maximum Chatter
Frequency [Hz]
4184

Average Chatter
Frequency [Hz]
3939

3340

4184

2885

2988

3340

3150

0.125 Depth
Despite the noise present in the EFL, the data collected by the microphone is
predominantly coming from the machining process. As evident in figures ###-###, there
are a number of samples in the beginning of each test that contain no high frequency
information. These sample numbers correspond to the time it took for the tool piece to
move and engage the workpiece. Therefore, the tool was not engaged to the workpiece
at these times and the microphone is picking up the background noise. While the group
was in the EFL, every available machine tool was being used which generated
significant noise. However, this noise largely appeared to be concentrated at the lower
frequencies as the background noise) is consistently below 1000 Hz.
All of the chatter collected occurs between 3000 and 4000 Hz. This is a region
that the sensor amplifies naturally. It is possible that chatter detected is the solely the
result of this amplification. However, the passive filter attached to the microphone
circuit should have negated most of the gain in this region. Additional frequency testing
of the microphone by itself or in parallel with a different microphone would be required
to determine if this actually was a factor.
From the chatter runs, the recommended spindle speeds were determined and
are summarized in the table below.
Table ##:
Trial
Number

Trial
Conditions

1st Spindle
Speed
[RPM]

2nd Spindle
Speed
[RPM]

3rd Spindle
Speed
[RPM]

4th Spindle
Speed
[RPM]

5th Spindle
Speed
[RPM]

1500 RPM
0.05 Depth

2462

2412

2363

2317

2273

2500 RPM
0.05 Depth

2480

2428

2389

2331

2286

2500 RPM
0.125 Depth

2487

2423

2363

2305

2250

The five calculated spindle speeds for each chatter vibration frequency are
separated by less than 60 RPM from the corresponding lower spindle speed. The small
differences are the result of the high frequency of the chatter and the relatively low
operating speeds of the mills. Thus, n(1) needs to be divided by integers on the order
of 40 to obtain operational spindle speeds. This high frequency chatter could be an
indication that the stability lobes in this range of spindle speeds are closely spaced such
that with a small change in spindle speed the cutting can vary from a stable to an
unstable and back to a stable region. Given that the Bridgeport mills have analog
speed control with marking only every 100 RPM, it is highly unlikely that an operator will
be able to adjust the RPM to speed that would prevent chatter in this region.

Vibration Data
While the microphone data was able to show hints and declarations of chatter,
the vibration data showed much in the frequency response. In Figure XXX from Test 1, it
is clear that there is very little activity other than a disturbance at a very small frequency.
In Figure XXX from Test 5, there is more activity between 0 and 500 Hz but chatter is
expected at higher frequencies, as shown in the microphone data. It seems that with an
increased frequency range, there would be a greater likelihood of picking up chatter. It
could also be that amplification, another measuring position or a different sensor would
better demonstrate chatter.
The raw voltage bit data did show the beginning of cuts for some of the tests.
Figure XXX showed how at 1.5 seconds, the sensor felt the strongest vibration,
presumably when the tool connected with the workpiece. Further spindle speed
calculations were not possible since chatter frequencies were not detected.

Figure XXX

Figure XXX

Figure XXX

Unexpected difficulties were observed during the initial portions of testing as well
as during the later stages. The Teensy microprocessor arbitrarily did not connect to
multiple computers on the first day of testing (while working fine the next day after
reloading the code). Another issue was having enough battery power to last during data

accumulation. If a computer with longer battery life is used or if the machining area is
next to an electrical source, then this can easily be overcome. Sensor placement can be
a nuisance depending on how much workspace is available - shields need to be used to
protect the electrical equipment. While the microphones placement was pretty clear
(the focus there was keeping as much noise out of its acoustic path), it was unclear
where the best location would be to pick up chatter. This project tested the vibration
sensor on the tool - further work could look at basing it at the workpiece. Furthermore,
much of the setup used would not be viable if coolant was being used as it would likely
ruin the laptops. In such a case, using a different method of displaying the results such
as an LCD would enable placing the majoring of the components out of the way of any
chips or coolant. While the Teensy was successful in reaching acceptable frequencies,
we were not able to replicate this with the Arduino. Therefore, the piezoelectric vibration
sensor may be useful in chatter scenarios, but this would need to be shown at the right
sampling rate.

Conclusion
This project attempted to detect chatter vibrations during machining and was
moderately successful. The microphone was able to pick up chatter during machining;
however, the piezo vibration sensor was unable to due to a lower sampling rate and
signal amplitude. This shows promise for being able to use these level of sensors and
microcontrollers in various machining scenarios. While this project did not incorporate
the tool parameters necessary to calculate the stability lobes, the chatter frequencies
were used to obtain more optimal spindle speeds. If this is sufficient for a users needs,
then implementation and cost of this type of a setup could be quite convenient. And if
stability lobes are needed, then additional equipment, such as the CutPro, could be
used to obtain the necessary cutting coefficient.
This work could be furthered by looking to improve the accuracy, simplicity and
interactivity. By taking advantage of the Teensys capabilities, FFT processing could be
done in real time to immediately assess chatter. While the microphone has shown some
strength as a standalone sensor, combining it with the vibration on the same
microprocessor would keep the amount of equipment down and use the same timer.
There was also a heavy amount of zero values in some of the vibration data and this
could have been aided by amplification. These inexpensive components can truly be
utilized to reduce chatter in a quick manner.

References
Y. Altintas and M. Weck, Chatter stability of metal cutting and grinding, CIRP
Annals-Manufacturing Technology, vol 53, no. 2, p. 619-642, 2004.
G.S. Sekhon, Monitoring and Control of Machining Operations, M.S. Thesis,
Mechanical Eng., University of British Columbia, Vancouver, Aug. 2013.
Measurement Specialties, LDT with Crimps Vibration Sensor/Switch, LDT0-028K
datasheet. Oct. 13, 2008.
CUI Inc., Electret Condenser Microphone, CMA-4544PF-W datasheet. June, 2008.
S.A. Tobias, Machine Tool Vibration. University of Michigan:Blackie and Sons, 1965.
PJRC, Teensy 3.1. Available: [https://www.pjrc.com/teensy/teensy31.html] (Accessed
March 12, 2014).
M. Banzi, Getting Started with Arduino. Maker Media, Sept. 20, 2011.

Appendix
Vibration Analysis Code
%Import Vibration Chatter Data and Perform FFT
%
% after transpose of RawData, numpoints is the number of rows of RawData
clc
close all
clear all
%Import Parsed Data, Transpose as FFT works along created columns
RawData=importdata('test8_parse.txt',',')';
sampling_Freq=3636.3636; % .000275 second period
nRows = 192; % decided as sample block
counter = 1;
numpoints = length(RawData); % total number of data points
numpointsvec = 1:numpoints;
figure(1)
plot(numpointsvec,RawData)
xlabel('Data Point')
ylabel('Bit')
title('Test 8: 1500 RPM, 0.05" Depth of Cut: Raw Data')
nColumns = floor(numpoints/nRows);
%Window Data
WindowDataHan=zeros(nRows,nColumns); % initializing windows
WindowDataHam=zeros(nRows,nColumns);
%Hanning Window
for j=1:nColumns
for i=1:nRows
counter = counter + 1;
WindowDataHan(i,j)=RawData(counter)*(cos(pi*(2*i-nColumns)/
(2*nColumns))^2); % switched from nColumns
end
end
%Hamming Window, written but did not use
for j=1:nColumns
for i=1:nRows
WindowDataHam(i)=0.92*RawData(i)*(cos(pi*(2*i-nColumns)/
(2*nColumns))^2)+0.08;
end
end

Y=fft(WindowDataHan(:,:)/nRows); %Scale FFT by number of points


f = sampling_Freq/2*linspace(0,1,nRows/2+1)'; %Generate Sampling frequency vector
TrialVector = 1:(nColumns)';
[T,F]=meshgrid(TrialVector,f);
Y2(:,:)=2*abs(Y(floor(1:(nRows/2+1)),:));
figure(2)
surf(F,T,Y2)
xlabel('Frequency (Hz)')
ylabel('Block of Data Points')
zlabel('Amplitude')
title('Test 8: 1500 RPM, 0.05" Depth of Cut: FFT')
shading interp
Code that parsed initial vibration data into new text files:
%parameters
clc
clear
open_str='test8.txt';
new_str='test8_parse.txt';
fid = fopen(open_str,'r');
pars = fopen(new_str,'w');
coma=0;
while ~feof(fid)
a = fgets(fid, 1);
if (a<48 || a>57)
if coma~=1;
fwrite(pars,44,'char');%coma
coma=1;
end
else
coma=0;
fwrite(pars,a,'char');
end
end
fclose(fid);
fclose(pars);
M = csvread(new_str);
plot(M)

Microphone Raw Data Figures

Vibration Raw Data Figures

Microphone Raw FFT Data

Vibration Raw FFT Data

FFT Flat Plots

Microphone Trimmed FFT

Você também pode gostar