Here’s a more useful example: a remote temperature sensor.
Transmitter (with DHT11):
#include <DHT.h> DHT dht(2, DHT11);void setup() Serial.begin(9600); dht.begin();
void loop() float temp = dht.readTemperature(); float hum = dht.readHumidity(); Serial.print(temp); Serial.print(","); Serial.println(hum); delay(5000);
Receiver (Serial Plotter ready):
void setup() Serial.begin(9600);
void loop() if (Serial.available()) String data = Serial.readStringUntil('\n'); Serial.println(data); // Send to Serial Plotter
Open Tools → Serial Plotter on the receiver. You’ll see a live graph of temperature and humidity – wirelessly! jdy40 arduino example best
Out of the box, the JDY-40 works. But to eliminate interference and maximize range, you must configure it via AT commands.
To enter AT mode:
Send these commands to both modules (Master and Slave):
| Command | Function | Best Setting |
| :--- | :--- | :--- |
| AT+RFADDR | RF Channel (0-255) | AT+RFADDR=115 (Pick a quiet channel) |
| AT+RFNETID | Network ID (0-65535) | AT+RFNETID=5678 (Avoid default 0) |
| AT+BAUD | UART baud rate | AT+BAUD=9600 (Most stable) |
| AT+RFMD | RF Data rate | AT+RFMD=250 (250kbps = longest range) |
| AT+TRPMAX | Transmit power | AT+TRPMAX=1 (Max power) |
| AT+SLEEP | Power management | AT+SLEEP=0 (Disable sleep for continuous use) | Here’s a more useful example: a remote temperature sensor
Pro Tip: After setting AT+RFNETID, the modules automatically pair. No need for AT+LINK or address targeting. This is transparent broadcasting — anything one sends, all receive.
The JDY-40 is a 2.4GHz wireless transceiver designed for transparent serial transmission. Its key features include:
Because it works over UART, you can use Serial.print() to send data wirelessly.