Skip to content

Commit bfb8ba1

Browse files
committed
Content update (context sections)
1 parent fed2db3 commit bfb8ba1

File tree

1 file changed

+67
-57
lines changed
  • content/hardware/03.nano/boards/nano-r4/tutorials/02.anomaly-detection-application-note

1 file changed

+67
-57
lines changed

content/hardware/03.nano/boards/nano-r4/tutorials/02.anomaly-detection-application-note/content.md

Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The main goals of this application note are the following:
3434
- Develop and implement a motor anomaly detection system that monitors vibration patterns in real-time using an analog accelerometer.
3535
- Collect and analyze vibration data from motors to establish baseline normal operation patterns and detect deviations.
3636
- Train a machine learning model using Edge Impulse for intelligent anomaly detection based on vibration signatures.
37-
- Deploy the trained model directly to the Nano R4 for real-time, on-device anomaly detection without cloud connectivity requirements.
37+
- Deploy the trained model directly to the Nano R4 board for real-time, on-device anomaly detection without cloud connectivity requirements.
3838
- Provide visual feedback through the board's built-in LED to indicate detected anomalies and system status.
3939
- Enable industrial predictive maintenance applications with cost-effective embedded intelligence.
4040

@@ -46,8 +46,8 @@ The main goals of this application note are the following:
4646
- [ADXL335 3-axis analog accelerometer breakout board](https://www.adafruit.com/product/163) (x1)
4747
- [USB-C® cable](https://store.arduino.cc/products/usb-cable2in1-type-c) (x1)
4848
- Breadboard and jumper wires for connections (x1 set)
49-
- Motor or rotating equipment for testing (e.g., small DC motor or fan) (x1)
50-
- Power supply appropriate for the motor (if required) (x1)
49+
- Motor or rotating equipment for testing purposes (for example, a small DC motor or fan) (x1)
50+
- Power supply appropriate for the motor or rotating equipment (if required) (x1)
5151

5252
### Software Requirements
5353

@@ -56,42 +56,46 @@ The main goals of this application note are the following:
5656
- [Edge Impulse account](https://studio.edgeimpulse.com/) (free tier available)
5757
- [Edge Impulse CLI tools](https://docs.edgeimpulse.com/docs/cli-installation) for data forwarding
5858

59-
***The Arduino Nano R4 features hardware specifications identical to the UNO R4 Minima, providing enhanced processing capabilities with a 32-bit Renesas RA4M1 microcontroller running at 48 MHz, 256 kB Flash memory, and 32 kB SRAM for efficient machine learning inference.***
59+
***The Nano R4 board provides enhanced processing capabilities with a 32-bit Renesas RA4M1 microcontroller running at 48 MHz, 256 kB Flash memory and 32 kB SRAM for efficient machine learning inference. For detailed hardware specifications, please refer to the Arduino Nano R4 documentation.***
6060

6161
## Hardware Setup Overview
6262

63-
The electrical connections for the motor anomaly detection system are outlined in the diagram below:
63+
The electrical connections for the motor anomaly detection system are outlined in the diagram shown below:
6464

6565
![The motor anomaly detection system hardware setup](assets/hardware-setup.png)
6666

67-
This diagram shows how the components are connected. The **Arduino Nano R4** serves as the **primary controller**, while the **ADXL335 accelerometer** collects 3-axis vibration data from the motor being monitored.
67+
This diagram shows how the system components are connected. The Nano R4 board serves as the **primary controller**, while the ADXL335 accelerometer collects **3-axis vibration data** from the motor being monitored.
6868

69-
The ADXL335 accelerometer connects to the Arduino Nano R4 using analog input pins. The system operates with a single power supply from the Arduino Nano R4 (+5V), which powers the ADXL335 through its onboard voltage regulator. The Arduino Nano R4 is powered via its onboard USB-C port for development and testing purposes.
69+
The ADXL335 accelerometer connects to the Nano R4 board using analog input pins. For this application note, the system uses an external +5 VDC power supply that powers both the Nano R4 and the test motor, while the ADXL335 is powered through its onboard voltage regulator from the board's +5 VDC pin.
70+
71+
***This power configuration is designed specifically for testing and demonstration purposes in this application note. In real industrial environments, proper power system design should consider factors such as electrical isolation, noise filtering, surge protection, and compliance with industrial safety standards appropriate for the specific application and operating environment.***
7072

7173
### Circuit Connections
7274

73-
The following connections establish the interface between the Arduino Nano R4 and ADXL335:
75+
The following connections establish the interface between the Nano R4 board and the ADXL335 accelerometer:
7476

75-
| ADXL335 Pin | Arduino Nano R4 Pin | Description |
76-
|-------------|---------------------|-------------|
77-
| VCC | 5V | Power supply |
78-
| GND | GND | Ground reference |
79-
| X | A0 | X-axis analog output |
80-
| Y | A1 | Y-axis analog output |
81-
| Z | A2 | Z-axis analog output |
82-
| ST | Not connected | Self-test (optional) |
77+
| **ADXL335 Pin** | **Nano R4 Pin** | **Description** |
78+
|:---------------:|:---------------:|:--------------------:|
79+
| `VCC` | `5V` | Power supply |
80+
| `GND` | `GND` | Ground reference |
81+
| `X` | `A0` | X-axis analog output |
82+
| `Y` | `A1` | Y-axis analog output |
83+
| `Z` | `A2` | Z-axis analog output |
84+
| `ST` | Not connected | Self-test (optional) |
8385

8486
### Physical Mounting Considerations
8587

86-
For effective vibration monitoring, proper mounting of the accelerometer is crucial. The accelerometer should be securely attached to the motor housing or equipment being monitored using appropriate mechanical fasteners. The mounting surface should provide good mechanical coupling to ensure accurate transmission of vibrations to the sensor.
88+
Proper accelerometer mounting is essential for effective vibration monitoring. The sensor must be securely attached to the motor housing or monitored equipment using suitable mechanical fasteners. A good mechanical coupling between the mounting surface and sensor ensures accurate vibration transmission and reliable measurements.
89+
90+
***For this application note, we will use a computer cooling fan to simulate motor operation and demonstrate the anomaly detection system. The ADXL335 accelerometer will be mounted on top of the fan using a custom 3D-printed enclosure, providing a stable and repeatable mounting solution for testing and demonstration purposes.***
8791

8892
## Understanding Motor Vibration Analysis
8993

90-
Motor vibrations contain valuable information about the mechanical condition of the equipment. Normal motor operation produces characteristic vibration patterns that remain relatively consistent during healthy operation. Abnormal conditions manifest as changes in vibration amplitude, frequency content, or temporal patterns.
94+
Motor vibrations contain valuable information about the mechanical condition of the equipment. Normal motor operation produces characteristic vibration patterns that remain relatively consistent during healthy operation. Abnormal conditions manifest as changes in vibration amplitude, frequency content or temporal patterns.
9195

9296
### Common Motor Faults
9397

94-
Motor faults that can be detected through vibration analysis include the following conditions:
98+
Typical motor faults that can be detected through vibration analysis include the following conditions:
9599

96100
- **Bearing wear**: Creates higher frequency components and increased overall vibration levels across all axes
97101
- **Misalignment**: Produces specific frequency signatures related to rotational speed, typically appearing in radial directions
@@ -101,27 +105,31 @@ Motor faults that can be detected through vibration analysis include the followi
101105

102106
### The Role of Sensors in Vibration Monitoring
103107

104-
This application note uses the ADXL335 analog accelerometer to provide accurate, real-time measurements of motor vibrations. The ADXL335 offers several advantages for this application:
108+
Effective motor condition monitoring relies on sensors capable of accurately detecting and measuring mechanical vibrations. These sensors must capture the subtle changes in vibration patterns that indicate developing faults or abnormal operating conditions. The choice of sensor technology directly impacts the system's ability to detect problems early and provide reliable maintenance insights.
109+
110+
This application note uses the [ADXL335 analog accelerometer](https://www.analog.com/media/en/technical-documentation/data-sheets/adxl335.pdf) to provide accurate, real-time measurements of motor vibrations. The ADXL335 offers several key advantages for motor monitoring applications:
105111

106-
- **3-Axis Measurement**: Captures vibrations in X, Y, and Z directions for comprehensive analysis
107-
- **Analog Output**: Direct compatibility with Arduino analog inputs without digital interface complexity
108-
- **Low Power Consumption**: Only 320 μA current consumption, suitable for continuous monitoring
109-
- **Wide Frequency Range**: 0.5 Hz to 1600 Hz bandwidth covers most motor fault frequencies
112+
- **3-Axis measurement**: Captures vibrations in X, Y, and Z directions
113+
- **Analog output**: Direct compatibility with the Nano R4 board analog inputs without requiring complex digital interfaces
114+
- **Low power consumption**: Only 320 μA current consumption makes it suitable for continuous monitoring applications
115+
- **Wide frequency range**: 0.5 Hz to 1600 Hz bandwidth covers most typical motor fault frequencies
110116

111-
The ADXL335 specifications include:
117+
The ADXL335 technical specifications include the following characteristics:
112118

113-
- **Measurement Range**: ±3g on all axes, suitable for most motor vibration levels
114-
- **Sensitivity**: 330 mV/g nominal, providing good resolution for vibration analysis
115-
- **Output**: Ratiometric analog voltages with 1.65V at 0g acceleration
116-
- **Power Supply**: 1.8V to 3.6V (regulated to 3.3V on breakout boards)
119+
- **Measurement range**: ±3g on all axes, appropriate for typical motor vibration levels
120+
- **Sensitivity**: 330 mV/g nominal sensitivity provides good resolution for vibration analysis
121+
- **Output**: Ratiometric analog voltages with +1.65 VDC representing 0g acceleration
122+
- **Power supply**: +1.8 to +3.6 VDC (regulated to +3.3 VDC usually on breakout boards)
117123

118-
Signal processing considerations include proper sampling rates based on expected frequency content, typically following the Nyquist criterion. The Arduino Nano R4's 14-bit ADC provides sufficient resolution for most vibration monitoring applications.
124+
Signal processing considerations include selecting appropriate sampling rates based on the expected frequency content of motor vibrations, typically following the Nyquist criterion to avoid aliasing. The Nano R4 board's 14-bit ADC provides enough resolution for most vibration monitoring applications.
119125

120126
## Simple Vibration Monitor Example Sketch
121127

122-
Now that we have covered the hardware components and vibration analysis fundamentals, let's examine the software that enables vibration data collection. The example sketch in this section manages data acquisition from the ADXL335 accelerometer connected to the Arduino Nano R4, allowing us to monitor real-time vibration data for baseline establishment and anomaly detection training.
128+
Now that we have covered the hardware components and vibration analysis fundamentals, let's examine the software that enables vibration data collection. Before implementing intelligent anomaly detection, we need to collect training data representing normal motor operation for Edge Impulse, a platform that simplifies embedded AI development.
123129

124-
This section breaks down the provided example sketch, guiding you through its functionality. We will explore how the accelerometer is initialized, how vibration data is collected at consistent intervals, and how the results are formatted for Edge Impulse data collection.
130+
Edge Impulse requires training data in a specific format to build effective anomaly detection models. Our data collection sketch formats the accelerometer readings so Edge Impulse can analyze normal operation patterns and create a model that identifies when new data deviates from these established patterns.
131+
132+
This section breaks down the provided example sketch, guiding you through its functionality. We will explore how the accelerometer is initialized, how vibration data is collected at consistent intervals and how the results are formatted specifically for Edge Impulse data collection and model training.
125133

126134
The complete example sketch is shown below.
127135

@@ -167,12 +175,13 @@ void setup() {
167175
Serial.begin(115200);
168176
169177
// Configure ADC for maximum resolution
170-
analogReadResolution(14); // Use 14-bit ADC resolution
178+
// Use 14-bit ADC resolution
179+
analogReadResolution(14);
171180
172181
// System ready message
173-
Serial.println("Motor Vibration Data Collector");
174-
Serial.println("Send 'start' to begin data collection");
175-
Serial.println("Data format: X_accel,Y_accel,Z_accel");
182+
Serial.println("- Motor Vibration Data Collector");
183+
Serial.println("- Send 'start' to begin data collection");
184+
Serial.println("- Data format: X_accel,Y_accel,Z_accel");
176185
177186
// Allow sensor to stabilize
178187
delay(1000);
@@ -212,8 +221,9 @@ void startDataCollection() {
212221
sampleCount = 0;
213222
lastSample = millis();
214223
215-
Serial.println("Starting data collection...");
216-
delay(100); // Brief delay before starting
224+
Serial.println("- Starting data collection...");
225+
Serial.println();
226+
delay(100);
217227
}
218228
219229
/**
@@ -224,9 +234,9 @@ void startDataCollection() {
224234
void stopDataCollection() {
225235
collectingData = false;
226236
Serial.println();
227-
Serial.print("Data collection stopped. Samples collected: ");
237+
Serial.print("- Data collection stopped. Samples collected: ");
228238
Serial.println(sampleCount);
229-
Serial.println("Send 'start' to collect another window");
239+
Serial.println("- Send 'start' to collect another window");
230240
}
231241
232242
/**
@@ -282,7 +292,7 @@ The following sections will help you understand the main components of the examp
282292

283293
### Hardware Configuration and Calibration
284294

285-
The first step involves configuring the Arduino Nano R4 for optimal accelerometer interfacing and establishing the ADXL335 calibration parameters.
295+
Before we can collect vibration data, we need to configure the Nano R4 board to properly interface with the ADXL335 accelerometer and establish its calibration parameters.
286296

287297
```arduino
288298
// Pin definitions for ADXL335 accelerometer
@@ -298,13 +308,13 @@ const float vRef = 3.3; // Reference voltage
298308

299309
In the code snippet shown above:
300310

301-
- Pin assignments define the analog inputs for each accelerometer axis
302-
- Sensitivity and zero-g voltage values are based on ADXL335 datasheet specifications
303-
- Reference voltage matches the accelerometer's regulated output voltage
311+
- Pin assignments map each accelerometer axis to specific analog inputs on the Nano R4
312+
- Sensitivity and zero-g voltage values come directly from the ADXL335 datasheet specifications
313+
- Reference voltage is set to match the accelerometer's regulated output voltage
304314

305315
### Data Collection Timing and Control
306316

307-
The sampling system ensures consistent data collection timing critical for vibration analysis and machine learning training.
317+
To ensure accurate vibration analysis and successful machine learning training, we need consistent data collection timing. These sampling parameters control how data is gathered:
308318

309319
```arduino
310320
// Sampling parameters for Edge Impulse
@@ -315,13 +325,13 @@ const unsigned long sampleInterval = 1000 / sampleRate; // 10ms between samples
315325

316326
In the code snippet shown above:
317327

318-
- Sample rate of 100 Hz provides adequate frequency response for most motor faults
319-
- Window size of 200 samples creates 2-second data segments suitable for Edge Impulse training
320-
- Sample interval calculation ensures precise timing between measurements
328+
- Sample rate of 100 Hz captures adequate frequency response for detecting most motor faults
329+
- Window size of 200 samples creates 2-second data segments that work well with Edge Impulse training
330+
- Sample interval calculation automatically determines the precise timing needed between measurements
321331

322332
### Signal Processing and Conversion
323333

324-
The conversion process transforms raw ADC readings into meaningful acceleration values for analysis.
334+
Once we have the raw sensor readings, we need to convert them into meaningful acceleration values. This conversion process transforms the ADC readings into data we can analyze:
325335

326336
```arduino
327337
void collectVibrationData() {
@@ -347,13 +357,13 @@ void collectVibrationData() {
347357

348358
In the code snippet shown above:
349359

350-
- Timing control ensures consistent sample intervals for proper frequency analysis
351-
- ADC conversion accounts for the Nano R4's 14-bit resolution (0-16383 range)
352-
- Acceleration calculation applies ADXL335 calibration parameters for accurate g-force values
360+
- Timing control maintains consistent sample intervals, which is essential for proper frequency analysis
361+
- ADC conversion takes into account the Nano R4's 14-bit resolution that ranges from 0 to 16383
362+
- Acceleration calculation applies the ADXL335 calibration parameters to get accurate g-force values
353363

354364
### Edge Impulse Data Formatting
355365

356-
The output formatting prepares data for direct use with Edge Impulse data collection tools.
366+
The final step formats our acceleration data so it can be easily used with Edge Impulse data collection tools:
357367

358368
```arduino
359369
// Output data in CSV format for Edge Impulse
@@ -366,11 +376,11 @@ The output formatting prepares data for direct use with Edge Impulse data collec
366376

367377
In the code snippet shown above:
368378

369-
- CSV format with four decimal places provides precision for machine learning training
370-
- Single-line output per sample enables easy integration with Edge Impulse data forwarder
371-
- Comma separation follows standard CSV conventions for data processing
379+
- CSV format with four decimal places gives us the precision needed for machine learning training
380+
- Single-line output per sample makes it easy to integrate with the Edge Impulse data forwarder
381+
- Comma separation follows standard CSV conventions that most data processing tools expect
372382

373-
After uploading the example sketch to the Arduino Nano R4, you should see the following output in the Arduino IDE's Serial Monitor when data collection is active:
383+
After uploading the example sketch to the Nano R4 board, you should see the following output in the Arduino IDE's Serial Monitor when data collection is active:
374384

375385
![Example sketch output showing vibration data collection](assets/data-collection-output.png)
376386

0 commit comments

Comments
 (0)