#include <DHT.h> DHT dht(2, DHT11);
: 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.
: The JDY-40 pulls current spikes during transmission. Solder a 10uF to 100uF capacitor directly across the VCC and GND pins of the module to prevent resets. jdy40 arduino example best
This is the most frequently reported issue.
void setup() Serial.begin(9600); // Debugging on PC jdy40.begin(9600); // JDY-40 default baud rate Serial.println("JDY-40 Transmitter Ready"); #include <DHT
| Feature | JDY-40 | nRF24L01 | | :--- | :--- | :--- | | | VCC, GND, TX, RX | 8 pins, complex SPI | | Library | None (Serial) | RF24 (complex) | | Configuration | AT commands over Serial | Registers via SPI | | Reliability | Very stable | Prone to noise/power issues |
void loop() if (Serial.available()) String data = Serial.readStringUntil('\n'); Serial.print("Received: "); Serial.println(data); This is the most frequently reported issue
: Always end AT commands with \r\n (carriage return and newline). In Arduino code, Serial.println() will handle this for you.
// 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.