Jdy40 Arduino Example Best [better] Jun 2026
// Best practice: Send structured, short packets // Never send Strings larger than the buffer (max 64 bytes per packet) jdy40.print("TEMP:"); jdy40.print(23.5); jdy40.print(";BAT:"); jdy40.println(4.12);
Here is the developed feature proposal and the complete implementation code.
: 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. jdy40 arduino example best
The biggest flaw with raw serial transmission is . If you send "HELLO" and "WORLD" fast, they might merge into "HELLOWORLD". The best JDY-40 example includes start/end markers and checksums.
#include const int RX_PIN = 2; const int TX_PIN = 3; const int SET_PIN = 4; const int SENSOR_PIN = A0; SoftwareSerial jdyCommunication(RX_PIN, TX_PIN); void setup() pinMode(SET_PIN, OUTPUT); digitalWrite(SET_PIN, HIGH); // Set to Communication Mode Serial.begin(9600); jdyCommunication.begin(9600); Serial.println("Transmitter Ready."); void loop() int sensorValue = analogRead(SENSOR_PIN); // Format packet: jdyCommunication.print("<"); jdyCommunication.print(sensorValue); jdyCommunication.print(">"); Serial.print("Sent Payload: "); Serial.println(sensorValue); delay(1000); // Send data every 1 second Use code with caution. 2. Receiver Code // Best practice: Send structured, short packets //
Connect two separate Arduino boards (Transmitter and Receiver) using the following pinout: JDY-40 Pin Arduino Pin (Uno/Nano/Pro Mini) Do NOT connect to 5V GND Common ground TXD Pin 2 (Software RX) Receives data from JDY-40 RXD Pin 3 (Software TX) Use a 1kΩ resistor inline for 5V Arduinos SET Pin 4 (Digital Out) Controls AT Mode / Data Mode CS Kept permanently low for active state Configuring the JDY-40 via AT Commands
: 15mA in transmission, sub-microamps in sleep mode Wiring the JDY-40 to Arduino The biggest flaw with raw serial transmission is
If your wireless link drops out when the Arduino executes heavy tasks, solder a small 10µF electrolytic capacitor directly across the JDY-40 module’s VCC and GND pins to smooth out power spikes.