• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bluetooth Access
#1
Hello Armin,

I am now running bluetooth container on netPI Core V1.2.0.0. I am able to scan some devices as below attached.

how I can access data from "connected" bluetooth device into netPI? Is there any simulation tool/application to run on netPI? I searched in other threads in this forum, where I found BlueZ. Is it the software used ?

Requirement: One of my customer wants to connect Bluetooth Sensor to netPI & want to read sensor data, For that we are preparaing demo on Bluetooth access.

Can you please guide?

Thanks & BR 
Madhumati


Attached Files Thumbnail(s)
   
  Reply
#2
Hello Madhumati,

communicating over Bluetooth is like communicating across the well-known Modbus RTU for example. Both are serial protocols. Modbus uses cable usually, while Bluetooth goes over wireless.

For both your need
  • a BT antenna for Bluetooth and for Modbus an RS232/RS485 port .
  • a bluetooth chip for bluetooth and a bus driver for Modbus 
  • a protocol stack for Bluettooth and a protocol stack for Modbus
  • an application that makes use of the protocol stack to call different service like read/write/reset or whatever
  • a UUID specification of the server Bluetooth device to get knowledge about the attribute profile (named GATT: https://learn.adafruit.com/introduction-...nergy/gatt) it supports and for Modbus the meaning of the different registers you can read/write
With the container you have deployed right now you have also the Bluetooth stack included. The Bluetooth stack is named "Bluez" by the way. So the container includes a compiled version of "Bluez" along with some basic Linux tools that can be used to make some basic tests like "bluetoothctl","hciconfig" and "hcitool".  Since all tools can be used just manually they are not good to automated applications. Here is an example how to use "bluetoothctl": https://docs.ubuntu.com/core/en/stacks/b...t-services

So you recognized yourself that you need to write your own application and as it is usual with Linux you (your customer) can decide to write applications with different programming languages like Python, C#, C++, Java, Javascript whatever on top of "Bluez" to communicate with a Bluetooth server device. So the main question is: is your customer a programmer? Or is he just a user who wants to make use of a ready Bluetooth client application?

Last year I bougth this small device here: http://www.blehome.com/sensorbug-lp.html . It is not bigger than a coin, but can measure multiple things. I was interested in reading the current temperature from it over netPI. I was at exaclty the same point like you and didn't know how to read out values from it since all the tools that come with "Bluez" did not help me writing an own application. And I have to admit that I never had the intension to make a deep dive into any of the programming languages to compile such an application myself.

This is why I have decided to search for a solution using Node-RED and I was successful. I got a proper communication running between my netPI and my sensorbug bluetooth device and I was able to read out the temperature value from it. Based on this experience I included the Bluez stack and and a Bluetooth Node in netPI standard Node-RED container: https://hub.docker.com/r/hilschernetpi/netpi-nodered

So my recommendation is to use Node-RED for Bluetooth communication instead of the raw Bluetooth container that you are using so far.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Hello Armin,

I am not able to connect through Node RED Bluetooth node to my handphone. pfa screenshots. I started node RED image with Bluetooth driver on netPI then I did Power ON/OFF netPI & then made the flow in node-RED , deployed.     
                           

BR
Madhumati


Attached Files Thumbnail(s)
       

.txt   bluetooth.txt (Size: 1.13 KB / Downloads: 1)
  Reply
#4
Well Madhumati,

your flow looks good. It is similar to my flow I used with my sensorbug BT device last year. So basically the BT communication over Node-RED on netPI works on your unit.

The further communication is now a matter of attributes you can read from your mobile phone. But as I told you ... you need the GATT specification of a Bluetooth device to know which UUIDs can be read or written.

I am pretty sure that NOKIA will not tell anybody their secrets about the attributes in the phone that can be read. It is a consumer product and not an "open" Bluetooth product with a detailed specification a developer like you need. So in my eyes a mobile phone is not a good device to test Bluetooth communication and reading attributes cause of missing GATT list. You need a real Bluetooth sensor with open specification and then you read the attributes from it over Node-RED.

Thx
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
I made a cross check with my iPhone mobile device.

My screen shot looks different and more successful.

When I setup the BT node the first time and connect to my iPhone my screen shot automatically lists some GATTs like "Device name" UUID "2a00".

   

When I then inject value 2a00 to msg.topic of inject node and send it to the BT node then it comes back with the name "iPhone" in ASCII code 0x69, 0x50 ...

   

So for me it works best with iPhone.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#6
I tested the same with my sensorbug again to read out its device name with UUID 2a00:

   
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#7
Hello Armin,

Thanks for your help.

I now added my ipad & able to connect successfully. will do further test upon it.

BR
Madhumati
  Reply
#8
But still you need details about you final Bluetooth sensor of your customer to set up a working Node-RED flow with it.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#9
Dear Armin,

I dont know why my ipad gets disconnected after few seconds? I am not able to test it furtehr.
it gives timeout error.

then after sometimes, i can access it.

Below few points noticed:
1] MAC address of ipad gets changed everytime its connect...pls check debug log in node red attached ss

 have u faced such issue? Is something wrong configuration?

BR

Madhumati


Attached Files Thumbnail(s)
       
  Reply
#10
Hello Madhumati,

I am not a bluetooth and iPad expert.

I could imagine that maybe the iPad times out if there is too much time passing between two consecutive commands.

It can also be the bluettooth Node-RED node. This is a community maintained node where Hilscher has no experience with. Maybe there is a bug in the node? I don't know.

Once again, you need in any case the bluetooth device your customer wants to communicate with to make use case approval.

I can't help here any further.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Wi-fi in Access Point mode Renato75 7 4,647 June-3rd-2022, 12:59 PM
Last Post: Armin@netPI
  NetPI wifi access to WPA2-Enterprise MikeP 4 4,252 September-3rd-2021, 02:56 PM
Last Post: MikeP
  netPI RTE 3: access from several comm. masters tad 3 4,024 June-3rd-2021, 12:03 PM
Last Post: Armin@netPI
  Bluetooth testing DSongra 6 3,530 April-29th-2021, 06:08 AM
Last Post: DSongra
  Access to RTC from my own container application tad 1 3,519 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  HilscherAutomation / netPI-bluetooth entrypoint.sh error bbaskii 6 4,177 September-14th-2020, 04:42 PM
Last Post: bbaskii
Wink How to access Root Directory Rajesh3128 8 5,068 October-16th-2019, 11:19 AM
Last Post: Armin@netPI
  netPI access for remote PLC confign MGharat 3 4,862 October-15th-2019, 09:12 AM
Last Post: Armin@netPI
  How to access netPI? firefly 6 6,118 May-16th-2019, 02:31 AM
Last Post: firefly
  Wi-Fi access problem MGharat 3 4,938 March-12th-2019, 09:27 AM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)