Wireless USB communication?

Hello All,

Originally when I started this project, I posted on the Displays forum, but now that I’m in so much deeper, I think this is more of a general wireless serial communication situation.

I do sim racing, and I want to have a digital display on my steering wheel. There is a program called SimHub that has everything I need, and displays all information to the display when the sim is running. It uses a TTL to USB converter between my PC and the Nextion display, and works flawlessly while wired. The project I’m trying to do, is make that connection wireless.

I have no problem with providing a separate power source for the display, since it was getting its power before through being wired directly.

I have been messing with 2pcs of HC-05 / HC-06 Bluetooth modules and 2pcs of Nanos, and get the modules to connect to each other no problem. However, I seem to be missing something to be able to transmit the communication from the PC/master Nano side, to the digital display/slave Nano side.

I have seen all sorts of tutorials and sketches for using Bluetooth between two Arduinos to wirelessly turn on/off LEDs, using a potentiometer to control servos, etc.. but I can’t seem to figure out how to display live information on my digital display. It’s almost like I can’t do TTL input and get TTL output over Bluetooth.

Is this project even possible, or am I just chasing my tail? I am open to trying anything, and I also have the following hardware I can combine & use to go a different direction:

-Nano 33 BLE
-2pcs of Nano V3.0
-3pcs of Pro Micro
-3pcs of ESP8266 NodeMCU CP2102 ESP-12E
-2pcs of USB to TTL converter
-4pcs of NRF24L01 module
-2pcs of HC-05 Bluetooth module
-2pcs of HC-06 Bluetooth module
-4pcs of ESP8266 Serial WiFi module

Any help or direction is greatly appreciated. I don’t have any sketches I can provide, as the ones I’ve been working with have been copy/pasted and I’ve just been trying to alter them slightly to get what I need. But like I said, those examples were for simple functions, not constant TX/RX data transfer.

Another thing to mention: a COM port needs to be selected for the SimHub app to recognize the display. So I believe this rules out using any sort of Bluetooth or WiFi dongle.

Thank you!

That's a lot of words to say that you can't get serial data to pass between BT modules. You haven't provided the right information - connection diagram, sketch, baud rate settings etc.

You're probably just missing some simple setting, because serial through BT is dead simple.

@aarg, at least OP provided a background for what he/she is trying to achieve :wink:

@OP, expanding on previous reply, you might have incorrectly wired so we would like to see a complete wiring diagram for both sides (photo of a hand drawn one is fine); a common mistake is that one uses the hardware serial for both Bluetooth and USB communication.

Or you have a coding mistake, so that we also would like to see.

Thanks to the both of you for the responses.

Here is the tutorial I have been following up to this point: How To Configure and Pair Two HC-05 Bluetooth Module as Master and Slave | AT Commands - YouTube

The code being used is at 5:08. I am using his entire sketch, but need direction in the modifications necessary for it to be the USB/TTL data transmitted rather than servo & LED control.

Attached is a picture of how he has everything wired for his servo/potentiometer & led/button communication. I am doing the same, aside from the servo,pot,led,switch.

Am I correct in thinking in the sketches he has made, that I should just be able to adjust the pin outputs/input he uses for his specific project with what I’m looking to do? For example, instead the pot/servo/switch/LED, I can just adjust the code to input TX/RX on one Nano, and output that data on the other side?

I’m most confused on how to move forward with having one of my Nanos pull the data in though the USB port, and send it to the other Nano via Bluetooth, and then output that to my Nextion screen. Should I be looking to have my TTL to USB converter used on the input side rather than using the Nano’s USB port to achieve that?

My apologies for being so vague, I’m biting off more than I can chew. I appreciate any direction/suggestions/scolding that can be provided.

Thanks!

Do what what you want to do is just like the posted diagram except no pot, no LED, no switch and no servo and Nanos instead of Megas?

Please post a schematic for what you want with what you are going to use.

The serial input basics tutorial may help with the transferring of the data.

What is the data that you want to send between the Arduinos?

Thanks for the reply!

What I envision is this (not that it can necessarily be achieved):

  1. On the PC side, I have a Nano (with Bluetooth module) plugged directly in through USB.
  2. Then as a separate unit, I have another Nano with Bluetooth module in which I have my Nextion screen (using as a dash board for sim racing) connected to.

The goal is to send the data wirelessly that is displayed on the Nextion screen. Currently, everything works great with the Nextion screen plugged directly into my PC using a TTL to USB adapter (using an app called SimHub).

OK, can we start simple? You say that you have the 2 Bluetooth modules connected?

Here is a simple program that you can upload to both the Nanos for testing. What you type in one Nano's serial monitor should show up in the other Nano's serial monitor. Connect the Bluetooth module TX to Nano pin 4 and the Bluetooth module RX, through the voltage divider as shown on the Mega diagram, to Nano pin 5.
Make sure that both serial monitor baud rates are set to 115200. Set the baud rate for the Bluetooth modules in the BTserial.begin(baud rate) statement in setup() to the rate for which the modules are configured.

//Bluetooth Nano 
//Sends from serial monitor to the other Nano
//Receives from the other Nano

#include <SoftwareSerial.h>

SoftwareSerial BTserial(4, 5); // RX | TX

void setup()
{
   Serial.begin(115200);
   BTserial.begin(38400);
}

void loop()
{
   if (BTserial.available())
   {
      Serial.print(char(BTserial.read()));
   }
   if (Serial.available())
   {
      BTserial.write(Serial.read());
   }
}

This tests the connection and will show communication. Once you have this working we can move on to work with the actual data to be transmitted and the functions to make that data printable on your screen.

Can you provide a sample of the data to be transmitted? How is the data framed?

First of all, thank you so much.

I did everything you mentioned (using two separate PC's), and I definitely have a connection between both setups through Bluetooth. When I type into one serial monitor, the other serial monitor shows what I typed, and vice-versa. Although, only 3 characters maximum are showing up regardless of how many more than that I type. If that sounds right, then everything is working as it should be.

I'm not sure exactly what you're asking regarding how the data is framed for what I'm looking to transmit wirelessly, but I have attached a picture of how the display looks. If you're in need of more technical information, I'll do my best to get what you're looking for. I can also provide an information from the program & screen as everything works great when wired through my TTL to USB converter.

With me thinking ahead, I'm curious about a few things:

  1. When everything is said and done, will I be able to plug one of the Bluetooth-moduled Nano's into the PC through its USB port to pull the data, or would it be best to use my current TTL to USB converter?
  2. How exactly will I be able to wire the Nextion screen to the other Nano? Am I wrong in thinking that we're already occupying the TX/RX possibilities by bringing the data in from the Bluetooth module?

I'm not trying to jump forward too fast, but at least want to contribute some of my thoughts so it doesn't seem like I'm just a puppet :slight_smile:

Again, thanks so much!

dash.jpg

dash.jpg

Although, only 3 characters maximum are showing

I found that that happens when the baud rates between the BTserial and the hardware serial are too far apart. I fixed it by setting the hardware serial to the same as the BTserial.

//Bluetooth Nano 
//Sends from serial monitor to the other Nano
// receives from the other Nano

#include <SoftwareSerial.h>
SoftwareSerial BTserial(4, 5); // RX | TX

void setup()
{
   Serial.begin(38400);
   BTserial.begin(38400);

}

void loop()
{
   if (Serial.available())
   {
      BTserial.write(Serial.read());
   }
   if (BTserial.available())
   {
      Serial.print(char(BTserial.read()));
   }
}
  1. When everything is said and done, will I be able to plug one of the Bluetooth-moduled Nano's into the PC through its USB port to pull the data, or would it be best to use my current TTL to USB converter?

The Nano is not required to be between the PC serial port and the Bluetooth module. It is probably better to just connect the Bluetooth module to the PC through the USB to serial converter.

  1. How exactly will I be able to wire the Nextion screen to the other Nano? Am I wrong in thinking that we're already occupying the TX/RX possibilities by bringing the data in from the Bluetooth module?

You are right. Although one can run 2 instances of software serial it is not really a good thing. Better, for you, to use a Mega (or any other Arduino with multiple hardware serial ports).

I can set the baud rate on the BT module to whatever, so if you think 115200 is best, then I'll gladly go that route. Either way, I will equalize them.

Regarding the multiple serial ports on the Nextion's Nano, I also have a Nano 33 BLE. Would that be a way for me to still connect via BT, while keeping the TX/RX open to plug the Nextion into?

Using SoftwareSerial the highest baud rate that you can use for reliable communication is 38400.

I know nothing of the Nano 33 BLE. Nor do I have any experience with the Nextion display. I can help you to establish the Bluetooth serial connection between the Nanos. Not much help beyond that.

No problem at all, thank you for all your help up to this point!

I have a Mega on the way just to be safe.

When it comes to the serial sketch, I assume I'll have to make adjustments to let the Mega know that the any info provided through the BT module will be converted to output for the LCD to display? I know you said you don't have any experience with them, but just talking about general serial data (or at least that's how I'm interpreting it).

As always, thank you very much!