Before diving into the code, it is vital to understand the pinout and operational modes of the JDY-40. The module features 8 pins, but for standard Arduino serial communication, you only need to focus on a few key connections. Pinout Configuration
#include <SoftwareSerial.h>
Quick recommendation
Set Module B (Slave) Device ID: AT+DVID1111 (Must match the Master) Set Channel: AT+RFID2222 (Must match on both modules) Set Baud Rate to 9600: AT+BAUD4
The module has basic pins that interface easily with any Arduino board:
Most "bad examples" fail because of power instability. The JDY-40 runs on . While some modules tolerate 5V, to get the best performance, use a level shifter or a 3.3V Arduino board (like the Pro Mini 3.3V).
Strengths
#include <SoftwareSerial.h>
is a . While some users report success with 5V, it is safest to use a 3.3V power source to avoid damaging the chip. Arduino Pin Description 3.3V Power (2.2V - 3.6V) GND Common Ground RX (e.g., D2) Connect to Arduino's SoftwareSerial RX TX (e.g., D3) Connect to Arduino's SoftwareSerial TX GND / High GND for AT commands; High/Floating for data transmission GND GND to keep the module awake Best Arduino Example Code
To prevent interference with the hardware serial port (used for uploading code to the Arduino), we use SoftwareSerial to configure and test the module. JDY-40 Pin Arduino Uno Pin Do not use 5V Common ground Pin 2 (Rx) Directly connected Pin 3 (Tx) Use a 1kΩ / 2kΩ resistor voltage divider Used to toggle AT mode Module always enabled Part 1: Configuring the JDY-40 with AT Commands
Before diving into the code, it is vital to understand the pinout and operational modes of the JDY-40. The module features 8 pins, but for standard Arduino serial communication, you only need to focus on a few key connections. Pinout Configuration
#include <SoftwareSerial.h>
Quick recommendation
Set Module B (Slave) Device ID: AT+DVID1111 (Must match the Master) Set Channel: AT+RFID2222 (Must match on both modules) Set Baud Rate to 9600: AT+BAUD4
The module has basic pins that interface easily with any Arduino board: jdy40 arduino example best
Most "bad examples" fail because of power instability. The JDY-40 runs on . While some modules tolerate 5V, to get the best performance, use a level shifter or a 3.3V Arduino board (like the Pro Mini 3.3V).
Strengths
#include <SoftwareSerial.h>
is a . While some users report success with 5V, it is safest to use a 3.3V power source to avoid damaging the chip. Arduino Pin Description 3.3V Power (2.2V - 3.6V) GND Common Ground RX (e.g., D2) Connect to Arduino's SoftwareSerial RX TX (e.g., D3) Connect to Arduino's SoftwareSerial TX GND / High GND for AT commands; High/Floating for data transmission GND GND to keep the module awake Best Arduino Example Code Before diving into the code, it is vital
To prevent interference with the hardware serial port (used for uploading code to the Arduino), we use SoftwareSerial to configure and test the module. JDY-40 Pin Arduino Uno Pin Do not use 5V Common ground Pin 2 (Rx) Directly connected Pin 3 (Tx) Use a 1kΩ / 2kΩ resistor voltage divider Used to toggle AT mode Module always enabled Part 1: Configuring the JDY-40 with AT Commands