Jdy40 Arduino Example Best //top\\ Jun 2026
Because AT commands take only a few milliseconds, this method works well for low‑duty‑cycle applications.
Now for the practical part. The following examples provide a complete, working foundation for any project, with explanations to help you adapt them to your needs.
To configure or use the module, connect it to your Arduino as follows:
// Feature Flag: Set to true once we configure the module bool isConfigured = false; jdy40 arduino example best
The JDY‑40 is a hidden gem in the Arduino wireless world. It offers a dead‑simple way to turn any serial connection into a wireless link, with excellent range and low power consumption. Once you have mastered the basic example (a transparent wireless UART), you can build remote sensor networks, wireless data loggers, robot controllers, and home automation systems – all without wrestling with Bluetooth pairing or WiFi IP addresses.
Note: After configuring both modules with identical settings, remove the SET-to-GND connection, then power cycle the modules to return to communication mode. 5. Troubleshooting & Pro-Tips
The JDY-40 consumes spikes of current during RF transmission bursts. The onboard 3.3V regulator of an Arduino Uno can sometimes struggle to manage these quick fluctuations, causing module resets or data dropouts. Solder a directly across the VCC and GND pins of the JDY-40 module to smooth out the power delivery. Change Default Network IDs Because AT commands take only a few milliseconds,
void setup() Serial.begin(9600); // For debugging (optional) jdy.begin(9600);
Pull for normal operation; pull HIGH to enter low-power sleep mode. Wiring Diagram: Arduino to JDY-40
Before writing code, understanding the hardware constraints ensures you do not damage your components. To configure or use the module, connect it
This guide breaks down how to interface the JDY-40 module with an Arduino, configuring it via AT commands, and building a robust transceiver system. Why Choose the JDY-40 Module?
#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 '<' and end '>' markers jdySerial.print("<"); jdySerial.print(temperature); jdySerial.print(","); jdySerial.print(humidity); jdySerial.println(">"); // 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)
Instead of using a PC serial terminal, you can write a simple Arduino sketch to configure your modules. This is especially useful if you need to set the channel and ID on the fly or if you are deploying many modules.
To use the JDY-40 with an Arduino, you must ensure you are using or a level shifter, as the module is not 5V tolerant.
To enter AT mode, pull the SET pin low (to GND) before powering the module. Send commands via Serial (9600 baud, newline ending).