Bluetooth comm with raspberry pi3

1,044 views
Skip to first unread message

cmoulikus

unread,
Jan 15, 2017, 9:33:25 PM1/15/17
to MIT App Inventor Forum
I am trying to write an app for communicating with the raspberry pi 3 which has built in bluetooth module
To sanity check, I paired my android phone with the pi. I entered "rfcomm listen hci0" on the pi. I then used the blueterm app on my phone and could send text msgs to the pi.

Now I want to write an app using app inventor. I used the online tutorial for a client app. I see the pi in the list of devices using listpicker. But when I try to connect to the pi, I get an error msg saying, "could not connect, is the device turned on?"

Any help would be appreciated. Thanks.

Ghica

unread,
Jan 16, 2017, 3:26:57 AM1/16/17
to MIT App Inventor Forum
It seems that the pi 3 is using BT 4, therefore you must use the BLE extension instead of the classic BT component.
Cheers, Ghica

cmoulikus

unread,
Jan 21, 2017, 7:11:05 PM1/21/17
to MIT App Inventor Forum
Sorry I could not respond earlier. How do get the BluetoothLE component? The connectivity component shows only bluetooth classic. Clicking on extension shows "Import Extension" link which when clicked wants a file or url.
Please let me know how to get this component.

also, an example on using this module will be great.

thank you.

cmoulikus

unread,
Jan 21, 2017, 8:41:47 PM1/21/17
to MIT App Inventor Forum
Actually, poking around some more, I found the aix file for for the bluetoothLE and downloaded it to my computer. Now import extension could find that file and I have the component available in the palette.
I also went through tutorial that explains connecting to Arduino 101. I am trying to do the same with raspberry pi 3. How do I find the service_uuid and characteristic_uuid for the pi?
It lookslike I need it for exchanging data.

thanks

Ghica

unread,
Jan 22, 2017, 5:02:14 AM1/22/17
to MIT App Inventor Forum
Google some more in this forum, there are several examples of generic BLE connection apps (sorry, I cannot be more specific right now, as I am typing this on an iPad, in a train).

The first place to look however, would be the code in your pi that you are using for communication with your app.
And in App Inventor, you could drag a block to your workspace that says something like: call availableServices. Use DoIt after you connected, to find out what is available. You can do the same for characteristics.
Cheers, Ghica.

cmoulikus

unread,
Jan 27, 2017, 9:50:10 PM1/27/17
to MIT App Inventor Forum
Hi

Unfortunatley, I am still hopelessley stuck. I am new to BLE. At this stage, all I want to do is send and receive some text message to and from the pi 3 to the androud phone running the appinventor. I think I understand how to write an app using the AppInventor based on tutorial. I am flummoxed on what to do at  the pi 3 end to send the uuids. The bluetoothon pi 3 works as my phone is paired and the the blueterm app works fine. So any tutorial pointing to both the pi 3 side and the app side would help.

I also don't know what a Dolt is, that you are referring to. Is it some tool?  All I know is that it means a stupid person which I guess I am in the BLE space :-)

thanks.

Ghica

unread,
Jan 28, 2017, 11:56:03 AM1/28/17
to MIT App Inventor Forum
DoIt: click with your right mouse button on a block that returns a value (while you have the Companion connected). Choose DoIt from the context menu, and you will see what the current value is.
Very handy for debugging.
It is you who should figure out what to put on the pi to be able to communicate with App Inventor. BLE requires a very specific protocol, Google for more information!
One link that could maybe help you: https://www.hackster.io/inmyorbit/build-a-mobile-app-that-connects-to-your-rpi-3-using-ble-7a7c2c
Then, it is better to ddevelop your pi app first, at least a prototype. Use one of the free BLE apps on your phone to find out what the pi sends, and which UUID's it uses for servicess and characteristics.
Then, come back here.
Cheers, Ghica.

cmoulikus

unread,
Jan 29, 2017, 12:31:34 AM1/29/17
to MIT App Inventor Forum
Thanks for the link. Let me try and get back to you. It may take a few days.

Reply all
Reply to author
Forward
0 new messages