Giter VIP home page Giter VIP logo

ble-sdk-arduino's Introduction

#ble-sdk-arduino

Bluetooth low energy SDK for Arduino (uses the nRF8001 from Nordic Semiconductor). This has been tested using the Arduino UNO, Mega and Leaonardo boards with the nRF2740/nRF2741 module or the Bluetooth low energy shield from Redbearlab. The shield is available from seeedstudio and makershed.

##Contents The BLE folder in \libraries\ contains the ported bluetooth library (ACI library) and an example project folder. This folder (BLE) should be extracted into the Arduino "libraries" folder.

####Start using the SDK

  1. Download the SDK by clicking "Download ZIP" at the bottom of the right side menu.
  2. Unzip the file.
  3. In the arduino IDE, click 'Sketch' and choose 'Import library' and 'Add Library...'
  4. From the ble-sdk-arduino folder, choose to import the \libraries\BLE folder.

####When using the Bluetooth low energy shield v.1.1 or v.2012.07: Plug the Bluetooth low energy shield onto the Arduino. Set the "Default Handshaking" switch to ON. The nRF8001 REQN is on Digital 9 of the Arduino. The nRF8001 RDYN is on Digital 8 of the Arduino. The SPI lines are routed through the central ICSP connector of the Arduino. To change the REQN and RDYN line to a different Arduino pin, set the "Default Handshaking" switch to OFF, wire the nRF8001 pins on the shield at J5 to the required Arduino pin.

####When using the Bluetooth low energy shield v.2.0: Plug the Bluetooth low energy shield to the Arduino. The REQN and RDYN pins are selectable from pin 2 to 12. Select the Arduino pins to use for REQN and RDYN and put the jumpers to those pins. Reset of the Arduino is connected to the Reset of the nRF8001, so every time a sketch is downloaded from the Arduino IDE the nRF8001 is also reset. The SPI lines are routed through the central ICSP connector of the Arduino.

####When using the nRF2740/nRF2741 modules directly wired to the Arduino: When the Arduino uses a 5v microcontroller,you may have to use level converters or a resistive divider to get the voltage to 3.3v for the lines that are output from Arduino to the nRF8001. The Arduino(3.3v-1.9v) or the Arduino DUE can be wired directly to the nRF8001 without any level converters or resistive dividers.

####When using the nRF2740/nRF2741 modules with the nRF8001/nRF24L01+ shield adapter for Arduino: Plug the nRF8001/nRF24L01+ shield adapter for Arduino to the Arduino. The nRF8001 RDYN is on Digital 3. The nRF8001 REQN is on Digital 10. The SPI lines are available on Digital 11, 12, 13 and the central ICSP connector. To change the REQN and RDYN line to a different Arduino pin, cut the track on the PCB connecting the lines and wire the nRF8001 pins on the shield adapter at P10 to the required Arduino pin.

####Configure the MCU to nRF8001 PIN connection aci_state.aci_pins.board_name = //See board.h for details, Use REDBEARLAB_SHIELD_V1_1 or BOARD_DEFAULT

aci_state.aci_pins.reqn_pin   = 
//SS for Nordic adapter shield , 9 for REDBEARLAB_SHIELD_V1_1 and REDBEARLAB_SHIELD_V2

aci_state.aci_pins.rdyn_pin   = 
// 3 for Nordic adapter shield ,  8 for REDBEARLAB_SHIELD_V1_1 and REDBEARLAB_SHIELD_V2

aci_state.aci_pins.mosi_pin   = MOSI;
aci_state.aci_pins.miso_pin   = MISO;
aci_state.aci_pins.sck_pin    = SCK;

aci_state.aci_pins.spi_clock_divider     = SPI_CLOCK_DIV8; //This divides the input clock by 8 to get the SPI clock
  
aci_state.aci_pins.reset_pin             = 
//4 for Nordic adapter shield, UNUSED for REDBEARLAB_SHIELD_V1_1, 4 or 7 or UNUSED for REDBEARLAB_SHIELD_V2

aci_state.aci_pins.active_pin            = UNUSED;
aci_state.aci_pins.optional_chip_sel_pin = UNUSED;
  
aci_state.aci_pins.interface_is_interrupt  = false;
aci_state.aci_pins.interrupt_number	       = 1;

####Modifying existing nRF8001 configuration: Make sure you always run the run_me_compile_xml_to_nRF8001_setup.bat with the nRFgo studio installed on a Windows PC to generate the setup required for the nRF8001 (services.h). You need to run this again whenever you change the configuration in nRFgo studio.

The nRFgo studio is a Windows program that can be run on the OS X using playonmac (tested) and could also be run on Linux using playonlinux (not tested).

####Porting ACI Library A brief explanation of how to port the ACI library code is available in /documentation/libraries/BLE

##Forum Nordic Developer Zone

##Resources Arduino
nRF8001
RedBearLab BLE Shield from MakerShed
RedBearLab BLE Shield from SeeedStudio

ble-sdk-arduino's People

Contributors

daviddedwin avatar eagmnor avatar george-hawkins avatar keio avatar ketile avatar oisinfitz avatar skjerve avatar stefanbirnir avatar trond-snekvik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ble-sdk-arduino's Issues

services.c generated from RFStudio have wrong signature

The services.c file which is generated from the nRFGo Studio has the wrong signature, since:

The function lib_aci_is_pipe_available only has the Pipe Number as a parameter like in thie example:

if (lib_aci_is_pipe_available(PIPE_GENERIC_GENERICSENSOR1_TX))

but the function in the lib_aci file expects:

lib_aci_is_pipe_available(aci_state_t *aci_stat, uint8_t pipe)

I think this is an error, since auto-generated files should always be compatible with the library otherwise they are nice as a template but do generate compile errors.

Due Compatability

Hey on RedbearLab's website it says:
"BLE Shield stands for Bluetooth Low Energy (BLE) Shield. It is designed to work with Arduino boards or compatibles, including Arduino Uno, Mega 2560, Leonardo and Due." but to use a due you need Arduino 1.5 or above. Once I update to a version that can program the Due, I get no such file or directory errors. Is there any way to work around this?

mpu6050 i2cdevlib error

Hello there,
when using i2cdevlib implementation for mpu6050: https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050_6Axis_MotionApps20.h i get the following error.

/libraries/MPU6050/MPU6050_6Axis_MotionApps20.h:133: error: dmpMemory causes a section type conflict
/libraries/MPU6050/MPU6050_6Axis_MotionApps20.h:273: error: dmpConfig causes a section type conflict
/libraries/MPU6050/MPU6050_6Axis_MotionApps20.h:315: error: dmpUpdates causes a section type conflict

You can reproduce the bug by opening your hello_world example and simply adding the i2cdevlib includes:

#include "I2Cdev.h"
#include <math.h>

#include "MPU6050_6Axis_MotionApps20.h"

It works perfectly with bluesmirf and others, so i think there's some bug in this library(redbearlabs told me to create an issue here: https://redbearlab.zendesk.com/entries/68347515-Blend-Micro-dmpMemory-causes-a-section-type-conflict)

Thanks in advance,
Regards,
Lukas

Handling of data credits in the application

Hi all,

More of a comment than an issue. I noticed that you tend to keep track of data credits higher up in the user application. This is fine, but I'm wondering if it would be better to let the driver handle credits and take that burden away from the user? For example, you have a queue system implemented that has 4 slots for transmitting commands to the nRF8001. In the current implementation, the queue would never be able to queue more than 2 commands that rely on credits. Therefore, it's up to the higher application to track the credits and wait for credits to free up if none are available. But there's no reason why these

Instead, you could have the queue track the credits. Then the higher application only needs to concerned about whether or not there is room in the queue and anything that is in the queue that relies on credits can wait until credits are available.

This is what I've done in my implementation and it works very well. Any events that arrive that increase the number of available credits are not added to the rx queue. Instead, they are handled immediately to ensure that the tx queue doesn't get jammed up.

Size of Dynamic data: comment is incorrect

The size of the dynamic data stated in the comment in the bond_data_read_store in the HID_* examples and the ble_proximity_template example is incorrect. This is due to an nRFgo studio bug that generates the size incorrectly, the size stated in the nRFgo Studio generated txt file is too small.. At this point the DynamicData must be read out and then its size noted and used for sizing the storage.

https://github.com/NordicSemiconductor/ble-sdk-arduino/blob/master/libraries/BLE/examples/ble_HID_keyboard_template/ble_HID_keyboard_template.ino#L302

https://github.com/NordicSemiconductor/ble-sdk-arduino/blob/master/libraries/BLE/examples/ble_proximity_template/ble_proximity_template.ino#L237

redbear arduino DUE shields examples won't compile

I need to use a SAM based arduino for the performance, yet none of the redbear examples compile on the DUE with a EEPROM.H not found. They do compile as is on the MEGA. The DUE has no EEPROM. REDBEAR's advertising says it works on a DUE.

Redbear support says that it is Nordic software that is failing. If Redbear can't support the DUE can you suggest another bluetooth solution that will?

Wrong verification in lib_aci_close_remote_pipe

if((p_services_pipe_type_map[pipe-1].location == ACI_STORE_REMOTE)&&
((p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX)||
(p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK_AUTO)||
(p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK)))
{
return false;
}

It is wrong, i think. It will always return "false" if the pipe is ACI_RX and STORE REMOTE and it shouldn't.

Documentation Updates?

I'm not sure if this is the right venue to ask this, but will the documentation be updated at any point? It's been a few years since several empty/placeholder files were added and several links to "more information" are also placeholder links.

dtm.h has a UTF-8 BOM

The file dtm.h has a UTF-8 byte order mark (BOM). Please remove this as it confuses some compilers.

You might need to use a hex editor to remove the first three bytes (EF BB BF)

Passkey example

I have been trying to understand passkey usage for security reasons. I have used the proximity example but that does not ask for any key thing. Please someone guide me to some doc that can help me.

avr/sleep.h non existant

I'm trying to compile a simple BLEController example sketch but the board I'm using (fireduino) as an ARM processor. Is it true that the avr libraries don't work with ARM processors? If so, how do I get around the sleep.h issue?

Trying to port this to PIC mcu, hoping to talk

Hi, I'm trying to develop a port for the PIC24F series microcontrollers. I followed your instructions and tried to port your nRF8001 code, but I can't seem to get the transport layer verification to work. I've put in a lot of effort, but I feel that I've run into a wall - the problem is probably something really straightforward, but I just don't know your code well enough to see a solution.

To be specific, I am running:

ble_aci_transport_layer_verification.c

and the system can't seem to get past the 1st if statement:

void loop()
{
// We enter the if statement only when there is a ACI event available to be processed
if (lib_aci_event_get(&aci_state, &aci_data))
{
...stuff
}
}

In other words, the if statement never returns true. I have verified that the SPI seems to be running correctly, as well as all the other GPIOs, delays and so on. Interrupts are turned off.

I would really appreciate it if we could communicate.

My email is: [email protected]

Won't connect to iPhone 6, but connects to everything else I've tried.

Hi all,
I'm running iOS 8.2 beta 4, and this won't connect to my iPhone 6.

I've gotten the software working with every other device I've tried (2x iPhone 5S, 1 x iPad 3), but at this point I'm not sure where the issue is. It could be an issue with the device, or with the library. It just hangs on pairing with the device ...
lib_aci_bond_request(); -> ACI_CMD_BOND_SECURITY_REQUEST -> Device displays prompt, tap "pair" -> nothing (???) -> Eventual timeout and return to advertising mode.

If it is a bug with the library I was hoping to help debug it and contribute to the project. I've been messing with this for several hours so far but haven't made any progress. Can anyone offer any insight as to where to look for a possible hangup?

ble_proximity_template does not compile

Hi, when I compile the ble_proximity_template from version 0.9.3 of the SDK I get these compilation errors:

ble_proximity_template.ino: In function 'void aci_loop()':
ble_proximity_template:582: error: 'SETUP_SUCCESS' was not declared in this scope
C:\workspaces\arduino\libraries\BLE/lib_aci.h: In function 'void setup()':
C:\workspaces\arduino\libraries\BLE/lib_aci.h:132: error: too many arguments to function 'void lib_aci_init(aci_state_t*)'
ble_proximity_template:677: error: at this point in file

It looks like aci_setup.h needs:

define SETUP_SUCCESS 0

and In ble_proximity_template.ino: needs:

lib_aci_init(&aci_state);

instead of

lib_aci_init(&aci_state,false);

Wifi driver for joystick

hi , sorry to open a ticket for my question, but I have some questions that your probably advise is really appreciated
Actually I've been trying to send some game keys, base on HID protocol to the computer by wifi link(ESP8266). PC computer with OS like Microsoft Windows instantly make "HID-compliant game controller" driver with typical USB joystick , my question is, how make specific driver which is shows up same as "HID-compliant game controller" but listen to specific IP address instead of USB
tnx

Arduino Zero problem porting

I am having the following errors:
note: in expansion of macro 'SETUP_MESSAGES_CONTENT'
services.h:512:1: error: too many initializers for 'const hal_aci_data_t'
How can I run the sdk on the new board ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.