// Poll remote node 2 setRemoteID(2); Serial.println("STATUS"); // ... and so on.
Pull for normal operation; pull HIGH to enter low-power sleep mode. Wiring Diagram: Arduino to JDY-40
This sketch listens for incoming serial data from the JDY-40, parses the packet using start and end markers, and outputs the isolated integer to the serial monitor.
If the SET pin is left floating or loose on a breadboard, the module can unexpectedly bounce into AT config mode, causing regular serial data transfers to drop out completely. Tie it firmly to VCC via a pullup or control it actively via a digital pin driven HIGH .
Before diving into the code, it is vital to understand the pinout and operational modes of the JDY-40. The module features 8 pins, but for standard Arduino serial communication, you only need to focus on a few key connections. Pinout Configuration
: 3.3V to 3.6V (Do not connect to Arduino 5V without a regulator) GND : Ground (Must be shared with Arduino Ground) TXD : Transmit Pin (Connects to Arduino RX)
Operating on the 2.4GHz band with a range of up to 120 meters, this versatile transceiver uses simple AT commands for configuration and communicates via standard Serial (UART).
This example allows you to type a message in the Serial Monitor of one Arduino and see it appear on the other. It is the most reliable way to test if your modules are paired correctly. 1. Wiring Diagram JDY-40 Pin Arduino Pin Do not use 5V. Common ground. Connects to SoftwareSerial RX.
Mastering the JDY-40 Wireless Module with Arduino: A Complete Guide
To avoid interfering with the Arduino’s USB programming (which uses pins 0 and 1), the best practice is to use the SoftwareSerial // Define pins: RX (Pin 2), TX (Pin 3) SoftwareSerial jdy40( setup() Serial.begin( // To Computer jdy40.begin( // To JDY-40 (Default 9600 baud) Serial.println( "JDY-40 Ready. Type message to send..." // If computer sends data, send it to the wireless module (Serial.available()) jdy40.write(Serial.read());
Connect the other end of the 1kΩ resistor to the JDY-40 pin. Connect a 2kΩ resistor from the JDY-40 RXD pin to GND . Essential AT Commands for Configuration