Jdy40 Arduino Example Best Review
#include const int J_RX = 2; const int J_TX = 3; const int J_SET = 4; SoftwareSerial jdy40(J_RX, J_TX); // Parsing state variables const char START_MARKER = '<'; const char END_MARKER = '>'; const byte MAX_CHARS = 32; char receivedChars[MAX_CHARS]; boolean newData = false; void setup() Serial.begin(9600); jdy40.begin(9600); pinMode(J_SET, OUTPUT); digitalWrite(J_SET, HIGH); // Transparent Mode Serial.println("--- JDY-40 Receiver Ready ---"); void loop() recvWithStartEndMarkers(); showParsedData(); // Robust serial parsing function to filter transmission noise void recvWithStartEndMarkers() static boolean recvInProgress = false; static byte ndx = 0; char rc; while (jdy40.available() > 0 && newData == false) rc = jdy40.read(); if (recvInProgress == true) if (rc != END_MARKER) receivedChars[ndx] = rc; ndx++; if (ndx >= MAX_CHARS) ndx = MAX_CHARS - 1; // Prevent buffer overflow else receivedChars[ndx] = '\0'; // Terminate the string recvInProgress = false; ndx = 0; newData = true; else if (rc == START_MARKER) recvInProgress = true; // Convert parsed characters to an integer and act on it void showParsedData() if (newData == true) int finalValue = atoi(receivedChars); // Convert string to integer Serial.print("Data Received Successfully: "); Serial.println(finalValue); // Example action based on received data if(finalValue > 500) Serial.println("ALERT: Threshold exceeded!"); newData = false; Use code with caution. Best Practices for Production Deployment
: Use the CS pin to wake the module only when it needs to transmit data, reducing power consumption to as low as 25 microamps during sleep.
#include <SoftwareSerial.h> #include <DHT.h>
: Chip select pin. Pull LOW to enable the module. Pull HIGH to sleep. Configuring JDY-40 with AT Commands jdy40 arduino example best
2.2V to 3.6V (Note: Use 3.3V, not 5V directly to the module). Interface: UART (Serial) and 8 GPIO pins. Baud Rate: Supports up to 19,200 bps (default is 9600). Power Consumption: ~40mA during transmission, as low as 5µA in sleep mode. Wiring Connection (Arduino to JDY-40)
Which are you planning to use for the project? What is the target distance between your wireless nodes? Share public link
: Sets transmit power (0 to 9). 9 is maximum power. Example: AT+POWE9 . #include const int J_RX = 2; const int
#include <SoftwareSerial.h>
: Use a 3.3V logic level. If you're using a 5V Arduino like the Uno, you'll need a voltage divider on the line from the Arduino's TX pin to the module's RX pin to prevent damage.
To configure the module, pull the . All commands must end with \r\n (CR+LF). Pull LOW to enable the module
SoftwareSerial jdySerial(JDY_RX, JDY_TX);
(available in source repository).
The JDY-40 is a highly efficient, low-cost 2.4GHz wireless transceiver module. It functions as a transparent serial port link, making it an excellent alternative to Bluetooth or standard RF links for microcontroller projects. Operating on the 2.4GHz band with up to 120-meter range, it allows multiple Arduinos to communicate seamlessly without complex network stacks.
: 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)



