Skip to content

A proof of concept connecting Unity program with micro-controller with BLE

Notifications You must be signed in to change notification settings

ttruty/FeatherAccelerometerUnity

Repository files navigation

BLE Feather NRF52

This was a project to demonstrate the connection between a BLE Adafruit microcontroller and Unity.

BLE_U NITY

Project overview

Required for project

Hardware

Software

Aims of Project

  • Goal of the project is to demonstrate that any BLE microcontroller will be able to connect to a unity project
  • The main example of the BLE Unity library connects a RFDuino module to a unity project, but any BLE device should be able to be connected.
  • To Demonstrate this, I will have the device connect via bluetooth LE to the Unity Game runnung on a phone.
  • As the device is tilted a cube on the unity program will also tilt.
  • This is the proof of concept mainly to show connection with Unity.

Fritzing

Unity code

The most important part of the unity code is the connection to BLE

private string _FullUID = "6e40****-b5a3-f393-e0a9-e50e24dcca9e"; //Default UUID from adaFruit nrf52
    private string _serviceUUID = "0001"; // service characteristic
    private string _readCharacteristicUUID = "0003"; 
    private string _writeCharacteristicUUID = "0002";
    private string deviceToConnectTo = "_TimsBluefruit52"; //change to name given to module on Arduino code

  • This is what is defines the device, the FullUID is the UART service definition
  • The name of the device is what is defined in the arduino code
  • Unity is subscribing to the UART serial read of the arduino and parsing out the XYZ read from the accelerometer.
  • The block on the screen in turn changes color to what the LED shows on the RGB arduino

Materials

<title>Fritzing Bill of Materials</title> <style type="text/css"> .meta { font-size: small; margin: 0.4em 0; } table { border-collapse: collapse; } th { font-weight: bold; text-align: left; border-bottom: 1px solid black; padding: 0.1em 1.5em 0.2em 0.1em; } td { border-bottom: 1px solid #CCC; padding: 0.5em 1.5em 0.5em 0.1em; } .props { font-size: smaller; } </style>

Bill of Materials: BLE_Unity.fzz

BLE_Unity.fzz

Thursday, May 2 2019, 14:46:02

Assembly List

Label Part Type Properties
LED1 RGB LED (com. anode, rbg) package 5 mm [THT]; polarity common anode; pin order rbg; rgb RGB
Part1 Triple Axis Accelerometer Breakout - ADXL335 chip ADXL; axes 3 (x, y, z)
Part2 Adafruit Feather nRF52 variant variant 1; part # Adafruit #3406

Shopping List

Amount Part Type Properties
1 RGB LED (com. anode, rbg) package 5 mm [THT]; polarity common anode; pin order rbg; rgb RGB
1 Triple Axis Accelerometer Breakout - ADXL335 chip ADXL; axes 3 (x, y, z)
1 Adafruit Feather nRF52 variant variant 1; part # Adafruit #3406


Exported with Fritzing 0.9.3- http://fritzing.org

KNOWN ISSUES

Will only work with specified BLE device, will add selection in future development

About

A proof of concept connecting Unity program with micro-controller with BLE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published