Skip to first unread message

Joel Crouch

unread,
Sep 22, 2017, 10:40:29 AM9/22/17
to MIT App Inventor Forum
I'm trying to transmit a byte to BLE module that loops data back on microcontroller side. 
I can see the byte received on microcontroller side, but I never get a response back on Inventor side. 
The "When BluetoothLE1.BytesReceived control block never triggers.  What am I doing wrong?
Please see attached for my TX and RX blocks.

Thanks,
Joel
BLE_TX_RX.jpg

Evan Patton

unread,
Sep 22, 2017, 10:58:40 AM9/22/17
to MIT App Inventor Forum
Hi Joel,

Is your BLE characteristic flagged as READ or NOTIFY/INDICATE? If the latter, you should use the BluetoothLE1.RegisterForBytes method block instead, which will handle changes to the characteristic's value from the BLE device.

Evan

Joel Crouch

unread,
Sep 26, 2017, 8:10:38 AM9/26/17
to MIT App Inventor Forum
Hello Evan,
I haven't had any luck getting the BLE BytesReceived or RegisterForBytes method to work for a Microchip BM71 module.  What BLE devices have been tested and known to work for receive?

Thanks,
Joel

Evan Patton

unread,
Sep 26, 2017, 3:31:23 PM9/26/17
to MIT App Inventor Forum
Hi Joel,

We have used this with both the Arduino 101 and the BBC micro:bit. For the former, we use it for things like receiving arrays of bytes indicating pin states. For the latter, we have used it to register for updates from the temperature sensor (among other things). Since the sample file you sent me earlier indicates that the characteristic is notify, you should be using the RegisterForBytes method. Note that you will only need to register once--every update from the BLE device on the other end should trigger a BytesReceived event. One thing that might help us debug the issue as well is if you capture a log from your phone using adb logcat. We can look for the debugging messages coming from the BLE extension to see if it's receiving data but failing to process it, for example.

Evan

MMIX

unread,
Oct 2, 2017, 5:46:58 AM10/2/17
to MIT App Inventor Forum
Hi Evan,

I am having a similar issue with the RegisterForStrings block. Nothing appears to trigger. Nothing is received by the Android app.
The transmitting device is the Bean+ and I've verified the service and characteristic UUIDs with another tool.

The Bean+ (Arduino) sketch is simply printing a random string to the serial (BLE) port.

Any ideas what I am doing wrong? I've attached the blocks.
Is there a working example of a device other than a microbit or Arduino101 that I can learn from?
Thanks,

MMIX
blocks.png

Ghica

unread,
Oct 2, 2017, 11:59:38 AM10/2/17
to MIT App Inventor Forum
I find the way you are trying to connect quite cumbersome, because you need to press a button three times, and you never check if the user selected a device.
So, the first question is: does your device connect at all (showing Status: connected in the label)?
If yes, we can look fursther, if no, start there.
Cheers, Ghica.

MMIX

unread,
Oct 2, 2017, 6:55:55 PM10/2/17
to MIT App Inventor Forum
Yes, the device connects and disconnects as expected. 
I was focused on the BLE data transfer, so I just reused the connection setup shown in the app inventor IoT tutorial.

Any advice on the use of UUIDs for data transfer on non-Arduino101, non-microbit devices?
Are there any examples out there showing how to make it work?
Thanks,

MMIX

Ghica

unread,
Oct 3, 2017, 2:39:56 AM10/3/17
to MIT App Inventor Forum
I think you are a pioneer here. It is your responsibility to know what you are doing on the BLE device side, find out what UUID's it uses and how. If needed, adapt the sketch on your device.
There are plenty of apps that can help you diagnose what the device is sending, and most manufacturers have abundant documentation.
Now, if you found out: share it with us!
Cheers, Ghica.
Reply all
Reply to author
Forward
0 new messages