on the Arduino's TX pin to drop the 5V signal to 3.3V for the JDY-40 RXD pin.
// Prepare JDY-40 (connected to hardware serial pins 0/1) pinMode(2, OUTPUT); // SET pin digitalWrite(2, LOW); // Enter AT mode (for configuring) // We'll set the channel and ID inside the loop, before each transmission.
#include <SoftwareSerial.h>
1200 bps to 115200 bps (Default is 9600 bps) Communication Distance: Up to 120 meters in open spaces
digitalWrite(3, HIGH); // HIGH = Transparent Transmission Mode Serial.println("JDY-40 Configured!"); jdy40 arduino example best
The JDY-40 is a low-power, 2.4GHz wireless transceiver that functions as a "wireless serial port" for microcontrollers like Arduino
If you tell me the of your project (e.g., controlling a robot, sending sensor data, wireless remote) and what Arduino model you are using, I can provide a more tailored code example.
#include const int RX_PIN = 2; const int TX_PIN = 3; const int SET_PIN = 4; SoftwareSerial jdy40(RX_PIN, TX_PIN); void setup() pinMode(SET_PIN, OUTPUT); digitalWrite(SET_PIN, LOW); // Enter AT Command Mode Serial.begin(9600); jdy40.begin(9600); // Default baud rate for JDY-40 Serial.println("JDY-40 AT Mode Initialized. Ensure Serial Monitor is set to 'Both NL & CR'."); void loop() if (jdy40.available()) Serial.write(jdy40.read()); if (Serial.available()) jdy40.write(Serial.read()); Use code with caution. Essential AT Commands to Run
This implementation uses SoftwareSerial to preserve the hardware serial port ( Serial ) for debugging via the Arduino IDE Serial Monitor. on the Arduino's TX pin to drop the 5V signal to 3
Each remote listens for incoming commands and executes them when its ID is matched.
Send AT , the module should respond with +OK . Set/Query Baud Rate: AT+BAUD (Default is 4 / 9600 bps).
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.
Here’s a more useful example: a remote temperature sensor. #include const int RX_PIN = 2; const int
While Arduinos typically use 5V logic, the JDY-40 prefers 3.3V. Using a voltage divider (resistors) on the Arduino's TX line can prevent long-term damage to the module. 2. Best Code Example: Two-Way Communication
This sketch reads a button on pin 7 and sends the string "Button Pressed" to the other module.
Using 5V on VCC will fry the JDY-40. Don’t do it.
One of the JDY‑40’s most interesting features is its ability to control I/O pins on a remote module on the remote side. You can configure a module to act as a simple remote control receiver: when the paired transmitter sends certain byte sequences, the receiver directly sets its I/O pins HIGH or LOW. This is perfect for controlling relays, LEDs, or motors with minimal circuitry.