Reading 3-Axis Vibration Data with Arduino and RS485 Using SN-3003-WZ-N01 Sensor
Reading 3-Axis Vibration Data with Arduino and RS485 Using SN-3003-WZ-N01 Sensor
This guide covers using the SN-3003-WZ-N01 RS485 vibration sensor with Arduino. This industrial-grade sensor is designed for Predictive Maintenance applications, measuring velocity, acceleration across 3 axes, and temperature via Modbus RTU protocol.
Required Components
- Arduino UNO R3 with USB cable
- MAX485 RS485 to TTL module
- SN-3003-WZ-N01 sensor with magnetic mount
- 12V 5A adapter for sensor power supply
- 9V 2A adapter for Arduino
- 128x64 I2C OLED display 0.96 inch
- Breadboard 830 points
- Jumper wires: Male-Male, Male-Female, Female-Female (40 each)
- Quick wire connectors PCT-222
Wiring Diagram
Connect MAX485 to Arduino
| Arduino | MAX485 | Function |
|---|---|---|
| 5V | VCC | Module power |
| GND | GND | Common ground |
| Pin 2 | RO | Receive Output (RX) |
| Pin 3 | DI | Data Input (TX) |
| Pin 7 | DE | Driver Enable |
| Pin 8 | RE | Receiver Enable |
Connect MAX485 to SN-3003-WZ-N01
- MAX485 B terminal → Blue wire from sensor
- MAX485 A terminal → Yellow wire from sensor
Power the SN-3003-WZ-N01
- Brown wire → +12V positive
- Black wire → GND negative
Note: The sensor requires separate 12V power supply, not from Arduino.
Connect OLED to Arduino
- 5V → VCC
- GND → GND
- A4 → SDA
- A5 → SCL
Installing Required Libraries
Download the custom library from the original article link, which includes modified OLED and SoftwareSerial libraries optimized for this project. Extract and place the folder in your Arduino IDE’s libraries directory.
Location: This PC > Documents > Arduino > libraries
Arduino Code for Reading Modbus RTU Data
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SENSOR_TX_PIN 3
#define SENSOR_RX_PIN 2
#define DE_PIN 7
#define RE_PIN 8
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
SoftwareSerial sensorSerial(SENSOR_RX_PIN, SENSOR_TX_PIN);
byte modbusFrame[50];
void setup() {
Serial.begin(9600);
sensorSerial.begin(9600);
pinMode(DE_PIN, OUTPUT);
pinMode(RE_PIN, OUTPUT);
digitalWrite(DE_PIN, LOW);
digitalWrite(RE_PIN, LOW);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.display();
delay(2000);
display.clearDisplay();
}
void loop() {
requestSensorData();
delay(1000);
}
void requestSensorData() {
// Enable Driver mode for sending request
digitalWrite(DE_PIN, HIGH);
digitalWrite(RE_PIN, HIGH);
// Modbus RTU Read Holding Registers
// Function Code 0x03, Address 0x0000-0x0006
byte request[] = {0x01, 0x03, 0x00, 0x00, 0x00, 0x07, 0x04, 0x0D};
// slave ID=1, FC=03, start address=0, quantity=7 registers, CRC
sensorSerial.write(request, sizeof(request));
sensorSerial.flush();
// Disable Driver, Enable Receiver
digitalWrite(DE_PIN, LOW);
digitalWrite(RE_PIN, LOW);
delay(100);
int bytesReceived = sensorSerial.available();
if (bytesReceived >= 19) {
for (int i = 0; i < bytesReceived; i++) {
modbusFrame[i] = sensorSerial.read();
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
// Parse temperature (register 0)
float temp = (modbusFrame[3] << 8) | modbusFrame[4];
temp = temp / 100.0;
// Parse velocity X, Y, Z (registers 1-6)
float velX = ((modbusFrame[5] << 8) | modbusFrame[6]) / 100.0;
float velY = ((modbusFrame[7] << 8) | modbusFrame[8]) / 100.0;
float velZ = ((modbusFrame[9] << 8) | modbusFrame[10]) / 100.0;
// Parse acceleration X, Y, Z (registers 7-12)
float accX = ((modbusFrame[11] << 8) | modbusFrame[12]) / 1000.0;
float accY = ((modbusFrame[13] << 8) | modbusFrame[14]) / 1000.0;
float accZ = ((modbusFrame[15] << 8) | modbusFrame[16]) / 1000.0;
// Display on Serial Monitor
Serial.print("Temp: ");
Serial.print(temp, 2);
Serial.println(" C");
Serial.print("Velocity X: ");
Serial.print(velX, 2);
Serial.print(" Y: ");
Serial.print(velY, 2);
Serial.print(" Z: ");
Serial.println(velZ, 2);
Serial.print("Acc X: ");
Serial.print(accX, 3);
Serial.print(" Y: ");
Serial.print(accY, 3);
Serial.print(" Z: ");
Serial.println(accZ, 3);
// Display on OLED
display.setCursor(0, 0);
display.println("Vibration Sensor");
display.println("----------------");
display.print("Temp: ");
display.print(temp, 1);
display.println(" C");
display.print("Vel X:");
display.print(velX, 1);
display.print(" Y:");
display.print(velY, 1);
display.print(" Z:");
display.println(velZ, 1);
display.print("Acc X:");
display.print(accX, 2);
display.print(" Y:");
display.print(accY, 2);
display.print(" Z:");
display.println(accZ, 2);
display.display();
}
}
Note: This is a template code. You must verify and adjust Modbus address and Register mapping according to the actual SN-3003-WZ-N01 datasheet before production use.
Assembly Process
Upload and Test Procedure
- Open Arduino IDE and paste the code above
- Select Board: Arduino UNO
- Select the correct Port
- Upload the code
- Open Serial Monitor and set Baud rate to 9600
- Observe values on both Serial Monitor and OLED display
Testing with Hair Dryer
Place a hair dryer on a flat surface and direct warm air toward the sensor’s magnetic mount. You should see temperature values increase, and velocity/acceleration readings across 3 axes change according to the vibration applied.
Important Notes
- Keep 12V power supply for sensor separate from Arduino
- Always connect GND together across all components (Arduino, MAX485, adapter)
- RS485 wiring follows the color code (blue=B, yellow=A) - do not swap them
Reference Video
อยากทำโปรเจคแบบนี้?
รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน
If you need Arduino project service or urgent IoT development, see full service details on the home page
จ้างทำโปรเจคเลย