Currently, I am working on a project where I am trying to send data at a baud rate of 230400 or 250000. This works when the Arduino is wired to the computer. The data is received through a MATLAB code and the data is read by an Arduino program.
However, when I use an HC-05 Bluetooth module I can only send data when using a baud rate of 115200 across all programs. But when I program the module to 230400, as well as the MATLAB and Arduino, I do not receive the correct data. I programmed the Arduino to send flaggers after every 3 bytes of data, but I do not see any flaggers in MATLAB when the baud rate is 230400. I am receiving data, but I am not sure what it is since I do not see the flaggers. I am unsure where the issue is if it is the computer, the Bluetooth module, MATLAB, or Arduino. Please let me know how I can receive the correct data, or where the problem most likely is.
Apparantly changing the baud rate on various HC-05 modules may differ - how are you doing this?
What are flaggers?
Bd is the symbol for baud, not Ba.
elainewong756:
I am unsure where the issue is if it is the computer, the Bluetooth module, MATLAB, or Arduino.
The baud rate only applies to comms between Arduino <> HC-05, so both computer and MatLab are innocent.
elainewong756:
But when I program the module to 230400, as well as the MATLAB and Arduino, I do not receive the correct data.
Incoherent but, assuming MatLab is running under Windows, and you are referring to that, you should check that windows is OK for 230400. I understand 115200 is the maximum.
To change the baud rate I used this guide by Martyn Curry Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE | Martyn Currey. As for flaggers I am sending a Serial.write(1) through Arduino after every 25 bytes of data.
How can I check that windows is okay for 230400? My program runs if I just use the hardware serial at 230400, but it won't run with the bluetooth module. So I assume windows should be fine and it's the bluetooth module that's the issue.
elainewong756:
My program runs if I just use the hardware serial at 230400,
If, by this, you mean you are successfully sending data via USB cable at 230400, then you have all the proof you need that 230400 is kosher with Windows. You also have proof that using serial.write rather than serial.print is OK.
You might try an AT+UART? again, just to make sure that you really have set Bluetooth to 230400.
Yes, I am sucessfully sending data through USB cable at 230400. So I guess this confirms it's the Bluetooth that's the issue?
I have tried the AT+UART? whenever I change the baud rate to make sure I changed it correctly. It still doesn't change anything though. I do get data from the Bluetooth when it's at 230400 but the data appears to be garbage to me, since it's not the same as the USB cable version.
OK, I guess you have proven Bluetooth's baud rate is correct, and also proven your wiring is kosher, but you haven't yet proven that Bluetooth isn't. I think it is time you came forth with the code which, to prove the point, needs to be the same for USB cable and Bluetooth. Please don't tell us you are running Bluetooth on software serial. You might connect the serial monitor to read the outgoing. If the data is read on the monitor but still not received, it may point to Bluetooth being suss, but does not prove it. A plain old looped "hello" is better for that.
Let your HC-05 baud rate to 115200 or lower.
Use Virtual serial port emulator, it free for windows 32bit (license key included in downloaded zip), for 64bit need to purchase the key.
Create COM splitter, uncheck the "Redirect modem registers" option.
In setting of serial port source set same as your HC-05.
After start emulation COM source will no longer accessible, but virtual COM will accessible by multiple software at same time.
I use this emulator, my device baud rate is 9600 but data still readable in hyperterminal until max baud rate 921600.
I hope the above link may help you in any way
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.