Skip to content

Simple Wireless Serial Communication

Notes on basic setup & testing of the JDY-40 wireless serial port module. These are simple wireless serial communication modules that work fairly well and don’t require much power to operate.

Supplies

  • 2x JDY-40 units
  • 2x Serial to USB adapters
  • Breadboard + Jumper wires
  • Computer with PuTTY/Gnu Screen/Arduino IDE or similar serial interface

Basic Transmission Setup

  • Connect JDY-40 TX/RX to Serial adapter RX/TX
  • Connect JDY-40 “CS” pin to breadboard ground rail (awake)
  • Connect JDY-40 “Set” pin breadboard power rail (transmission mode)
  • Connect JDY-40 “Vcc” to breadboard power rail
  • Connect JDY-40 “Gnd” to breadboard ground rail
  • Set Serial to USB adapters to 3.3v and connect breadboard power rail
  • Connect Serial to USB ground to breadboard ground

Repeat for a second unit to communicate with.

Data Transmission

Plug the serial USB adapters into a computer (or two separate computers if you like). Open a serial tty session for each adapter. Default baud rate is 9600. For Arduino IDE or PuTTY, select the appropriate COM port (windows) or /dev/tty.* port (Mac/Linux) and baud rate.

For GNU Screen it will be something like this

> screen /dev/tty.usbserial-A50285BI 9600

Whatever text is entered into one unit will be received on the other unit and sent out to the serial adapter on the other end.

Multiple Receive Units

In a configuration with three JDY-40 units, when on broadcasts a message it will be received by both of the other two units as long as they are all configured correctly (same RFID, DVID, and RF Channel). I only have three units to test with so I can’t confirm a higher number of units, however I see no reason why they would not be able to broadcast in a one-to-many configuration.

Configuration With AT Commands

The AT commands are used to configure the JDY-40. This can be used to configure or query the following settings:

  • Baud rate: AT+BAUD<baud_rate_index>
  • Wireless ID: AT+RFID<wireless_id>
  • Device ID: AT+DVID<device_id>
  • Radio Channel: AT+RFC<channel_index>
  • Transmit Power: AT+POWE<transmit_power_index>
  • Operation mode (CLSS Type): AT+CLSS<class_type>

Sending the command without a parameter queries the current setting. For example sending “AT+BAUD” with no parameter after will return the result “+BAUD=4” if using the default baud rate of 9600 which maps to BAUD=4.

> AT+BAUD
+BAUD=4

AT Command Line Endings

Note that the AT commands must be terminated with “/r/n”. I was unable to do this with GNU Screen on my Mac OS terminal and so I switch to using Arduino IDE for sending AT commands.

AT Mode to Transmission Mode

The JDY-40 cannot go from transmission mode to AT mode without resetting the device. However, you can start in AT mode and then go to transmission mode. This is the sequence that seemed to work for me to go from AT mode to transmission mode.

  1. Start in AT mode (CS low, Set low)
  2. Go to sleep (CS high, Set low)
  3. Switch to transmission mode (CS high, Set High)
  4. Wake up ready to transmit (CS low, Set High)

AT Command Setup

Use the same setup as above except pull the JDY-40 “SET” pin low.

  • Connect JDY-40 TX/RX to Serial adapter RX/TX
  • Connect JDY-40 “CS” pin to breadboard ground rail (awake)
  • Connect JDY-40 “Set” pin breadboard ground rail (AT mode)
  • Connect JDY-40 “Vcc” to breadboard power rail
  • Connect JDY-40 “Gnd” to breadboard ground rail
  • Set Serial to USB adapters to 3.3v and connect breadboard power rail
  • Connect Serial to USB ground to breadboard ground

Notes on Some of the AT Commands

Baud Rate

The JDY-40 baud rate can be set to the following options with the “AT+BAUD<baud_rate_index>”

  1. 1200
  2. 2400
  3. 4800
  4. 9600
  5. 14400
  6. 19200

For example sending the command “AT+BAUD6” which in AT mode will set the JDY-40 baud rate to 19200.

Keep in mind that when changing the baud rate of the JDY-40, it changes the baud rate of both transmission mode and AT mode. So, after changing the baud rate with an AT command the serial adapter will get an “OK” response in the current baud rate, however the baud rate of the serial adapter must be changed to match the new baud rate before sending any other AT command.

RFID and DVID

The data sheet doesn’t explain these configuration parameters much. They can each be any 16-bit integer value. I found that RFID and DVID must both match between JDY-40 units in order for transmission to be received. I’m not sure what the difference is between the two parameters, as they seem to play the same role.

Radio Channel

There are 128 different radio channel options. I don’t know what frequency ranges these channels map to. I found that the JDY-40 units did not have to be on the exact same channel in order to communicate. As long as they were within 2 or 3 channels of each other, they worked fine. Of course being on the same channel is ideal and should reduce the amount of data loss.

If you are configuring multiple links then each link should ideally be on channels with a good amount of separation (6 or more channels apart) to avoid interference between the separate links.

Transmit Power

There are 10 different transmit power options (0-9). By default the JDY-40 is set to use the highest power option. I left this at the default for all of my testing so far.

With default settings I measured the following current draw for each unit using a USB power meter. Note that this is measured at 5V before the 3.3V regulator on the serial USB adapter.

  • 0.013 A @ 5V IDLE (65 mW)
  • 0.016 A @ 5V Transmitting OR receiving (80mW)

Device Type

By default the JDY-40 is in transparent transmission mode, meaning that it operates as if there were a serial connection between the wireless units. The data sheet describes several other modes of operation using the 8 GPIO pins. I have not yet tested any of these other modes.

Leave a Reply

Your email address will not be published. Required fields are marked *