Jdy40 Arduino Example Best Jun 2026

The JDY-40 is a highly efficient 2.4GHz wireless transceiver module favored for its simplicity, as it operates as a standard UART serial bridge . Unlike the more complex NRF24L01, it does not require specialized libraries for basic communication, making it an excellent choice for beginner Arduino projects like remote sensor reporting or wireless robots.   Quick Review & Specifications   Ease of Use : It functions as a "wireless wire." Data sent into one module's RX pin appears on the other module's TX pin. Range : Up to 120 meters in open areas. Power : Operates at 2.2V – 3.6V (3.3V is ideal). It is ultra-low power, with sleep modes consuming only 5µA . Modes : Supports transparent serial transmission (default) and a remote control mode where the 8 GPIO pins can be used without an external microcontroller.   Arduino Connection Example   To use the JDY-40 with an Arduino, you must ensure you are using 3.3V logic levels or a level shifter, as the module is not 5V tolerant.   Как работать с беспроводным модулем jdy-40 и ардуино?

Comprehensive Guide to the JDY-40 Wireless Transceiver with Arduino The JDY-40 is a cost-effective, high-performance 2.4GHz wireless serial port module. It operates on the same frequency band as Wi-Fi and Bluetooth but utilizes a proprietary protocol optimized for low power consumption and simplicity. This guide provides the best, production-ready Arduino examples for the JDY-40, covering basic point-to-point communication, AT command configuration, and multi-node networking. Technical Specifications and Pinout Before writing code, it is essential to understand the hardware. The JDY-40 operates within a 2.2V to 3.6V range and features a transmission range of up to 120 meters in open space. Module Pin Configuration Description VCC Power Supply 2.2V - 3.6V (Do not connect directly to 5V Arduino VCC) GND Connect to Arduino GND TXD Serial Transmit Connect to Arduino RX (Use logic level shifter if 5V) RXD Serial Receive Connect to Arduino TX (Use logic level shifter if 5V) SET Mode Configuration Pull LOW for AT Command mode; pull HIGH/Floating for Communication mode CS Chip Select / Sleep Pull LOW to enable module; pull HIGH to enter deep sleep mode Wiring the JDY-40 to Arduino Because the JDY-40 is a 3.3V logic device, connecting it directly to a 5V Arduino Uno or Nano can damage the module or cause unstable behavior. Always use a logic level converter or a resistor voltage divider on the Arduino TX to JDY-40 RX line. Arduino Uno/Nano 5V Voltage Divider JDY-40 Module ------------------- --------------- ------------- 3.3V ---------------------------------------------------> VCC GND ---------------------------------------------------> GND Pin 2 (Software RX) [ 1kΩ Resistor ] ---> Pin RXD | [ 2kΩ Resistor ] | GND Pin 4 (GPIO Setup) ------------------------------------> SET Pin 5 (GPIO Sleep) ------------------------------------> CS Master Configuration: AT Commands via Arduino To ensure two JDY-40 modules communicate effectively, they must share the same Wireless Channel (RFID) and Device ID (D_ID) . This sketch programmatically configures the module using SoftwareSerial. #include #define JDY_RX 2 #define JDY_TX 3 #define JDY_SET 4 #define JDY_CS 5 SoftwareSerial jdySerial(JDY_RX, JDY_TX); void sendATCommand(const char* command) { jdySerial.println(command); delay(100); while (jdySerial.available()) { Serial.write(jdySerial.read()); } Serial.println(); } void setup() { Serial.begin(9600); jdySerial.begin(9600); pinMode(JDY_SET, OUTPUT); pinMode(JDY_CS, OUTPUT); // Activate module and enter AT mode digitalWrite(JDY_CS, LOW); digitalWrite(JDY_SET, LOW); delay(200); Serial.println("--- Configuring JDY-40 ---"); sendATCommand("AT+BAUD4"); // Set baud rate to 9600 sendATCommand("AT+RFID12345678"); // Set unique network ID (Must match receiver) sendATCommand("AT+D_ID1122"); // Set Device ID sendATCommand("AT+POWE9"); // Set max transmit power (+12dBm) sendATCommand("AT+CLSSA0"); // Set as transparent transmission device // Return to transparent communication mode digitalWrite(JDY_SET, HIGH); Serial.println("--- Configuration Complete. Communication Mode Active ---"); } void loop() { // Pass-through loop for manual debugging via Serial Monitor if (Serial.available()) { jdySerial.write(Serial.read()); } if (jdySerial.available()) { Serial.write(jdySerial.read()); } } Use code with caution. Best Example: Robust Transmitter Code This transmitter code reads a sensor value (simulated via an analog pin) and packs it into a structured, delimited string format. Sending data with start and end markers prevents packet fragmentation issues over the air. #include #define JDY_RX 2 #define JDY_TX 3 SoftwareSerial jdySerial(JDY_RX, JDY_TX); const int sensorPin = A0; unsigned long previousMillis = 0; const long interval = 1000; // Send data every 1 second void setup() { Serial.begin(9600); jdySerial.begin(9600); pinMode(sensorPin, INPUT); Serial.println("Transmitter Ready."); } void loop() { unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; int sensorValue = analogRead(sensorPin); // Construct packet: jdySerial.print(" "); // Local debug monitoring Serial.print("Sent telemetry: "); Serial.println(sensorValue); } } Use code with caution. Best Example: Robust Receiver Code The receiver code uses a state-machine parser to listen specifically for the incoming packet markers ( and > ). This guarantees parsing accuracy even if interference introduces random bytes into the serial line. #include #define JDY_RX 2 #define JDY_TX 3 SoftwareSerial jdySerial(JDY_RX, JDY_TX); const byte numChars = 32; char receivedChars[numChars]; boolean newData = false; void setup() { Serial.begin(9600); jdySerial.begin(9600); Serial.println("Receiver Ready. Waiting for data..."); } void loop() { receiveWithMarkers(); processNewData(); } void receiveWithMarkers() { static boolean recvInProgress = false; static byte ndx = 0; char startMarker = ' '; char rc; while (jdySerial.available() > 0 && newData == false) { rc = jdySerial.read(); if (recvInProgress == true) { if (rc != endMarker) { receivedChars[ndx] = rc; ndx++; if (ndx >= numChars) { ndx = numChars - 1; } } else { receivedChars[ndx] = '\0'; // Terminate the string recvInProgress = false; ndx = 0; newData = true; } } else if (rc == startMarker) { recvInProgress = true; } } } void processNewData() { if (newData == true) { Serial.print("Raw Packet Received: "); Serial.println(receivedChars); // Parse the CSV data char *strtokIndx; strtokIndx = strtok(receivedChars, ","); // Skip the header label "DATA" if (strcmp(strtokIndx, "DATA") == 0) { strtokIndx = strtok(NULL, ","); // Get the actual numeric payload int parsedValue = atoi(strtokIndx); Serial.print("Parsed Sensor Value: "); Serial.println(parsedValue); // Perform actions based on value (e.g., trigger alarm, update display) } newData = false; } } Use code with caution. Advanced Architecture: Multi-Node Addressing When building networks with more than two devices, change the device type configuration command to AT+CLSSA1 or AT+CLSSA2 . This shifts the module out of transparent broadcast mode into an addressed mode, where packets are prefixed with a specific Device ID ( D_ID ). The module will automatically discard any packets that do not explicitly match its own hardcoded D_ID , reducing overhead processing on your host Arduino microcontrollers. To ensure this setup works smoothly for your specific project, tell me: What distance range do you need to achieve between your modules? What type of data are you transmitting (e.g., sensor metrics, motor controls, text strings)? Are you connecting to a 5V Arduino (like the Uno) or a 3.3V board (like the ESP32)? Share public link This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later.

The JDY-40 is a cheap, versatile 2.4GHz wireless serial port module. It works over distances up to 120 meters. It is ideal for Arduino projects like remote controls and sensor networks. This guide covers everything you need to know about the JDY-40. You will learn how it works, how to configure it with AT commands, and how to build a working transmitter and receiver system. Understanding the JDY-40 Module The JDY-40 operates on the 2.4GHz frequency bands. Unlike Bluetooth modules, it uses a proprietary protocol that allows fast, low-latency communication between multiple modules. Pinout and Connections The module has basic pins that interface easily with any Arduino board: VCC : Power supply (supports 2.2V to 3.6V. Use 3.3V from Arduino). GND : Ground connection. TXD : Transmit data pin (connects to Arduino RX). RXD : Receive data pin (connects to Arduino TX). SET : Configuration pin. Pull LOW to enter AT command mode. Leave HIGH or disconnected for communication mode. CS : Chip select pin. Pull LOW to enable the module. Pull HIGH to sleep. Configuring JDY-40 with AT Commands Before sending data, you must configure both modules to share the same channel and address. You need an Arduino running a basic software serial passthrough sketch to send these commands. The Configuration Setup Connect SET pin to Arduino GND . Connect VCC to 3.3V and GND to GND . Connect TXD to Arduino Pin 2 and RXD to Arduino Pin 3. Open the Arduino Serial Monitor at 9600 baud with Both NL & CR enabled. Essential AT Commands Send these commands to configure your modules: AT+BAUD : Sets the communication speed. AT+BAUD4 sets it to 9600 baud (default). AT+RFID : Sets the wireless network ID. Both modules must match. Example: AT+RFID12345678 . AT+DVID : Sets the device ID. Both modules must match to talk. Example: AT+DVID8888 . AT+RFC : Sets the wireless channel (001 to 128). Both modules must use the same channel. Example: AT+RFC001 . AT+POWE : Sets transmit power (0 to 9). 9 is maximum power. Example: AT+POWE9 . Disconnect the SET pin from GND when configuration is complete. Best JDY-40 Arduino Example: Transmitter and Receiver This example demonstrates how to send a sensor value from a Transmitter Arduino to a Receiver Arduino. We use SoftwareSerial to keep the main hardware serial port free for debugging. Wiring Diagram for Both Sides Arduino 3.3V -> JDY-40 VCC Arduino GND -> JDY-40 GND and JDY-40 CS Arduino Pin 2 (RX) -> JDY-40 TXD Arduino Pin 3 (TX) -> JDY-40 RXD (Use a 1k ohm resistor inline for 5V Arduinos to protect the 3.3V RXD pin). 1. Transmitter Code This sketch reads an analog input (like a potentiometer) and transmits the data every 500 milliseconds. #include // Define pins for JDY-40 serial communication const int jdyRx = 2; const int jdyTx = 3; SoftwareSerial jdySerial(jdyRx, jdyTx); const int sensorPin = A0; void setup() { Serial.begin(9600); jdySerial.begin(9600); Serial.println("Transmitter Ready."); } void loop() { int sensorValue = analogRead(sensorPin); // Package data with a simple prefix and suffix for reliability jdySerial.print(" "); // Debug output to local Serial Monitor Serial.print("Sent: "); Serial.println(sensorValue); delay(500); } Use code with caution. 2. Receiver Code This sketch listens for incoming wireless packets, parses the bracketed data, and displays it on the Serial Monitor. #include const int jdyRx = 2; const int jdyTx = 3; SoftwareSerial jdySerial(jdyRx, jdyTx); String incomingData = ""; boolean recvInProgress = false; void setup() { Serial.begin(9600); jdySerial.begin(9600); Serial.println("Receiver Ready."); } void loop() { while (jdySerial.available() > 0) { char rc = jdySerial.read(); if (rc == ' ') { recvInProgress = false; processData(incomingData); } else if (recvInProgress) { incomingData += rc; // Append character } } } void processData(String data) { int parsedValue = data.toInt(); Serial.print("Received Value: "); Serial.println(parsedValue); // Example action: Turn on onboard LED if value is high if (parsedValue > 500) { digitalWrite(LED_BUILTIN, HIGH); } else { digitalWrite(LED_BUILTIN, LOW); } } Use code with caution. Best Practices for Stable Performance Power Stability : The JDY-40 pulls current spikes during transmission. Solder a 10uF to 100uF capacitor directly across the VCC and GND pins of the module to prevent resets. Voltage Levels : The JDY-40 logic is 3.3V. If using a 5V Arduino Uno or Nano, place a voltage divider or a 1k resistor between the Arduino TX pin and the JDY-40 RXD pin. Line of Sight : Keep the built-in PCB antenna away from large metal objects, motor shields, or dense wiring to maximize your range. Data Parsing : Always use start and end markers (like and > ) in your code. Wireless data can drop bytes; markers ensure you only read complete messages. To help refine this setup for your project, let me know: What type of data are you trying to send? (e.g., button presses, multiple sensor readings) Which Arduino board models are you using? What range/distance does your project require? Share public link This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later.

JDY-40 Arduino Guide: Best Examples and Setup The JDY-40 is a highly affordable, versatile 2.4GHz wireless serial port transparent transmission module . It operates similarly to Bluetooth or HC-12 modules but at a fraction of the cost, making it the best choice for budget-friendly Arduino telemetry, remote control, and sensor networks. This comprehensive guide provides the best, production-ready examples for setting up wireless communication between two Arduino boards using JDY-40 modules. JDY-40 Module Overview and Pinout The JDY-40 operates on the 2.4GHz band with a range of up to 120 metres in open space. It communicates via standard asynchronous serial (UART), making it fully compatible with any Arduino board. Pin Configuration VCC : 2.2V to 3.6V DC (Do not connect directly to Arduino 5V without a regulator). GND : Ground (Must be shared with Arduino GND). TXD : Serial Data Output (Connects to Arduino RX / Software RX). RXD : Serial Data Input (Connects to Arduino TX / Software TX). SET : Mode Configuration Pin (Pull LOW for AT command mode, pull HIGH or leave floating for communication mode). CS : Chip Select / Sleep Pin (Pull LOW for normal operation, pull HIGH for low-power sleep). Wiring Diagram (Arduino to JDY-40) Because the JDY-40 is a 3.3V logic device, connecting it directly to a 5V Arduino Uno/Nano requires care. While the RX/TX pins are often 5V tolerant, using a logic level converter or a simple resistor voltage divider on the JDY-40 RXD pin ensures long-term reliability. JDY-40 Pin Arduino Uno/Nano Pin VCC Ensure adequate current supply GND Common ground is mandatory TXD Pin 2 (Software RX) Direct connection RXD Pin 3 (Software TX) Use a 1kΩ / 2kΩ voltage divider SET Pin 4 (or GND for config) Controls AT Command mode CS Keeps module active AT Command Configuration Before transmitting data, you must configure both modules to use the same channel and wireless address. Connect the SET pin to GND , power on the module, and use the following code to send AT commands via the Arduino Serial Monitor (set to 9600 Baud and Both NL & CR ). #include SoftwareSerial jdySerial(2, 3); // RX, TX void setup() { Serial.begin(9600); jdySerial.begin(9600); Serial.println("JDY-40 AT Command Mode Ready."); } void loop() { if (jdySerial.available()) { Serial.write(jdySerial.read()); } if (Serial.available()) { jdySerial.write(Serial.read()); } } Use code with caution. Essential AT Commands for Pairing To pair two modules flawlessly, program them with the same RFID (Wireless Network ID) and DVID (Device ID): Test Connection : Send AT -> Should return +OK . Set Baud Rate : Send AT+BAUD4 -> Sets baud rate to 9600 (Default). Set Wireless ID (RFID) : Send AT+RFID12345678 -> Must match on both modules. Set Device ID (DVID) : Send AT+DVID1122 -> Must match on both modules for transparent 1-to-1 communication. Set Channel : Send AT+RFC001 -> Selects channel 1. Must match on both modules. Once configured, disconnect the SET pin from GND (or pull it HIGH) and reboot the modules to enter transparent transmission mode. Best JDY-40 Arduino Example: Bidirectional Communication This example demonstrates the best practice for robust wireless communication. It sends a structured payload (sensor data) from a Transmitter node and receives it safely on a Receiver node using start/end markers to prevent data corruption. Transmitter Code (Sensor Node) #include SoftwareSerial jdySerial(2, 3); // RX, TX unsigned long lastSendTime = 0; const unsigned long interval = 1000; // Send every 1 second void setup() { Serial.begin(9600); jdySerial.begin(9600); Serial.println("Transmitter Initialised."); } void loop() { if (millis() - lastSendTime >= interval) { lastSendTime = millis(); // Simulate sensor readings int temperature = random(20, 35); int humidity = random(40, 80); // Construct packet with start ' ' markers jdySerial.print(" "); // Debug output to local PC Serial.print("Sent: T="); Serial.print(temperature); Serial.print("C, H="); Serial.print(humidity); Serial.println("%"); } } Use code with caution. Receiver Code (Base Station Node) jdy40 arduino example best

user wants a long article for the keyword "jdy40 arduino example best". This likely refers to the JDY-40 2.4GHz wireless transceiver module and how to use it with Arduino. I need to provide a comprehensive guide covering basics, wiring, code examples, and best practices. To gather comprehensive information, I will perform multiple searches covering general information, tutorials, examples, and specific use cases. search results have provided a variety of resources. I will now open several of them to gather detailed information for the article. search results provide a good amount of information. I have opened several pages, including some with code examples, AT commands, and project descriptions. I will now synthesize this information into a comprehensive article. The article will cover an introduction, features, hardware overview, wiring, AT commands, basic examples, advanced examples, troubleshooting, comparisons, projects, and a conclusion. I will cite the sources I've gathered. you're looking for a simple, low-cost way to add wireless serial communication to your Arduino projects, the JDY-40 2.4GHz transceiver module is an excellent choice. Known for its ease of use and impressive range for its price, it's a fantastic alternative to more complex modules like the nRF24L01. This guide will provide you with the best examples, from basic setup to advanced projects, to help you integrate the JDY-40 into your Arduino creations. 📡 What is the JDY-40? The JDY-40 is a small, low-power wireless serial port transceiver module operating in the 2.4GHz ISM band. Its key features include:

Simple Serial Interface : It uses standard UART (Universal Asynchronous Receiver-Transmitter) communication, meaning you can send and receive data just like you would over a standard serial connection. Excellent Range : In open areas, it can achieve a line-of-sight distance of up to 100-120 meters, making it suitable for outdoor projects. Low Power : It's designed for low-power applications, with a typical operating current of around 24mA when receiving and 40mA when transmitting, and a very low sleep current of just 5µA, which is perfect for battery-operated devices. Versatile Modes : It supports two primary operating modes: Transparent Transmission Mode , where it simply acts as a wireless serial cable, and IO Transfer Mode , which can be used for remote IO control.

You can find this module for as little as $1-2 from online retailers like AliExpress and specialized electronics shops. ⚙️ Hardware Overview and Key Pins To get started, you need to know the module's pinout. The table below shows the essential connections for using the JDY-40 with an Arduino. | JDY-40 Pin | Function | Connection to Arduino | | :--- | :--- | :--- | | VCC | Power supply (3.3V). | Connect to the 3.3V output pin on your Arduino. Do not use 5V , as this may damage the module. | | GND | Ground. | Connect to any GND pin on your Arduino. | | TXD | Serial Data Transmit. | Connect to the Arduino's RX pin (e.g., pin 0 on Uno). | | RXD | Serial Data Receive. | Connect to the Arduino's TX pin (e.g., pin 1 on Uno). | | SET | AT Command Mode pin. | Pull this pin LOW (to GND) to enter configuration mode, HIGH (to 3.3V) for normal transparent mode. | | CS | Chip Select. | Pull this pin LOW (to GND) to wake the module from sleep. For normal operation, tie it to GND. | 💻 How to Configure the JDY-40 with AT Commands The module's default settings are usually sufficient for two units to communicate right out of the box. However, to change parameters like baud rate or channel, you'll need to use AT commands. You can do this directly from your Arduino. The JDY-40 is a highly efficient 2

Wiring for Configuration : First, connect the JDY-40 to your Arduino as described above. To put the module into AT command mode, you must connect the SET pin to GND (LOW) and CS pin to GND.

Important : Use a 3.3V logic level. If you're using a 5V Arduino like the Uno, you'll need a voltage divider on the line from the Arduino's TX pin to the module's RX pin to prevent damage.

Upload the Code : The following code sends an AT command to set the module to "Transparent Transmission Mode" (CLSS A0). You can modify the Serial.println() line to send other AT commands. void setup() { Serial.begin(9600); // Start serial communication pinMode(3, OUTPUT); // Control SET pin digitalWrite(3, LOW); // Pull SET low to enter AT mode delay(300); // Wait for module to be ready Serial.println("AT+CLSSA0"); // Send AT command delay(300); digitalWrite(3, HIGH); // Pull SET high to exit AT mode } void loop() { // Relay any data from the Serial Monitor to the JDY-40 if (Serial.available() > 0) { String comdata = ""; while (Serial.available() > 0) { comdata += char(Serial.read()); delay(2); } Serial.print(comdata); } } Range : Up to 120 meters in open areas

Important : Always end AT commands with \r\n (carriage return and newline). In Arduino code, Serial.println() will handle this for you.

Here is a quick reference of the most common AT commands to get you started: | AT Command | Description | Default Value | Example | | :--- | :--- | :--- | :--- | | AT+BAUD | Set the serial baud rate. | 4 (9600) | AT+BAUD4 | | AT+RFC | Set the radio frequency channel (001-128). | 001 | AT+RFC010 | | AT+RFID | Set the wireless network ID (0000-FFFF). | 8899 | AT+RFID1234 | | AT+DVID | Set the device ID (0000-FFFF). | 1122 | AT+DVID0011 | | AT+POWE | Set the transmit power (0-9, higher = more power). | 9 | AT+POWE5 | | AT+CLSS | Set the operating mode ( A0 =Transparent, C1 =IO Send, C4 =IO Receive). | A0 | AT+CLSSC1 | | AT+VER | Query the firmware version. | N/A | AT+VER | 🚀 The Best JDY-40 Arduino Examples for Your Projects Now for the most important part: how to use the JDY-40 in your own projects. Here are three practical examples, from simple to more advanced. Example 1: Basic Point-to-Point Wireless Serial Link This is the easiest way to use the JDY-40. It replaces a physical serial cable, allowing two Arduinos to communicate wirelessly. Use this when you need to send simple data like sensor readings or control signals between two devices. Wiring for Two Modules: For each JDY-40 module, connect it to its respective Arduino: