Skip to content

A Unity framework for using bluetooth low energy (BLE) ReadBearLab boards with iOS and Android mobile platforms.

License

Notifications You must be signed in to change notification settings

giomurru/ble-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BLE framework is a Unity library that you can use to easily manage the Bluetooth communication between your mobile device and a ReadBearLab BLE boards. The supported boards are:

  • BLE Shield
  • BLE Mini
  • Blend Micro
  • Blend
  • BLE Nano
  • RBL nRF51822

The ReadBearLab BLE boards can be attached to a micro controller such as Arduino to allow simple wireless serial communication with your mobile device.

The sample Unity project inside the folder Unity contains two sample scenes to get started using the framework.

  1. RobotServer: build this scene for testing BleMini with Arduino Mega Adafruit Motor Shield with 4 DC Motors. The code for Arduino is inside the folder Arduino/RobotClient. Read this article for details on how to wire the Adafruit Motor Shield with 4 DC Motors: https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/overview
  2. MeteoStation: build this scene for a sample app for temperature and humidity sensor reading. The hardware setup is BleMini with Arduino Mega Sparkfun RTH03 sensor. Read this article for details on how to wire the humidity and temperature sensor: https://learn.sparkfun.com/tutorials/rht03-dht22-humidity-and-temperature-sensor-hookup-guide/all You can find the code for Arduino inside the folder Arduino/MeteoServer. In both hardware configurations (RobotClient and MeteoServer) the BleMini Rx and Tx pins must be wired respectively to the Tx1 18 and Rx1 19 digital pins of the Arduino Mega 2560.

Before building the Unity project for Android targets, you need to generate the android plugin using the AndroidPlugin project. You can open this project using Android Studio, then click on Run 'copyPlugin' to generate and copy the plugin in the BleFramework/Assets/Plugin/Android folder. Now you are ready to build the Unity project for Android targets. VERY IMPORTANT FOR ANDROID: When running the android example app the first time you have to grant permission for Location in the Android apps settings menu. No popup is prompt asking for permission and you have to grant the Location permission manually. If you don't give Location permission the BLE scan will return empty result.

As mentioned before Android plugin is generated by the AndroidPlugin Android Studio's project. You can find the code inside the 'bleframework/src' subfolder.

As regard iOS you can find the plugin source code inside the folder Unity/Assets/Plugins/iOS/BLE.

If you want to modify the plugins you can just modify the source code in these folders.

About

A Unity framework for using bluetooth low energy (BLE) ReadBearLab boards with iOS and Android mobile platforms.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published