Jdy40 Arduino Example Best Portable ❲2025-2026❳
Getting Started with JDY-40 Arduino Module: A Comprehensive Guide
The JDY-40 is a popular Bluetooth 4.0 module widely used in Arduino projects for wireless communication. It's a cost-effective and efficient way to add Bluetooth connectivity to your Arduino board. In this article, we'll explore the JDY-40 module, its features, and provide a step-by-step guide on how to use it with Arduino, along with some example code.
Overview of JDY-40 Module
The JDY-40 is a Bluetooth 4.0 module based on the CSR8510 chipset. It supports a wide range of Bluetooth protocols, including SPP (Serial Port Protocol), HID (Human Interface Device), and more. The module operates at a frequency of 2.4 GHz and has a maximum data transfer rate of 1 Mbps.
Key Features of JDY-40 Module:
- Bluetooth 4.0 version
- CSR8510 chipset
- Supports SPP, HID, and other protocols
- Frequency range: 2.4 GHz
- Maximum data transfer rate: 1 Mbps
- Low power consumption
- Small form factor (18mm x 15mm)
Hardware Requirements:
- JDY-40 Bluetooth module
- Arduino board (e.g., Arduino Uno, Arduino Nano)
- Breadboard and jumper wires
- Power source (e.g., USB cable, battery)
Software Requirements:
- Arduino IDE (version 1.8.x or later)
Step-by-Step Guide:
- Connect the JDY-40 Module to Arduino:
- VCC (JDY-40) to 5V (Arduino)
- GND (JDY-40) to GND (Arduino)
- RX (JDY-40) to TX (Arduino)
- TX (JDY-40) to RX (Arduino)
- Install the SoftwareSerial Library:
- Open the Arduino IDE and navigate to Sketch > Include Library > Manage Libraries
- Search for "SoftwareSerial" and install the library
- Upload the Example Code:
- Create a new Arduino project and paste the following code:
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2, 3); // RX, TX
void setup()
Serial.begin(9600);
bluetooth.begin(9600);
void loop()
if (bluetooth.available() > 0)
char data = bluetooth.read();
Serial.print("Received: ");
Serial.println(data);
if (Serial.available() > 0)
char data = Serial.read();
bluetooth.print(data);
Explanation of the Code:
- The code uses the SoftwareSerial library to create a software serial port on pins 2 (RX) and 3 (TX).
- In the
setup()function, we initialize the serial communication at 9600 bps for both the serial monitor and the Bluetooth module. - In the
loop()function, we check if there's incoming data from the Bluetooth module or the serial monitor. If there is, we read the data and send it to the other device.
Example Use Cases:
- Wireless temperature monitoring
- Home automation control
- Robot control
Tips and Troubleshooting:
- Make sure to pair the JDY-40 module with your Bluetooth device before uploading the code.
- If you encounter issues with communication, try adjusting the baud rate or swapping the RX and TX pins.
- For more advanced applications, refer to the JDY-40 datasheet and the SoftwareSerial library documentation.
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!
In the world of wireless Arduino projects, is often hailed as a "silent workhorse" because of its effortless ability to establish long-range, transparent serial communication without the pairing headaches of traditional Bluetooth The Story of the "Ghost Connection"
Imagine building a remote-controlled rover intended to explore a dense backyard garden. Traditional Bluetooth modules like the
might struggle with line-of-sight obstacles or drop the connection if you walk too far away. By switching to a JDY-40, you gain a massive 120-meter range
. Because it uses 2.4GHz RF technology (similar to an NRF24L01 but with a simplified serial interface), it broadcasts to all other JDY-40 modules on its channel automatically. The "best" example of its power is a Hub-and-Spoke sensor network jdy40 arduino example best
. You can have one central "Hub" Arduino in your house and multiple "Remote" nodes (like an Arduino Uno
) scattered in the garden, each monitoring soil moisture. By sending simple JSON messages with a "destination ID," only the intended remote node replies, making it feel like a sophisticated, custom-built network. Best Practice Setup Example
To get the best performance out of your JDY-40, follow this standard serial setup:
While there isn't a single "academic paper" that serves as the definitive guide, the following highly-regarded technical resources and tutorials are considered the best documentation for using the JDY-40 wireless module with Arduino. Best Technical Guides & Documentation
Detailed Setup and AT Commands: For a comprehensive technical overview, including how to configure the module via AT commands and its 128 radio channel options, refer to the Simple Wireless Serial Communication guide by Ben Emmett
. This resource is excellent for understanding current draw and power options.
Networking and Broadcast Examples: If you are looking to build a multi-node network (e.g., one hub and multiple remote nodes), Ben Emmett's JDY-40 Wireless Broadcast project provides complete Arduino and Python code examples using JSON formatting for message transmission.
Scientific Application: For a look at how the JDY-40 is used in professional research, the peer-reviewed paper "Wireless Data Acquisition System with Feedback Function" in MDPI details its integration into a data acquisition sensor, highlighting its 3.3V power requirements and energy-efficient sleep modes. Practical Implementation Resources
Video Tutorials: Ralph Bacon’s video tutorial on Wireless Serial Comms and the accompanying GitHub repository
are highly recommended for beginners. These resources demonstrate how to use the Go to product viewer dialog for this item.
as a "wireless USB cable" for serial debugging and data transfer.
Datasheets: The JDY-40 Wireless Serial Module PDF on Scribd provides the essential hardware specifications, including its 120-meter transmission range and 2.4GHz operating frequency. Critical Usage Tips Voltage Limitation: Always remember that the
is a 3.3V limited device; applying 5V directly to the VCC or logic pins without a level shifter can damage the module.
Channel Interference: For stable communication between multiple links, it is best to separate their channels by at least 6 to avoid interference.
The JDY-40 is a 2.4GHz wireless serial module often used as a "wireless serial cable" for Arduinos. It operates at 3.3V and supports a range of up to 120–150 meters. 1. Circuit Connections Getting Started with JDY-40 Arduino Module: A Comprehensive
To interface the JDY-40 with an Arduino (like a Nano or Uno), use the following wiring scheme. Note that the module is 3.3V limited; applying 5V to the data pins without a level shifter can damage it. JDY-40 Pin Arduino Pin Description VCC Power supply (2.2V - 3.6V) GND Common Ground RXD TX (e.g., D3*) Data receive pin (3.3V logic) TXD RX (e.g., D2*) Data transmit pin SET D4 / GND / 3.3V LOW for AT Mode; HIGH for Communication Mode CS Chip Select; LOW to keep the module active
*Using SoftwareSerial is recommended to keep the hardware Serial port free for debugging. 2. Configuration (AT Mode)
Before sending data, you must configure both modules (e.g., to the same channel). Enter AT Mode: Pull the SET pin LOW. Common Commands: AT+BAUD: Set baud rate (Default is 9600).
AT+CHNAL: Set wireless channel (0–127). Modules must be on the same channel. AT+DVID: Set Device ID. AT+CLSS: Set mode (e.g., A0 for transparent transmission). 3. Best Arduino Example (Transparent Serial)
The most reliable way to use the JDY-40 is as a transparent serial bridge. This allows you to send data from one Arduino and receive it on another as if they were connected by a wire. Transmitter/Receiver Sketch (Generic):
#include Use code with caution. Copied to clipboard 4. Advanced Networking
For more complex setups, you can implement a broadcast network where a "hub" sends messages to specific "nodes" using JSON identifiers. In this setup, every node receives the message, but only the one matching the "destination" field in the data processes it. Key Performance Specs Frequency: 2.4GHz (2400-2483.5 MHz). Power Consumption: ~40mA (TX), ~24mA (RX), 5μA (Sleep). Max Speed: 19,200 bps for transparent transmission.
Stability Tip: If you experience data loss, ensure modules are within 6 channels of each other or use data integrity checks (like checksums) in your code.
Video #257: Serial Wireless Comms for Arduino (et al) - GitHub
The JDY-40 is a compact 2.4GHz wireless transceiver that functions like a wireless serial cable. It is widely used for Arduino projects due to its simplicity, low power consumption (5uA in sleep), and a range of up to 120 meters in open areas. 1. Essential Wiring
The JDY-40 is a 3.3V device. While its serial pins (RX/TX) are often tolerant to 5V Arduino logic, you must power it with 3.3V. JDY-40 Pin Arduino Pin Description VCC Power Supply (2.2V - 3.6V) GND RXD Pin 11 (SoftSerial TX) Serial input to module TXD Pin 10 (SoftSerial RX) Serial output from module SET Pin 9 (or GND for AT) Low (GND): AT Command mode; High: Data mode CS Low: Awake; High: Sleep mode 2. Best Code Example: Transparent Serial
The most common "best" use case is transparent transmission, where data sent to the RX pin of one module instantly appears at the TX pin of another.
#include Use code with caution. Copied to clipboard 3. Essential AT Configuration Commands
To configure the module, pull the SET pin to GND. All commands must end with \r\n (CR+LF).
AT+BAUD: Set the baud rate. Default is 4 (9600). Options range from 1 (1200) to 6 (19200). Bluetooth 4
AT+RFID: Sets the Wireless ID (0000 to FFFF). Both modules must have the same RFID to talk.
AT+DVID: Sets the Device ID. Useful for identifying specific nodes in a network.
AT+POWE: Adjusts transmit power (0 to 9). 9 is max (+12dBm).
AT+CLSS: Changes operating mode. A0 is standard transparent serial, while C0-C5 are for remote GPIO control. 4. Pro Tips for Better Reliability
Video #257: Serial Wireless Comms for Arduino (et al) - GitHub
JDY-040/JDY-041 module. JDY-040 module Serial Wireless transceiver info. PLEASE NOTE: this module is 3v3 limited - don't apply 5v.
Радиомодули JDY-40 2.4G с UART интерфейсом - arduinoLab
Conclusion
The JDY-40 is a fantastic drop-in replacement for Bluetooth modules when you don’t need pairing or a phone app. It turns your Arduino into a simple wireless node in under 10 lines of code.
Have you used the JDY-40 in a project? Let me know in the comments below!
Disclaimer: Always double-check your wiring. While the JDY-40 is forgiving, 5V logic can damage it over time. Use a level shifter for production projects.
Mastering Wireless Communication: The Best JDY-40 Arduino Examples for Reliable Projects
In the world of DIY electronics and IoT prototyping, Bluetooth and WiFi modules often steal the spotlight. However, when you need simple, low-power, and surprisingly long-range point-to-point data transfer, the JDY-40 is a hidden gem.
The JDY-40 is a 2.4GHz RF transceiver module (similar to nRF24L01 but simpler) that operates as a transparent wireless serial bridge. Unlike Bluetooth, you don't need pairing; unlike WiFi, you don't need an IP address. You simply type on Serial on one end, and it appears on the other.
But many tutorials are confusing or present poor coding practices. This guide provides the best JDY-40 Arduino examples—from basic connection to advanced error checking.
Common Problems & Fixes
4.1 Transmitter Code
#include <SoftwareSerial.h>SoftwareSerial jdy(2, 3); // RX on pin 2, TX on pin 3
void setup() Serial.begin(9600); // Debug serial jdy.begin(9600); // JDY-40 UART Serial.println("JDY-40 Transmitter Ready");
void loop() static unsigned long lastSend = 0; if (millis() - lastSend > 2000) jdy.println("Hello from JDY-40!"); Serial.println("Message sent"); lastSend = millis();