Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Error 507 : Unable to connect. Is the device turned on?

433 views
Skip to first unread message
Assigned to chrisw...@gmail.com by me

Bastien D.

unread,
May 23, 2019, 2:31:55 PM5/23/19
to mitappinv...@googlegroups.com
Hello, I want to connect a Dial Indicator to my application with Bluetooth.
The dial indicator works with the application of the manufacturer. (Sylvac BT Smart Demo).

I have paired it with my tablet but when i try to connect to the indication , it indicate Error 507.

Here is more information about the connexion of the indicator : https://www.sylvac.ch/download-en/catalogues?task=document.viewdoc&id=90

Anyone know what I have to do ?

Thank you, 
Bastien.

Chris Ward

unread,
May 23, 2019, 6:01:47 PM5/23/19
to MIT App Inventor Forum
Hello Bastien

Can you post your Blocks please. How-to on my website:
https://www.professorcad.co.uk/appinventortips#TipsBlocks   How to create an image of your Blocks and add it to your Forum Post

Chris Ward

unread,
May 23, 2019, 6:04:38 PM5/23/19
to mitappinv...@googlegroups.com
Hi again

I see the manufacturer actually provides an Android app. Does that work on your Device?

EDIT: Sylvac Smart App for Android 4.3 and up. Google Play Store

Bastien D.

unread,
May 24, 2019, 10:20:14 AM5/24/19
to MIT App Inventor Forum
Hi Chris !

I didn't think it was important to post my block.
Here are my blocks : 
blocks.png












Button1 return "paired"
Button 2 return Error 507 ..


About the manufacturer app , YES it works !
If you look about the catalogue that i sent, you can see that the dial indicator have 3 modes : HID, simple and paired. The manufacturer app works with simple and paired mode.

Have an idea to connect the dial indicator to my app developped with MIT app inventor ?

Thank you Chris !!

Bastien D.

unread,
May 24, 2019, 11:31:48 AM5/24/19
to MIT App Inventor Forum
UPDATE :

I downloaded the extension BluetoothLE and I can connect the dial indicator.

Now, how can I receive text from him with this extension ?

Thank you !!!


Chris Ward

unread,
May 24, 2019, 11:33:46 AM5/24/19
to MIT App Inventor Forum
Hi Bastien

You are "hard coding" the device address and we have seen that fail in other people's Projects - even though the address looked 100% correct. It's always best to get a list of BLE devices via code, select the required device from that list and always use that address programmatically - no humans required :) This is why I asked to see your Blocks (that would be all of them).


Bastien D.

unread,
May 24, 2019, 11:46:59 AM5/24/19
to MIT App Inventor Forum
Hi Chris !!

Thank you !! I succeeded to connect my dial indicator with the BluetoothLE extension.

But now, how can I receive the values from this device ?

Regards,
Bastien.

Chris Ward

unread,
May 24, 2019, 11:48:02 AM5/24/19
to MIT App Inventor Forum
Hi Bastien

Ah - I didn't notice that you had not used the BLE extension. (slaps head). What I have said about addresses though still applies, though on this occasion it has worked for you. 

Ensure you have the latest extension version:  edu.mit.appinventor.ble-20181124.aix

Using BLE, you will need a Service UUID and a Characteristic UUID. For a Dial Indicator, the manufacturer probably uses generic UUIDs (security not being an issue for these) for all of there instruments of the same type. The UUIDs should be on a leaflet or something that came with the device, or published on there website. They might be revealed by the Manufacturer's App.

If you can get hold of the UUIDs, I can put together an example to get you started. I don't have a BLE Dial Indicator here, but I do have code that has worked with other BLE devices, so it should be close to what you need.

On my website you will find some important links about BLE, what it can and can't do, the environment required, distances etc.




Bastien D.

unread,
May 24, 2019, 12:30:49 PM5/24/19
to mitappinv...@googlegroups.com
Hi Chris ! 

Thank you for your answer, I will find a Service and Characteristic UUID. 

Is it the only thing I need ?
Yes, i'm interested to have an exemple for starting !!


Regards,
Bastien.

Chris Ward

unread,
May 24, 2019, 1:26:32 PM5/24/19
to MIT App Inventor Forum
Hi Bastien

Yes, just the UUIDs.

I'm away from my desktop now for about 2 hours, back later.

Bastien D.

unread,
May 24, 2019, 1:49:05 PM5/24/19
to mitappinv...@googlegroups.com

Chris Ward

unread,
May 24, 2019, 3:47:17 PM5/24/19
to mitappinv...@googlegroups.com
Hi Bastien

The file you found on github turns out to be the most interesting, but you will need to determine exactly which Service + Characteristic matches the engineering values you wish to collect. For testing, I have put in the first two UUIDs - you can experiment with the others. You might find that, via extra buttons on your GUI, you need to swap the UUIDs with others for particular tasks. The code below can be used for your experiments. It's very basic, but basic is good for experiments.

What the App Does
1) Uses Bluetooth Classic to check that the phone/tablet has Bluetooth enabled - if it isn't, asks the User for permission to enable.
2) Uses BLE to find available devices and lists them for the User to select.
3) Registers with the device to receive text (which of course can be numbers - we don't know the format of the data)
4) Receives the data and displays it. This might require a tidy-up later.

How to Use the App
1) Make sure The Dial Indicator is switched on and in Bluetooth comms mode.
2) Tap the scan button - this should populate the Device List with devices found and hopefully one of them will be the Dial Indicator.
3) Select the Dial Indicator in the List - the App will then try to connect to the Dial Indicator.
4) If the connection is good, the App will display any data it receives in the white box.
5) When happy with the data, tap the Discon button (disconnect).

If the connection fails or no data is received, that could be down to the UUIDs not being the correct ones. Experiments needed :)

GetBleDataFromDialIndicator.png











BLE_DataFromDialIndicator.aia

Bastien D.

unread,
May 25, 2019, 3:43:04 AM5/25/19
to mitappinv...@googlegroups.com
Hello Chris, 

Thank you for making an application for me !
The dial indicator is conntected to the app.
I tested many combinations of UUID and it doesn't works. 

Sometimes the app crash, sometimes it do nothing. 

What I can do now ? 
I will ask UUID's to the manufacturer.
I downloaded the apk of the file of the manufacturer but I can't find the UUID's .... Maybe you can do it ? 


Regards,
Bastien

Chris Ward

unread,
May 25, 2019, 5:39:04 AM5/25/19
to MIT App Inventor Forum
Hi Bastien

I had to delete the APK from your post - they are banned from the forum because they could be malicious - it is possible for someone to replace an innocent APK with a dangerous one.

So, when the App crashes, do you see error messages? I suspect that, when the App does nothing, it has probably crashed (frozen?) at that time too.

There are all sorts of complications with BLE. The first being that the Dial Indicator is using BLE v4.0, the very first version, which is the least reliable. Also, ensure your phone/tablet is compatible - needs to have Android Version 5 (Lollipop) as a minimum. There are unconfirmed reports of problems with the latest version of Android (9, Pie) so if you have version 9, check to see if your phone manufacture has an update - Samsungs were updated last week.

When you ask the manufacturer about UUIDs, please also ask about the data type. We are currently trying to read the data as a text string, something App Inventor is good at even when the original data was not text. It could be that we should be reading Bytes or Numbers.


Bastien D.

unread,
May 25, 2019, 6:39:43 AM5/25/19
to MIT App Inventor Forum
Hi Chris, 

When the app crash it only appears a notifier : AI2 Companion has stopped.

It crash with a few of combinations of UUID. It crash when the dial indicator is "connected".

My tablet have Android 5.0.2 and there is no update to do.

I'm waiting the answer of the manufacturer but it's the week-end !!

Regards,
Bastien.

Chris Ward

unread,
May 25, 2019, 7:05:59 AM5/25/19
to MIT App Inventor Forum
Hi Bastien

Try it without the Companion - build an APK and install it. You will need the setting on your phone that says something like "Allow unknown sources" because the APK has not been downloaded from Google Play. If your phone is set to Developer-Debug mode, all the better.

Bastien D.

unread,
May 25, 2019, 7:53:57 AM5/25/19
to MIT App Inventor Forum
Hello Chris,

There is news !!!

When the dial indicator is connected, I push on the central button and IT SEND VALUES !!!
Capture.PNG














So the dial indicator send text string as you tried !


Screenshot_2019-05-25-13-45-42[1].png














Next step : try to not push on the button !! Have you an idea ?

Regards ,
Bastien

Chris Ward

unread,
May 25, 2019, 9:18:01 AM5/25/19
to MIT App Inventor Forum
Hi Bastien

Right - good progress! We do not know for sure that we can push the button programmatically but there must be a good chance that it can be done. We would I think need to send a short command to the Dial Indicator. So, we need to know, from the manufacturer, what that code is.

Chris Ward

unread,
May 25, 2019, 9:51:16 AM5/25/19
to mitappinv...@googlegroups.com
Hi again

Here is an updated version of the Project, new name "BLE_DialIndicator". I have added a Block to request data, but I do not know if:

1) The UUID is correct or not.
2) If the request should be sent as text.

Because of the above, I have probably broken the App - i.e., it won't work with a manual press of the Dial Indicator button, if the programmatic method fails :)




BLE_DialIndicator.aia
Message has been deleted

Bastien D.

unread,
May 25, 2019, 10:32:18 AM5/25/19
to MIT App Inventor Forum
Hello Chris,

Thank you for your reply !

I tested your application but it doesn't work !! I tried to change UUID request ; and send bytes and floats but nothing happend !

I think that now, I juste have to wait the reply of the manufacturer !

What I have to know is :
- UUID SERVICE
- UUID CHARACTERISTIC
- UUID for the request

If I have these informations , is it OK ? 

Regards,
Bastien.


Chris Ward

unread,
May 25, 2019, 10:44:21 AM5/25/19
to MIT App Inventor Forum
Hi Bastien

You found the correct Service UUID and Characteristic UUID to receive data - the App would not receive data if either was incorrect. So what is need from the Manufacturer is:

1) UUID to request data (mention the name of the middle button on the Dial Indicator so we are all sure of what is needed)
2) What value should we send.
3) Type of value - Text, Number, Byte?

Chris Ward

unread,
May 25, 2019, 10:47:35 AM5/25/19
to MIT App Inventor Forum
...they should in fact have a list of UUIDs and codes, with explanations for each, given that there are different Modes, different Units that can be set.

Chris Ward

unread,
May 25, 2019, 11:06:44 AM5/25/19
to MIT App Inventor Forum
Hi again

Shot in the dark so probably will not work, but if you want to give it a try, edit the code thus:

Uuids.png


InitiateDataSend.png





Bastien D.

unread,
May 25, 2019, 12:48:42 PM5/25/19
to MIT App Inventor Forum
Hi Chris,

I'm waiting the answer of the manufacturer but it's the week end ☹

I tried the "FCT0" but nothing happend !

If you have other ideas, i'm here to try !!

Regards,
Bastien.

Chris Ward

unread,
May 25, 2019, 3:51:53 PM5/25/19
to MIT App Inventor Forum
Hi Bastien

You could try changing the syntax to :  <FCT0>

If that fails, swap-out the DeviceDataRequest_Uuid with the Characteristic_Uuid and test both "FCT0" and "<FCT0>"  again........

............ but I think there is something I am missing :(

Bastien D.

unread,
May 25, 2019, 5:19:35 PM5/25/19
to MIT App Inventor Forum
Hi Chris,

I tried all of the possibilities, but nothing happend ! 

It becomes desperate ! 



Chris Ward

unread,
May 25, 2019, 6:30:26 PM5/25/19
to MIT App Inventor Forum
Hi Bastien

Yeah, we are going to have to get guidance from the manufacturer. So close but yet so far........

Bastien D.

unread,
May 27, 2019, 9:44:47 AM5/27/19
to mitappinv...@googlegroups.com
Hi Chris,

I had some news !
The manufacturer send me this !
They said that: The important point is to activate the characteristics 5010 (Indication) and 5013 (Notification).

UUIDS.jpg













I tried : 
Service 5010
Characteristic 5013
DataRequest 5012 

But it returns : Service c1b25010-caaf-6d0e-4c33-7dae30052840, characteristic c1b25013-caaf-6d0e-4c33-7dae30052840 are not published by the connected device.
Note: You will not see another error reported for 5 seconds.

I'm a little bit lost ! What UUID goes where ?

Regards, 
Bastien.

Bastien D.

unread,
May 27, 2019, 1:00:31 PM5/27/19
to mitappinv...@googlegroups.com
They also said that :

"We use ASCII characters. You will find the list of commands in the operating instructions on page 34. If you just want to ask for the value of the instrument, just send the command "?" followed by Carriage Return {CR} at the end. "


commands.png

Chris Ward

unread,
May 27, 2019, 2:56:37 PM5/27/19
to MIT App Inventor Forum
Hi Bastien

The UUIDs are only half of the equation - we need to know the format of the actual value. However, since we receive strings, we can try sending strings at first. If that fails, we can try sending bytes.

Catch up with you later with some code.

Chris Ward

unread,
May 27, 2019, 2:58:05 PM5/27/19
to MIT App Inventor Forum
....aha, and we know the actual values should be sent as ASCII - missed that bit, sorry :)

Chris Ward

unread,
May 27, 2019, 5:01:26 PM5/27/19
to mitappinv...@googlegroups.com
Hi Bastien

File attached "BLE_Dial_Indicator_03.aia" is the first test with the Manufactures Information received today [27/05/2019]

We need to run tests and therefore the commands sent are currently hard-coded. Once we can wake up the Dial Indicator and get values from it, we can change the GUI so it is easy to send any command by selecting from User-friendly pick lists. Some of the commands, for example Tolerance change, require the final command to be "built", so we will need to accommodate that in the GUI.

Regarding the "Favourite" functions (collection of settings) - how many can you actually store on the Indicator?

I won't post a blocks image as this Post already takes too long to reload on my PC :)



BLE_Dial_Indicator_03.aia

Chris Ward

unread,
May 27, 2019, 5:10:21 PM5/27/19
to MIT App Inventor Forum
Hi again

The Strings Received Block in File "BLE_Dial_Indicator_03.aia" is testing for the wrong UUID pair: Please change it to this:

CorrectionToStringsReceivedBlock.png


Bastien D.

unread,
May 28, 2019, 4:13:48 AM5/28/19
to MIT App Inventor Forum
Hello Chris,

I tried your application but it directly send :

"Service c1b22800-caaf-6d0e-4c33-7dae30052840, characteristic c1b25012-caaf-6d0e-4c33-7dae30052840 are not published by the connected device.
Note: You will not see another error reported for 5 seconds."

I think that the Primary Service UUID is "wrong". When I put 5000, there is no error but nothing happend too.

To ask for values, does not it end its request by the carriage return "<=>" ?

Chris Ward

unread,
May 28, 2019, 4:49:02 AM5/28/19
to mitappinv...@googlegroups.com
Hi Bastien

That's two different issues.

EDITED

1) Concerning the UUIDs, those are the 'new' ones the manufacturer gave you.....so perhaps they have given you UUIDs for a different model Dial Indicator? Funny thing is, the Service Uuid we used before "00001800-0000-1000-8000-00805f9b34fb" (which did work) was actually for Calipers, not a Dial Indicator. The Characteristic Uuid they have given to request data is the same as the one we used before "c1b25012-caaf-6d0e-4c33-7dae30052840".  - which did not work, but that was because we did not know the commands format.

The End-Of-Data flag is "\n" which is carriage return in BLE, so I don't think that is a problem, unless the manufacturer told you to use "<==>"? The problem I had was choosing which command to wake-up the Dial Indicator. It's a bit naff that they have a specific command to switch it off, but not one to switch it on.......

Test: Change the (Primary) Service Uuid back to the one that worked.

Make a note of error messages and the last App message (top line of the GUI, in blue) and let me know.



Chris Ward

unread,
May 28, 2019, 5:10:46 AM5/28/19
to MIT App Inventor Forum
Hi again

We might have to send the commands in byte format. The manufacturer has stated they require ASCII, which is 1 byte per character, 7 bits. App Inventor uses UTF8, it's first 127 characters match ASCII and are also 1 byte per character for that range, but the full 8 bits. So UTF8 should work, but if it doesn't, we have a Plan B.

Bastien D.

unread,
May 28, 2019, 5:13:59 AM5/28/19
to mitappinv...@googlegroups.com
Hi Chris,

The application that worked had these UUIDs :

Capture.PNG









But if I put a the same UUID's in the new app , there is no error but nothing happend !

Should the register and write procedure have the same UUIDS?

What should I send in bytes ?

Bastien.

Chris Ward

unread,
May 28, 2019, 5:25:05 AM5/28/19
to MIT App Inventor Forum
Hi Bastien

You are asking me questions that the manufacturer should answer, since we are experimenting with a Service UUID that worked but is not the one supplied by them. However:

What was the last message in the App? (top line, in blue)

What happens if you press the middle button on the device, as before?

Bastien D.

unread,
May 28, 2019, 5:33:55 AM5/28/19
to MIT App Inventor Forum
Nothing happend when I press to the middle button.

And the last message was always **Connected** , I've never seen "Requesting data"

Chris Ward

unread,
May 28, 2019, 5:51:10 AM5/28/19