Bluno Nano V1.3 working, b4a has a BLE libary

Anything Arduino

Bluno Nano V1.3 working, b4a has a BLE libary

Postby tmdrake » Sun May 28, 2017 7:54 pm

Took me a while but finally got messages passed to my Android Phone. BLE 4.0, stacks differently to conventional bluetooth rfcom services. If you have a nice background in protocol stack it will help.
First off, I use B4A for android compiler as there is plenty of support for BLE libraries.

Now, to load the latest firmware into the Arduino instruction here work very well:
DOC: https://www.dfrobot.com/wiki/index.php/ ... or_later_2
WIKI: https://www.dfrobot.com/wiki/index.php/ ... KU:DFR0296
Github: https://github.com/DFRobot/BlunoBasicDemo

It also seems as the CC2540 chipset is also controlling the USB com port. This confused me at first, but after using the boot button to load a new firmware and AT-Commands setup some parameters, I was confused at first (seeing the device show up on my bluetooth, but not connectable), turns out 4.0 connects differently.

SO i loaded up a very simple sketch into my arduino compiler, note that arduino detects it as an UNO. I use timer library to do the blink-test as its non blocking code.

Code: Select all
#include "Timer.h"
Timer t;


// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);

  //Heartbeat
  t.oscillate(LED_BUILTIN, 1000, HIGH);

  //My first task, 10 seconds
  t.every(2000, doSomething);
 
  Serial.begin(115200);
 
}

// the loop function runs over and over again forever
void loop() {
  t.update();
}

void doSomething()
{
  Serial.println(millis());
}



Using the B4A compiler, there was nice post/library on emulating BLE devices, and connecting to the first one.
https://www.b4x.com/android/forum/threa ... rgy.59937/

Since the java API is similar for IOS and ANDROID 4.3+, author as a nice chat demo with iBLE:
https://www.b4x.com/android/forum/threa ... 9/#content

So after I was able to Enumerate and see the service and "characteristic" of the device, I found from the github android example:
Code: Select all
public static final String SerialPortUUID="0000dfb1-0000-1000-8000-00805f9b34fb";

Shows the characteristic id. There seems to be another ID to command interface as well (hence the AT switch in some of the older firmware)
Attachments
BLE - B4A_2017-05-28_19-27-34.png
BLE - B4A_2017-05-28_19-27-34.png (53.05 KiB) Viewed 124 times
-Dennis (TM_Drake)
http://www.tmdake.com
tmdrake
 
Posts: 24
Joined: Sat Nov 26, 2011 9:54 pm
Location: Rancho Palos Verdes

Re: Bluno Nano V1.3 working, b4a has a BLE libary

Postby tmdrake » Sun May 28, 2017 7:56 pm

Someone published a nice thread on the B4A forum that used Setnotify to talk to the arduino over bluetooth 4.0, and send messages back and forth!
https://www.b4x.com/android/forum/threa ... ost-473201

Huzza!
-Dennis (TM_Drake)
http://www.tmdake.com
tmdrake
 
Posts: 24
Joined: Sat Nov 26, 2011 9:54 pm
Location: Rancho Palos Verdes


Return to Arduino

Who is online

Users browsing this forum: No registered users and 1 guest

cron