0

Just bought HC-05 bluetooth adapter from Ching and I wonder how fast HC-05 is if I can do logging with it?

Assume that we have a PC and a microcontroller. The PC have a FTDI232 connected to the USB port and the FTDI232 is connected to the HC-05 and I send values from the PC to the microcontroller, who also have a HC-05 connected to one of its UART:s.

Is that a proper way to logging wirelessly if I want speed? I have a 10 ms limit. Better to use USB cable directly to the microcontroller from the PC and replace the PC with a Raspberry Pi?

The goal is to have a equipment that are portable. But I will first check if HC-05 is a good choice.

What to do:

I want to setup a communication line between a PC and a microcontroller. The PC will have a FTDI232 + HC-05 connected and the microcontroller will only have the HC-05 connected to one of its UART:s.

Reason why I'm asking: I plugged in the FTDI232 to the USB port of the computer and then I connected the HC-05 to the FTDI232. Then I send the text to the USB port "AT+HELP\n" and I did get a list of commands.

When I notice is that the list was displaying quite slowly. So that's make me wonder if the HC-05 is slow or is it fast and something else cause the slowness?

Because I'm used CuteCom for talking to the FTDI232 chip and CuteCom is really fast and the FTDI232 is super fast. So that leave the HC-05 as the only choice left. Can it be HC-05 is a slow product in communication?

euraad
  • 1,025
  • 11
  • 30
  • 1
    "logging": logging what? "I want speed": what's *speed* to you? 100 B/s? 10 MB/s? 10 GB/s? It's totally not clear what your overall goal is, and you're basically just listing things that you want to connect without telling us what that all is for, so we really need more input from your side to help you. – Marcus Müller Jun 10 '20 at 11:37
  • @MarcusMüller This question is based on experience. If you have used HC-05 before and tried to do sampling with 10 ms sampling time and it was not possible, then you know that HC-05 will not work for 10 ms sampling time. The baudrate 11520 b/s. But even if 11520 is a very large number, it does not mean it will come 11520 bytes per second in reality. Something else can cause trouble e.g slow communication. – euraad Jun 10 '20 at 11:43
  • 1
    Sampling?! It's still not clear what you want to do. Please describe your overall system (what does what, what kind of constraints do you need to achieve, what is the overall purpose) *in your question* rather than the comments, please! – Marcus Müller Jun 10 '20 at 11:44
  • @MarcusMüller Done. – euraad Jun 10 '20 at 11:51
  • Who is "Ching"? Where's the data sheet links? Have you read the data sheets? Is it an EE problem? – Andy aka Jun 10 '20 at 11:54
  • 11520 baud (which is a non-standard rate) gives you 115 bits (about 11 bytes) in your 10 ms timeframe. Is that enough for your requirements? Can you set the baud rate to something higher like 115200 (a standard rate)? –  Jun 10 '20 at 11:57
  • @BrianDrummond Sorry. I mean 115200. – euraad Jun 10 '20 at 12:01
  • If you system is timing critical you probably want to build the air protocol yourself around a more barebones radio, for example nRF24L01+ or similar. You'll particularly need to decide what to do in the case of data loss - do you want to keep trying to get that increasingly stale data through, or do you want to drop it and send fresh data instead? Do you maybe store a backlog on the device and try to fill in later? Bluetooth is probably not going to answer *any* of these questions in the way you actually want. – Chris Stratton Jun 10 '20 at 13:59
  • @ChrisStratton Got a good answer already :) – euraad Jun 10 '20 at 14:04
  • @DanielMårtensson the post to which you refer pretty much ignored the issues and solutions I was pointing out. – Chris Stratton Jun 10 '20 at 14:08
  • @ChrisStratton I'm talking about practical experience about HC-05. – euraad Jun 10 '20 at 14:12
  • Mostly what you are doing is demonstrating an approach which makes this is an off topic *usage* question and not an on-topic *design* question. – Chris Stratton Jun 10 '20 at 14:13

1 Answers1

1

"HC-05" is a tag used for many Bluetooth modules, and they aren't all born equal. Having said that:

  • HC-05 modules can be configured to use a UART speed of 460,800 kpbs, in some case even higher.
  • HC-05 modules support Bluetooth 2.1 including Enhanced Data Rate (EDR). EDR has a theoretical maximum data rate of 2.1 Mbps.

You mention a limit of 10ms. Does that mean sampling every 10ms (throughput) or sampling every so often and transmitting the result within 10ms (latency)?

Both should be possible:

  • Throughput: If data is sampled every 10ms and your sample consists of 20 bytes of data, a data rate of 20,000 bps is required.
  • Latency: A maximum latency of 10ms for a packet of 20 bytes is achievable. Note that the HC-05 module does not know when a packet starts or ends. So it has a heuristic for determining how much data to collect and when to start transmitting. You have to test if that is a problem for your particular module. I don't expect so.

The reason that your module feels slow is that the default UART speed is usually 9600 bps, i.e. rather slow.

Update

The FTDI232 will also introduce a delay. As a USB slave device, it may only talk when asked by the USB host, which it does every 1ms.

Most likely, the slave will receive a single byte and forward it to the host when asked. After that, there is a communication pause of 1ms. By then it should have received several bytes and transmit them in the second USB packet. So expected a delay on the receiver side of up to 2ms for for 20 bytes of data.

Codo
  • 2,038
  • 8
  • 14