I use as a Bluetooth module a HC-06 with 9600 baud rate.
The communication with my app actually works properly, only in rare cases, if the Bluetooth device is installed in some oldtimer car, the communication is disturbed.
I wonder if the communication improves if one Baud setting is listening, for example to 57600 baud rate, whether it becomes better or not.
When one controller communicates with another one the baud rates have to match within a few percent. Some combinations are very bad, other even at much higher values might be better or even perfect. (I never use low buad rates, best works for me at 921600 or so from AVR (using ATXMEGA) to HC05). The communication consists of a series of pulses with certain frequency that depends on the controller baud rate as being set and CPU's running frequency. Both seldom fit perfectly. Assuming your HC baud rate exactly is as stated (also is matter of chance) you can choose a good combination of baud rate and frequency of your controller. Sometimes I have to change the running frequency of the CPU in small steps to watch the transmission. I print the Crystal frequency (stepped in small steps) and see when the text becomes readable at a certain frequency.
I did not use B4R or Arduino for those projects (Bascom compiler), you have to be able to change the oscillator frequency by "oscal" command, so I don't have an example at hand, but in Arduino-world that should exist.
Here is some calculator, there are lot of others.
Unless you use a good combination of those two quantities you will not have a stable communication. http://wormfood.net/avrbaudcalc.php
Just digged out this example for Attiny841 (Osccal0 is specific for that controller)
B4X:
Zero = Osccal0
For count= Zero To 200 Step 2 : Osccal0 = count: print #1,count: Next
you might check if with prototype device you can get stable transmission as I outlined.
maybe when you have found an optimal combination that setting will work more generally.
you might check if with prototype device you can get stable transmission as I outlined.
maybe when you have found an optimal combination that setting will work more generally.
The communication with my app actually works properly, only in rare cases, if the Bluetooth device is installed in some oldtimer car, the communication is disturbed.
I think the interferences perhaps come from certain spark plugs,
because with most oldtimer cars there are no problems.
The question is: can the interferences of these spark plugs be filtered out?
The big factor is if you are using hardware serial ports or software ones. Software get's unreliable above 9600. Hardware can go easily to 115200. Arduino's (nano's and so on) only provide software serial while the mega and due have hardware serial ports.
Faster data rates also require better time sensitive code. The Due is 4x faster than the mega or arduino (random PI benchmark), so it will give you more latitude to be sloppy.
many thanks for your response.
I use an Arduino-nano and connect the 2 ports (RX + TX) with the HC-06, the baud rate stays at 9600.
So the transfer should actually remain problem-free.
Hi Filippo.
You cannot trust a TTY protocol . Some more evoluted packet protocol should solve any issue.
Using low rates(<= 9600) I was able to transfer programs from a PC to thousands of CNC using a simple 3 wire RS232 on cables longer than m.100. But I had USART's on both side. And suitable XTAL's as well!