Wireless Communication Made Easy: Connecting Your Jetson Nano with HC-05 Bluetooth Module or Wi-Fi — Part 2

Esraa Abdelnaby
5 min readMay 25, 2023

In PART 1, I gave an introduction to communication protocols and explained the direct solutions to interface HC05 with Jetson nano. In PART 2, I will cover two additional undirect solutions for interfacing HC05 with Jetson nano.

Solution 3: Interface the Bluetooth with Jetson NANO via Arduino

Picture a conductor leading an orchestra — that’s what Arduino is like when interfacing the HC-05 with Jetson Nano! It acts as the mediator, facilitating a harmonious conversation between the two devices. Using the HC-05 Bluetooth module, the Jetson Nano can communicate wirelessly with other devices, expanding its capabilities. But it’s the Arduino board that enables this communication by translating and directing the signals between the two. It’s like a translator who can speak both Jetson Nano and HC-05 languages fluently. With Arduino’s flexibility and adaptability, it’s like the conductor who can adjust the orchestra's sound to perfectly match the mood of the music. So, let Arduino be your maestro and lead the way in interfacing HC-05 with Jetson Nano!

Prerequisites:

  1. Jetson Nano Developer Kit.
  2. Arduino Uno board.
  3. HC-05 Bluetooth module.
  4. Breadboard and jumper wires.
  5. USB cable for power supply and data transfer.

Wiring:

  1. Connect the GND pin of the Arduino board to the GND rail of the breadboard.
  2. Connect the VCC pin of the HC-05 module to the 5V rail of the breadboard.
  3. Connect the GND pin of the HC-05 module to the GND rail of the breadboard.
  4. Connect the TXD pin of the HC-05 module to the RX pin of the Arduino board.
  5. Connect the RXD pin of the HC-05 module to the TX pin of the Arduino board.

Steps:

>> Preparing Arduino:

  1. Install the Arduino IDE on your computer and connect the Arduino board to your computer using a USB cable.
  2. Open the Arduino IDE and select “Tools” > “Board” > “Arduino Uno” and “Tools” > “Port” > select the port for the Arduino board.
  3. Open a new sketch and copy the following code into it:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
char c = Serial.read();
Serial.write(c);
}
}

4. Click “Upload” to upload the sketch to the Arduino board.

5. Disconnect the USB cable from the Arduino board.

>> Interface with Jetson

6. Connect the HC-05 module to the breadboard as described in the wiring section above. check this article to test the HC05 with Arduino before going further in the upcoming steps “Bluetooth for Arduino in 10 Minutes

7. Connect the USB cable to the Jetson Nano to provide power to the Arduino board.

8. On the Jetson Nano, open a terminal window and run the following command to install the PySerial library:

sudo apt-get install python-serial

9. Run the following command to find the port for the Arduino board:

dmesg | grep tty

The output should include a line similar to the following:

[    6.222357] usb 1-2: cp210x converter now attached to ttyUSB0

Note the port number (in this case, “ttyUSB0”) for use in the next step. and it maybe different in your project; so, in step 11 add your port number.
to make sure that port number you chose is the one connected to arduino, you can do step 9 when arduino is disconnected and do it again when it’s connected.

10. Create a new Python file and copy the following code into it:

import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)
while True:
ser.write(b'Hello, world!')
data = ser.readline()
print(data)

11. Replace “/dev/ttyUSB0” with the correct port number from step 9.

12. Save the Python file and run it in a terminal window on the Jetson Nano.

13. The Python script will display any data received from the HC-05 module over the Bluetooth connection.

Troubleshooting

If the HC05 is not working; it doesn’t send or receive data! the following steps may help:

  1. First, ensure that the HC05 module is connected correctly to both the Jetson Nano and the Arduino Uno. The VCC and GND pins of the HC05 module should be connected to the 5V and GND pins of the Arduino Uno respectively, while the TXD pin of the HC05 should be connected to the RXD pin of the Arduino Uno, and the RXD pin of the HC05 should be connected to the TXD pin of the Arduino Uno.
  2. Connect the Arduino to your laptop, then open the Arduino IDE and upload the following sketch to the Arduino Uno:
void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Hello World!");
delay(1000);
}

3. Open a terminal window on the Jetson Nano.

4. Install the screen utility if it still needs to be installed. You can do this by running the following command:

You don’t need to install Screen if it’s already installed or you can use minicom or Putty or any alternative you have.

sudo apt-get install screen

5. Find the serial port to which the HC05 module is connected. You can do this by running the following command:

dmesg | grep tty

This command will show you a list of all the available serial ports on the Jetson Nano. Look for a line that mentions “USB Serial Device” or “Arduino” to find the serial port to which the HC05 module is connected. Note down the name of the serial port (e.g. /dev/ttyUSB0).

6. Run the following command to open a serial terminal on the Jetson Nano:

screen /dev/ttyUSB0 9600

Replace /dev/ttyUSB0 with the name of the serial port that you found in Step 5. The 9600 parameter sets the baud rate of the serial terminal to 9600.

7. Power on the Arduino Uno and the HC05 module. By connecting the Arduino again to Jetson Nano

8. If the HC05 module is configured correctly, you should see “Hello World!” being printed repeatedly on the serial terminal of the Jetson Nano, with a delay of 1 second between each print.

9. If you don’t see any output on the serial terminal of the Jetson Nano, or if the output is garbled, it may indicate that the HC05 module is not configured correctly, or that the baud rate or other settings are not set correctly. In this case, you should try reconfiguring the HC05 module or adjusting the settings on both the Jetson Nano and the Arduino Uno until the communication works correctly.

More solutions will be explained in Part #3.

--

--