You must configure the JDY-40 for best range and low interference. Connect the module directly to your PC via a USB-Serial adapter (3.3V). Send AT commands ending with \r\n .
#include SoftwareSerial jdySerial(2, 3); // RX, TX const int setPin = 4; void setup() pinMode(setPin, OUTPUT); digitalWrite(setPin, LOW); // Force JDY-40 into AT Command Mode Serial.begin(9600); jdySerial.begin(9600); Serial.println("JDY-40 Configurator Ready."); Serial.println("Type AT commands in the Serial Monitor (Set to Both NL & CR)."); void loop() if (jdySerial.available()) Serial.write(jdySerial.read()); if (Serial.available()) jdySerial.write(Serial.read()); Use code with caution. Essential AT Command Sequence
(jdySerial.available()) Serial.write(jdySerial.read()); // Read from Serial Monitor and send to JDY-40
To enter AT command mode, pull the pin LOW . Commands must be sent in uppercase and concluded with a Carriage Return and Line Feed ( \r\n ). Critical Setup Commands
2.2V to 3.6V (Note: 5V may damage the module; use a voltage regulator if needed). jdy40 arduino example best
This sketch listens for incoming wireless packets, parses the bracketed data, and displays it on the Serial Monitor.
While the JDY-40 natively broadcasts messages to all modules on the same frequency, you can create a more sophisticated system where a central hub communicates with specific remote nodes by including a "destination" field in your data packets. Key Feature: Targeted Device Addressing
By following this guide, you should now have a better understanding of how to use the JDY-40 Bluetooth module with Arduino. Experiment with different projects and explore the possibilities of wireless communication with your Arduino board. Happy building!
Радиомодули JDY-40 только UART - Arduino.ru You must configure the JDY-40 for best range
What the example typically includes (practical checklist)
: Sets the wireless channel (001 to 128). Both modules must use the same channel. Example: AT+RFC001 .
The code is split into two parts: a that reads an analog sensor value and transmits it package-style, and a Receiver (Rx) that parses the data stream and handles missing packets gracefully. 1. Transmitter Code (Tx)
The JDY-40 is a highly efficient, low-cost 2.4GHz wireless transceiver module. It operates on the same frequency band as Wi-Fi and Bluetooth but utilizes a proprietary protocol optimized for low-power, short-range data transmission. This makes it an exceptional alternative to bulkier or more expensive wireless solutions like the NRF24L01 or HC-05 Bluetooth modules, especially for budget-friendly DIY robotics, remote controls, and smart home sensor networks. #include SoftwareSerial jdySerial(2, 3); // RX, TX const
While the JDY-40 works straight out of the box, you'll need to know the AT commands to change its behavior, such as setting a unique network ID, baud rate, or transmission channel. To enter AT command mode, you must pull the SET pin to GND (LOW).
const int buttonPin = 7; int buttonState = 0; int lastButtonState = HIGH;
| Command | Function | Best Setting | | :--- | :--- | :--- | | AT+DEFAULT | Reset to factory | Use before setup | | AT+RF01 | Set RF channel (0-99) | AT+RF50 (mid-range) | | AT+BAUD7 | 9600 baud | Default | | AT+POW02 | Max power | AT+POW02 (Most stable) | | AT+TP00 | Stop transmitting after 5s (sleep) | AT+TP00 for battery | | AT+FUNC2 | Transparent mode | Default |
The JDY-40 is an incredibly robust module when paired with good code. Unlike the nRF24L01, which requires complex SPI libraries and addresses, the JDY-40 feels like a piece of wire. Copy these examples, modify the packet structure for your own sensors (DHT22, DS18B20, or even GPS), and you will have the most reliable low-cost wireless link in your workshop.