Python API for BiTalino BLE

Python, Java, Android OS, etc.
abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Python API for BiTalino BLE

Postby abadez » Wed Oct 26, 2016 9:23 am

Hi ppl,

I'm stating to work with BiTalino with BLE adapter and i'm going to use python but i think there is no official documentation about python API with BiTalino BLE. Am i missing some site with that documentation or it doesnt exist yet?

Anyway, anyone have experience with this BiTalino version and used it with python?

I'm going to try the use of pybluez and python sockets to communicate with BiTalino, what do you think?

Thanks

abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Re: Python API for BiTalino BLE

Postby abadez » Thu Oct 27, 2016 11:04 am

[English]
I managed to detect and connect to the BiTalino Ble.
After i was searching in to how interact with it, so i find out that there are 2 characteristics to do that (one to write the commands and the other to read de notifications that are the result of the command). My question is, do i have, somehow by a command, to enable the sending of notifications or the device will send them without any need of enable?

Thanks


[Português]
Consegui detectar e conectar-me ao BiTalino Ble.
Depois disso pesquisei como interagir com ele e descobri que é através de 2 caracteristicas, do 2º serviço da lista de serviços do periférico, uma para escrever os comandos e a outra para notificar dos resultados dos comandos. A minha questão é, tenho de, alguma maneira através de um comando ou assim, fazer enable às notificações ou o próprio dispositivo começa logo a enviá-las após a receção do comando?

Obrigado

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: Python API for BiTalino BLE

Postby BITalino » Thu Oct 27, 2016 12:24 pm

Hi there,

We're glad to hear that you've managed to make progress... the specifications for the BLE services are available here:
http://bitalino.com/datasheets/REVOLUTION_BLE_Block_Datasheet.pdf

The device is prepared to responds to a number of commands sent as bytes (or sequences of bytes) as described here:
http://bitalino.com/datasheets/REVOLUTION_MCU_Block_Datasheet.pdf

While the BLE communication part is not yet released on the Python API, the commands and their responses are protocol agnostic.

Hope you found this information useful. If you have any further questions that we can help with, just let us know.

Best regards,
The BITalino Team

abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Re: Python API for BiTalino BLE

Postby abadez » Wed Nov 02, 2016 2:39 pm

[English]
Hi ppl,

I have seen some projects that uses ble peripherals and in most of them the developers refer that they had to turn on the notification mechanism by sending a certain command to the write characteristic of the peripheral.
I'm trying so receive data from BiTalino BLE but a don't receive any notification, but the commands are accepted and the main led is blinking signaling that the device is communicating but i'm not receiving any notifications.
What i ask is what command do i need to send to BiTalino in order to turn on the notification mechanism?
Thanks

[Português]
Boas pessoal,

Estive a ver alguns projetos que usam periféricos ble e na maior parte deles os developers referiram que tiveram de aticar o mecanismo de notificações do periférico, enviando um certo comando para a caracteristica de escrita.
Eu estou a tentar receber informação do BiTalino BLE mas não recebo nenhuma notificação, os comandos são bem aceites pelo periférico pois o led principal fica a piscar indicando que há comunicação de dados mas não recebo as notificações.
Que comando tenho de usar para ativar o mecanismo de notificações do BiTalino BLE?
Obrigado

cazevedo
Posts: 18
Joined: Tue Feb 25, 2014 2:17 pm

Re: Python API for BiTalino BLE

Postby cazevedo » Thu Nov 03, 2016 12:04 pm

Hi there,

The frames sent by the BITalino are sent through notifications via the "Frames" characteristic (UUID="40fdba6b-672e-47c4-808a-e529adff3633").
This characteristic has the notification property so if you perform a descriptor search in the "Frames" characteristic you will find a "Characteristic Client Configuration" field with an UUID="2902". This means that the characteristic either have indications or notifications. In this case it has notifications and in order to subscribe them you must write the value 0x01 in the corresponding "Client Characteristic Configuration" (UUID="2902"). If on the other hand you would like to enable indications you would need to write the value 0x02.

Best regards,
Carlos Azevedo

abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Re: Python API for BiTalino BLE

Postby abadez » Thu Nov 10, 2016 2:09 pm

Thanks for your help.
I managed to make it work, now i'm subscribed to receive notifications from that handler.

Pedro Abade

abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Re: Python API for BiTalino BLE

Postby abadez » Mon Nov 21, 2016 12:14 pm

As i was coding for my BiTalino BLE, now i started to try to acquire ECG Samples at 1000Hz, the problem is that when i send then Stop command the BiTalino won't read it and i loose connection with it but it continue acquiring samples (led is blinking).
I have managed to acquire samples at 10 and 100 hz and the Stop command was doing fine, but at 1000Hz it sends me an error ("The demanded command was not executed. Device disconnected").
Does anyone has experienced this problem?

Thank you

cazevedo
Posts: 18
Joined: Tue Feb 25, 2014 2:17 pm

Re: Python API for BiTalino BLE

Postby cazevedo » Tue Nov 22, 2016 8:39 am

Hi Pedro,

How many channels are you acquiring simultaneously? Or if it is more convenient for you, what is the start command byte that you are sending?
Does that happen every time? Have you tried on a different computer or with a different BLE dongle?

Best regards,
Carlos Azevedo

abadez
Posts: 6
Joined: Fri Oct 21, 2016 1:50 pm

Re: Python API for BiTalino BLE

Postby abadez » Tue Nov 22, 2016 11:15 pm

Hi cazevedo,

I'm just acquiring the ECG signal from one channel, i have used analogic channel A2 so I'm sending the command 195 (11000011) for defining the SampleRate which is 1000Hz and then a send the command 9 (00001001) to acquire from A2, am I right with this commands?

This is happening always but i didn't try in another computer yet.


Return to “Programming APIs”