Formula Allcode losing bluetooth connection

For general Flowcode discussion that does not belong in the other sections.
D_Addow
Posts: 8
http://meble-kuchenne.info.pl
Joined: Wed Mar 20, 2024 2:12 pm

Formula Allcode losing bluetooth connection

Post by D_Addow »

Hi there,

I am using the Formula AllCode robotic car for a university project where I create an app that can control the function of the car. Currently however, I am having struggles with the car in connecting to my laptop via bluetooth.

When I initially pair my laptop and device together, it connects successfully. However, straight after that, the device disconnects. I suspect as it's not an regular device such as a speaker or TV to connect to, the connection is being lost immediately. My laptop is a HP Pavilion Laptop 14.

The software I am using to try and control the car is Python. The software I am using to make the app is Android studio however I am only designing the app right now, no connection between the app and car has been attempted yet.


What do you think my issue is here? Could it be a Bluetooth driver issue or something else potentially as I have tried to connect the car to my phone also and get the same outcome, which is the car connecting then disconnecting almost immediately after.

Kind Regards,
Daniel

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Formula Allcode losing bluetooth connection

Post by BenR »

Hello Daniel,

When you pair the device it should create a pair of COM ports in your device manager. You then need to open the outgoing port to estabish a connection with the robot. The curriculum for the robot shows how to determine the correct port and how to assign this port in the various programming methods.

Hope this helps.

D_Addow
Posts: 8
Joined: Wed Mar 20, 2024 2:12 pm

Re: Formula Allcode losing bluetooth connection

Post by D_Addow »

Hi Ben,

I have already modified the code to assign it to the COM port of the robot thanks, however the issue is that a connection is being established with my laptop and the robot but not long enough for me to run the code. It only connects for a split second the disconnects again.

Is there anything else that may be stopping the robot and laptop from establishing and maintaining a connection?

Kind Regards,
Daniel

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Formula Allcode losing bluetooth connection

Post by Steve-Matrix »

The instructions for pairing the buggy on a Windows PC are on p11 and p12 of this document.

Where exactly is the process failing for you? Presumably it's during step 2. If so, are you getting an opportunity to enter a pairing code and/or getting a pairing confirmation message?

D_Addow
Posts: 8
Joined: Wed Mar 20, 2024 2:12 pm

Re: Formula Allcode losing bluetooth connection

Post by D_Addow »

I can get passed the step with the pin which I can enter and the car will connect. In the next step to see which COM port the outgoing is, I can see that as well. It's after that the car just suddenly disconnects.

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Formula Allcode losing bluetooth connection

Post by Steve-Matrix »

By "disconnect", do you mean "unpair"? And during this process, are you trying to connect tot he specific COM port being used by the buggy?

D_Addow
Posts: 8
Joined: Wed Mar 20, 2024 2:12 pm

Re: Formula Allcode losing bluetooth connection

Post by D_Addow »

Yes I mean unpair sorry. When the pin is entered and the car and laptop pair, it unpairs for no reason.
Also in regards to the COM port yes also, the "outgoing" port number is what I put in the sample code I took from the Matrix website.

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Formula Allcode losing bluetooth connection

Post by Steve-Matrix »

D_Addow wrote:
Sun Mar 24, 2024 5:01 pm
When the pin is entered and the car and laptop pair, it unpairs for no reason.
Something seems odd about this. When a Bluetooth device is paired (e.g. by a PC), that pairing is remembered. It sound like something is actively unpairing the buggy on your PC. It might be worth trying a different PC or other device.

Are you seeing this same behaviour on other devices as well? For example, try pairing and then connecting with a mobile phone (you may need a terminal app to connect to the buggy).

When you switch a buggy on, the blue LED should be flashing. After you pair with the device, the blue light will continue to flash. When the COM port is opened by establishing a connection (e.g. using a terminal app), the blue LED will stop flashing and remain on. Disconnecting the COM port will cause the blue LED to start flashing again.

D_Addow
Posts: 8
Joined: Wed Mar 20, 2024 2:12 pm

Re: Formula Allcode losing bluetooth connection

Post by D_Addow »

Hi, sorry for the long reply.

To clarify, the pairing is remembered but when I turn on the car, to connect nothing happens and on my laptop it says its not connected either. If i was to pair my laptop with a portable speaker, turn off the speaker then turn it back on again, the speaker and laptop would automatically connect and the connection would maintain. That is not what's happening with the car where if i turned it off then back on, the connection might be initiated but would not maintain.

The same thing is happening with my phone as well. It can pair but the connection would not stay.

In regards to the blue light, the light will only remain on for a couple seconds at most then go back to flashing

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Formula Allcode losing bluetooth connection

Post by Steve-Matrix »

D_Addow wrote:
Tue Mar 26, 2024 6:55 pm
In regards to the blue light, the light will only remain on for a couple seconds at most then go back to flashing
Pairing does not seem to be the issue. Your problem is that the serial connection that happens disconnects after a short while. This is likely due to the program you have written for the connecting device (i.e. phone or PC). If you share the code for that program, then we may be able to identify why the connection is ending.

Note that a Bluetooth serial connection will behave differently to a Bluetooth speaker connection. There will be software on your device that automatically connects to the speaker. For a serial connection, you program will need to open the serial port and keep it open while communication between your device and the buggy is required. Once you have finished communicating with the buggy, your program should close the serial port. If you program ends early, the serial port connection will be automatically disconnected.

Post Reply