Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BT power level #4019

Merged
merged 1 commit into from
Sep 23, 2023
Merged

Fix BT power level #4019

merged 1 commit into from
Sep 23, 2023

Conversation

b14ckyy
Copy link
Contributor

@b14ckyy b14ckyy commented Sep 6, 2023

Summary of changes:
For years I had trouble with bluetooth range and reliability on my modded TX16S with X10S module until I now finally discovered that EdgeTX sets the BT transmission power to -23dBm by default. This did not allow any connection with more than 2-3m range and even then it is unreliable with the slightest interference. I changed the power level to the CC2540/CC2541 default power level 2 (0dBm) and now I have perfect range and a reliable connection that goes through 2 rooms of my apartment.

1mW power should not interfere with any RC link but might need testing. Maybe add a option to configure the power in the GUI.

@Eldenroot
Copy link
Contributor

Custom settings in GUI would be nice.

@pfeerick
Copy link
Member

pfeerick commented Sep 7, 2023

Nice find! :) It's been that way since OpenTX 2.3.0 from the looks of it... opentx/opentx@9189e43 ... prior to that it seems like it was incorrectly set (not since day one as the commit suggest, seemingly a few months earlier) opentx/opentx@b7ab0e9 ... and prior to that it was AT+TXPW3 but was changed at FrSkys request (as at that point in time only their radios had bluetooth anyway).

If we make it configurable, that would resolve the testing requirement, however unlikely the impact. Any idea what values are valid for TXPW?

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 7, 2023

@pfeerick Unfortunately FrSky grinds off the chip markings so I am not sure what chip it exactly is. Based on the time frame it was released and the AT Commands available I Assume its a CC2540 or a CC2541. Based on the HM-10 specs with the same chip Power levels can be from 0 to 3 while they are by default on 2.
0 = -23dB
1 = (can't remember right now)
2 = 0dB
3 = 6dB

I did some dBm range testing with a BTLE Radar app and with power level 2 it has much higher dBm readings at a given distance than a HM-10 module already. Might be because I have a 2.4GHz receiver antenna installed to it while the HM10 is just a PCB trace.

I think 6dB might be too much if someone does not attach an antenna to it (if its a mod) and could fry it. I think 0-2 adjustable should be fine and 1mW gives plenty of range.

EDIT: Maybe a power level configuration is not actually necessary. Let me do some noise checks with the multi module spectrum analyzer and also with a second radio on power level 1 and 2.

Not sure if the internal BT Module power can be switched off/on. If not maybe just change the power level to 0 if Bluetooth is not set as trainer/telemetry at all and switch to level 1 or 2 if its actually enabled.

I thought about switching power up as soon as another device binds but as with the HM-10, AT commands are blocked as soon as a connection is established.

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 7, 2023

@pfeerick I just did some spectrum testing. Spectrum analyzer directly touching the side of the TX16S while Bluetooth is sending active telemetry to the tracker. The data pulses are barely visible. Even my 5m distant wifi rounter causes way higher peaks and activity in the 2.4GHz band and when enabling the internal MPM of the TX16S it had signal spikes all over the place above the scale.

So with barely any visible signal noise on the spectrum analyzer I think the 0dBm setting is totally fine. additionally bluetooth uses channel hopping anyway so it should never interfere with other 2.4GHz systems. More likely the opposite at high RC Link power.

might need testing on FrSky radios with bluetooth from factory. I will put a build on my X-Lite Pro and check

@Helipro
Copy link

Helipro commented Sep 12, 2023

This is awesome. I always get Bluetooth annoying disconnects with my Bluetooth head tracker on T16smk2 & T16.
Would this also work on the frsky para Bluetooth with the CC2650 chip?
The para Bluetooth CC2650 has slightly better range than the CC2540 chip but is 4 times the price from the horusrc.com store.

@robustini
Copy link
Contributor

robustini commented Sep 12, 2023

A topic I raised at the time in OpenTX, I also opened an issue on the blatant problem in trainer mode, which exists but is virtually unusable.
Without the bluetooth firmware source codes not much more can be done, it would be time for FrSky to at least release them to the EdgeTX development team, damn!!!
With the available sources, absolutely useful features could be implemented and the trainer improved.
FrSky when will you wake up from this hibernation?

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 12, 2023

This is awesome. I always get Bluetooth annoying disconnects with my Bluetooth head tracker on T16smk2 & T16. Would this also work on the frsky para Bluetooth with the CC2650 chip? The para Bluetooth CC2650 has slightly better range than the CC2540 chip but is 4 times the price from the horusrc.com store.

The wireless trainer under OpenTX only ever worked in one direction with my X-Lite Pro. So I always only could have the X-Lite as the Master/Trainer Radio and the TX16S as a slave. Not the other direction. I never got movement. But I have not tried that yet with EdgeTX.

@Helipro
Copy link

Helipro commented Sep 12, 2023

The wireless trainer under OpenTX only ever worked in one direction with my X-Lite Pro. So I always only could have the X-Lite as the Master/Trainer Radio and the TX16S as a slave. Not the other direction. I never got movement. But I have not tried that yet with EdgeTX.

Shame on the x-lite. Years ago when I added the Bluetooth I quickly found out the Bluetooth was not reliable for a trainer so I just my 4in1 or use radiomaster Wt101 Dongle for my trainer.
The Bluetooth was reliable enough for a head tracker if your hand doesn't get in the way of a direct signal so I put the Bluetooth at the center top. Couldnt move Bluetooth on Jumper T16, but on the T16s Mk2 you can put it anywhere.
The para Bluetooth has better range.
I also have less disconnects after adding 10uh 100ma choke lines.
https://headtracker.gitbook.io/head-tracker/getting-started/wiring/option-1-bluetooth/adding-a-frsky-bt-module

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 12, 2023

@Helipro Interesting that in the pictures for the MK1 (that's how I installed mine) your module has no U.FL connector. Mine has one where I conencted a old FlySky whip antenna. I ordered some flexible sticker antennas for it from Ali.

This is how mine looks like:
image
image
image

Seems like it is the Para module?
With the MK2 radio it seems to be easy to just install a HM10 inside?

@Helipro
Copy link

Helipro commented Sep 12, 2023

@Helipro Interesting that in the pictures for the MK1 (that's how I installed mine) your module has no U.FL connector. Mine has one where I conencted a old FlySky whip antenna. I ordered some flexible sticker antennas for it from Ali.
Seems like it is the Para module? With the MK2 radio it seems to be easy to just install a HM10 inside?

There are 2 versions from horusrc, you have the CC2540 chip which is the older Bluetooth, the newer para module doesnt have an antenna connector as the antenna is built in and you get better range. You dont have to install your Bluetooth to the board as you did but very nice soldering, all you need is ground 3.3V tx and rx. The tx and rx pad are at the top of the mark 1 board.
I had no luck programing a HM10 but some others I found online were able to do it. When programed it must be slave or master. Frsky Bluetooth can easily switch in the tx between master/slave/telm. I do like the telemetry viewer app and my Bluetooth head tracker and I can switch back and forth with ease as most of my models dont have head tracking.
The head tracking cable always in the way, so must have Bluetooth!

I would be happy test the new Bluetooth setting. I have both the CC2540 chip in my Tx16s and the CC2650 chip in my jumper T16.

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 12, 2023

@Helipro I can send you my TX16S 2.9 build if you want.
My Goggles are O4X so I usually use the integrated gyro with a cable but I also have just one plane with Pan and Tilt. When I fly this plane I then also usually fly that with the Tracker so I can't use wireless HT ^^

but in case I will use more planes with P&T on other planes, is there a way to install your tracker module in the second VRX Bay or is the board too big?

1mW BT Build: EdgeTX-2.9-TX16S-BT-highPL.zip

@robustini
Copy link
Contributor

Custom settings in GUI would be nice.

+1

@Helipro
Copy link

Helipro commented Sep 12, 2023

@Helipro I can send you my TX16S 2.9 build if you want. My Goggles are O4X so I usually use the integrated gyro with a cable but I also have just one plane with Pan and Tilt. When I fly this plane I then also usually fly that with the Tracker so I can't use wireless HT ^^

but in case I will use more planes with P&T on other planes, is there a way to install your tracker module in the second VRX Bay or is the board too big?

1mW BT Build: EdgeTX-2.9-TX16S-BT-highPL.zip

Thanks b14ckyy for the 1mw build. Installed and I get about 3 times more range on this 1mw Bluetooth power. Awesome.
Thanks b14ckyy. Also there is no way to install the DTQSYS head tracker in the googles as it is to big. It must be installed on the outside. They do make smaller modules. I installed mine on the head strap. See pic. My skyzone goggles have a headtracker built in but the DTQSYS head tracker is better software and has bluetooth.
2023-09-12 16 33 43

4
Through bench testing I can confirm that the 1mw blue tooth range is tripled on the para bluetooth chip CC2540. The signal now penetrates through my hand and through a wall. Super exciting. Thanks b14ckyy.

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 18, 2023

Guys I have a question. I still have telemetry reliability issues. But ONLY with R9 ACCESS on the external module. The Telemetry rate is just 0-1Hz and I constantly get transmission errors.

I tested the same thing today with a 2.4GHz ACCST Receiver with the internal MPM and it worked flawlessly. Locked 4Hz update rate, no errors, no delay.

Looking in the code I see that the baud rate for bluetooth is fixed at 115200kbit. I remember back when I had the X9D with a bluetooth mod and a HC-05 pair to the tracker I did not have these issues but the X9D was running at 57600 baud. SmartPort Telemetry also is by default on 57600 baud. Could it be that the module sends telemetry to the radio at 57600 and the Radio then forwarding that at 115200 to the bluetooth module causes packet corruption?

I will try to change the baud to 57600 and see if that changes anything. If this is the case we might need to do a dynamic baud rate change based on the used protocol.
I am waiting for SMD Parts and PCBs to build some SmartPort inverters so I can connect the tracker directly to the R9 SmartPort output to rule out the radio forwarding.

@pfeerick
Copy link
Member

This is something @rotorman may be able to investigate with you, as I don't use Bluetooth (yet) for anything. But for now, I'll merge this PR as is, as configuration options can wait until someone wants to implement it, and it's easy enough to revert this if it is a problem.

@pfeerick pfeerick added this to the 2.10 milestone Sep 23, 2023
@pfeerick pfeerick merged commit 5597cf6 into EdgeTX:main Sep 23, 2023
36 checks passed
@rotorman
Copy link
Member

I have only used FrSky CC2540 Bluetooth module in combinaton with Arduino Nano 33 BLE Headtracker https://headtracker.gitbook.io/head-tracker-v2.2/
If configured correctly, HC-05 should on the other hand work as a wireless cable replacement and not require a Bluetooth enabled EdgeTX firmware (which activates a specific AT command set for communication https://www.rcgroups.com/forums/showpost.php?p=46878713&postcount=9918 )
Only, if the telemetry would work first with pure cable connectivity, I would try to add HC-05 into the mix.

@b14ckyy
Copy link
Contributor Author

b14ckyy commented Sep 23, 2023

@rotorman yes I have parts and PCbs on my way to build SmartPort inverters as I need a few anyway. I will test with a cable connection. If the problem is the same issue appears when taking telemetry right out of the SmartPort wire of the R9 module, there is nothing I can do about it. If it is stable there, I try to mess with the code as far as I can or open a issue ticket.

I know a HC-05 worked well on my X9Ds telemetry mirror port but as 2.4GHz ACCST in the MPM also works with the CC2540 works perfectly fine, I see no point to use an external BT module before investigating where the problem is.

@Helipro
Copy link

Helipro commented Sep 25, 2023

@b14ckyy I flew this weekend with r9 external access mod, head tracking bluetooth on the para module with chip CC2650 and had no disconnects during the whole flight. I would say much improved. I am interested to know what you find out with the baud rate in conjunction with the r9 access mod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants