sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Transfering Data between two Rpis using BLE

Tue May 28, 2019 7:33 am

i want to establish connection mode of ble between two rpis to advertise some data . Can anyone help?
Last edited by sid20 on Thu May 30, 2019 10:09 am, edited 1 time in total.

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transferind Data between two Rpis using BLE

Tue May 28, 2019 10:51 am

Possibly. What's your question?

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 7:13 am

I have some data that i am reading from a i2C mpu 9250 , one Rpi is taking that data , i want to advertise it
I want that data to transfer/advertise using connection mode of BLE between two Rpis , using their inbulit BLE.
I am successful in enabling advertisement mode.
But I want help for connection mode.
Connection mode i mean here it is i want to set packet length , time interval from recieving rpi
Help me out.

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 8:30 am

simply i wanna ask , how to connect two rpis using ble?
I tried gatttool , it showed up connect error connection refused(111)

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 2:10 pm

There are no services running out of the box on the Pi, so no connection to be made. You'll need to set up a service on one Pi (the 'peripheral'), and add at least one characteristic. You'll need to start advertising on the peripheral. Then, on the other Pi (the 'central'), you should be able to connect and read/write the characteristic.

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 5:52 pm

Yes thanks I did this, now i am doing it in command line , now i want to read write heart rate data using bluepy package of python.
i dont know how to do it in python . help me out.....

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 6:47 pm

There's sample Pi code in the test directory of the BlueZ github (example-gatt-server and example-gatt-client). They interface directly with BlueZ through its D-Bus interfaces. You can't use bluepy for central coding. There's a Python port of the node.js bleno library, but I've never used it.

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 6:59 pm

yes , excample gatt server gatt client is advertising data and other is scanning , now I wanna establish connection to modify or read write data using the other rpi which is recieving the advertising data using python? i hope you understand.


it is avery imp project for me.
Last edited by sid20 on Thu May 30, 2019 10:08 am, edited 1 time in total.

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transferind Data between two Rpis using BLE

Wed May 29, 2019 7:12 pm

If you have the peripheral working, you can either use example-gatt-client on the central Pi, or use bluepy to create the client, and connect to and read/write characteristics from the peripheral. Lots of examples on the Internet.

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transferind Data between two Rpis using BLE

Thu May 30, 2019 6:47 am

please share some,
when i run gatt client it shows no heart rate service found , how to rectify that? this time gattserver is running but gattclient shows this too.
this both are running simultaneously in different pi

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transfering Data between two Rpis using BLE

Thu May 30, 2019 12:11 pm

plz reply anyone..........?

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transfering Data between two Rpis using BLE

Thu May 30, 2019 12:23 pm

Are you running example-advertisement on the peripheral?

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transfering Data between two Rpis using BLE

Thu May 30, 2019 12:38 pm

yes i am running it,

i want now to write a characteristic data uuid using bluepy in python,
i am able to read , get characteristics, services all, but now need your help in writting the advertised data

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transfering Data between two Rpis using BLE

Fri May 31, 2019 5:56 am

ok thanks
Last edited by sid20 on Thu Jun 06, 2019 11:04 am, edited 1 time in total.

User avatar
Gavinmc42
Posts: 4534
Joined: Wed Aug 28, 2013 3:31 am

Re: Transfering Data between two Rpis using BLE

Fri May 31, 2019 6:19 am

BLE is working in baremetal.
https://ultibo.org/forum/viewtopic.php? ... =ble#p8635
Even works between Microbits and Pi's.

Have you tried uart mode?
It was a utility example for Nordic? chips that now seems common and very useful for simple data.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transfering Data between two Rpis using BLE

Fri May 31, 2019 8:07 am

sorry ,i didnt get .Can you please explain what you have shared?

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Transfering Data between two Rpis using BLE

Fri May 31, 2019 12:13 pm

Here's some code I have to write a characteristic using bluepy: viewtopic.php?f=28&t=193923&p=1214901#p1214901

sid20
Posts: 14
Joined: Wed May 22, 2019 8:36 am

Re: Transfering Data between two Rpis using BLE

Thu Jun 06, 2019 7:22 am

i want to write using handle not using uuid of ble....,
if you have any please share

Return to “Advanced users”