View unanswered posts | View active topics It is currently Sat Apr 29, 2017 11:17 pm



Reply to topic  [ 4 posts ] 
Create an easy Arduino wrapper Library for BGLib 
Author Message
Site Admin

Joined: Thu Aug 02, 2012 11:36 am
Posts: 166
Hello everyone,
yesterday I played around with Jeff Rowbergs BGLib implementation for Arduino https://github.com/jrowberg/bglib with my BLE-Shield.

The communication works and I will write some instructions here into this forum how to set things up.

No to my idea and question to you: I want to create a wrapper library for BGLib, which encapsulates the Central Role for Arduino programmers. Currently I have the idea to implement something which might look like the CoreBluetooth framework. In the first run I want to support the Central Role.

Maybe someone is interested to participate/constribute in this kind of project. I'd like to setup another Github repo for that to share the code once there is something to share :-)

What do you guys think?

Cheers,
Michael.


Mon Jul 22, 2013 9:32 am
Profile WWW

Joined: Thu Jul 04, 2013 11:18 am
Posts: 1
Hi Dr Kroll,
I think it's a very great idea.
Because the BGLib isn't workin' at all currently


Mon Jul 22, 2013 3:04 pm
Profile
Site Admin

Joined: Thu Aug 02, 2012 11:36 am
Posts: 166
Are you speaking about the BGLib in general or BGLib on the BLE-Shield?

Cheers,
Michael.


Mon Jul 22, 2013 9:59 pm
Profile WWW
Site Admin

Joined: Thu Aug 02, 2012 11:36 am
Posts: 166
Hello all,
for what I can say, BGlib as it is provided by Jeff Rowberg :-)
I stacked the BLE-Shield to an Arduino UNO set the RX/TX Switch on the Shield to 2/3 and what is important in the Scanner Sketch is to comment the following lines out:

Code:
// ONLY enable these if you are using the <wakeup_pin> parameter in your firmware's hardware.xml file
//ble112.onBeforeTXCommand = onBeforeTXCommand;
//ble112.onTXCommandComplete = onTXCommandComplete;


Initialize the SoftwareSerial class as follows:

Code:
SoftwareSerial bleSerialPort(2, 3); // RX, TX


Afterwards you should see the following in the console:

BLE112 BGAPI Scanner Demo
Operations Menu:
0) Reset BLE112 module
1) Say hello to the BLE112 and wait for response
2) Toggle scanning for advertising BLE devices
Command?

If you press the reset button on the Shield:

### system_boot: { major: 1, minor: 1, patch: 1, build: 47, ll_version: 3, protocol_version: 1, hw: FF }

send command 1:

--> system_hello
<-- system_hello

Send command 2:

--> gap_set_scan_parameters: { scan_interval: 0xC8, scan_window: 0xC8, active: 1 }
<-- gap_set_scan_parameters: { result: 0 }
--> gap_discover: { mode: 2 (GENERIC) }
<-- gap_discover: { result: 0 }
### gap_scan_response: { rssi: -49, packet_type: 0, sender: D5F7656277FD, address_type: 1, bond: FF, data: 0201060408734E66 }
### gap_scan_response: { rssi: -58, packet_type: 0, sender: D5F7656277FD, address_type: 1, bond: FF, data: 0201060408734E66 }
### gap_scan_response: { rssi: -55, packet_type: 4, sender: D5F7656277FD, address_type: 1, bond: FF, data: 1106A6DA37DEC19AFC80944AD8A80262C2BE020A00 }

As you can see it works fine.

The only thing you need to do if of course reflash the Firmware of the original Shield with Jeff's Firmware "BGLib_U1A1P_38400".
I had some problems initially as well. Jeff helped me out be hinting me to comment the following block out in the Scanner Sketch:

Code:
// ONLY enable these if you are using the <wakeup_pin> parameter in your firmware's hardware.xml file
//ble112.onBeforeTXCommand = onBeforeTXCommand;
//ble112.onTXCommandComplete = onTXCommandComplete;


I think from now on this is a good starting point for a nice library to deal with the BLE Central role.

Cheers,
Michael.


Mon Jul 22, 2013 10:08 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.