Wiki

Clone wiki

bluerx / Home

Welcome!

This should get things started! Let me know what else could be helpful! The PWM chip that the Blue-Rx is based on is a PCA9685:

http://www.nxp.com/products/interface_and_connectivity/i2c/i2c_led_display_control/series/PCA9685.html

Keep in mind the iOS code is a "proof of concept" version, it was hacked together as quickly as possible to demonstrate the functionality of the Blue-Rx board. It is NOT a pristine example of iOS / Cordova "best practices".

To purchase a Blue-Rx see:

http://www.gigamint.com/bluerx

Have fun!

Getting Started

Start by clicking on the Source tab to browse and download the source files. If you want to download the source without using git click the Downloads tab, goto Branches and click zip, gz, or bz2 next to the 'master' branch...

Download

Use git or click here for the zip.

Folders

  • ios -- iPhone demo app; "Proof of Concept", not thoroughly tested, optimized, or commented...
  • eagle -- board schematic and layout
  • ble112 -- firmware
  • schematic -- pdf of the board schematic

Firmware

In order to update / modify the firmware download the SDK from www.bluegiga.com, you will need to sign up for an account and then access the support page. To re-flash the board a TI CC Debugger is needed.

Blue-Rx GATT Info (default firmware)

#!text

* Blue-Rx Service, UUID - e4377d72-3993-43d7-a941-cd96530783a4

Characteristics

For detailed information see http://repo.startechplus.com/bluerx/src/master/ble112/script/gatt.xml?at=master

UUID's

#!text

* Channel Control - 882b4cf2-80ec-46d7-bf99-301ade180c91
* Frequency Prescaler - ec123c55-031a-418a-9997-26764dd22c75
* Default Channel Value - c6e55d12-804a-4c88-bf0a-27c58fa37638
* ADC Input 0 - db101ea2-2893-4f6c-a3e8-23fc975f41c2
* ADC Input 1 - 0887a481-5b05-42d0-9cf6-76ee54b33ddb
* ADC Input 2 - e6313803-3185-4732-83fe-239f9b167738
* Digital Output 0 - f122ebc5-1fc9-4026-99b7-f9771755b8f4
* Digital Output 1 - cb8de209-999b-40f9-acb8-32593976f4fa
* Output Enable - 8415d9ac-7c77-4d43-ad9c-2270f0deadaf
* User Configurable Board ID - 8f3fdf19-6e57-4228-9093-ca45e1f74497
* Signal Loss Mode - 3b121051-87f1-408e-8371-2541820f24fc
* Fast Servo Control - 32094d1d-3be7-4c4e-b14c-4bfd6ea57739
* Offset - c708db31-85d2-47a4-9a8f-384e298804bc

Packet Structure

Each characteristic needs a certain packet size written to it or read from it [byte0, byte1, byte2, ... ]

#!text


* Channel Control - WRITE [rawChannel, startLowByte, startHighByte, stopLowByte, stopHighByte] se PWM chip datasheet
* Frequency Prescaler - WRITE [rawPrescaleValue] see PWM chip datasheet
* Default Channel Value - WRITE [rawChannel, startLowByte, startHighByte, stopLowByte, stopHighByte]
* ADC Channel 0 - READ/NOTIFY [valueLowByte, valueHighByte]
* ADC Channel 1 - READ/NOTIFY [valueLowByte, valueHighByte]
* ADC Channel 2 - READ/NOTIFY [valueLowByte, valueHighByte]
* Digital Output 0 - WRITE [value] 0 off !0 on
* Digital Output 1 - WRITE [value]
* Output Enable - WRITE [value] 0 off !0 on
* User Configurable Board ID - READ [value]
* Signal Loss Mode - READ/WRITE [value]
* Fast Servo Control - WRITE [rawChannelStart, channelValue0, channelValue1, ... , channelValue7]
* Fast Servo Offsets = WRITE [offset0, offset1, offset2, ..., offset15]

Characteristic Details

Channel Control

This characteristic can be written to both with and without notification. It should allow full PWM control of the channel with start time and stop time of the pulse from 0 to 4095, within the PWM period.

Frequency Prescaler

This characteristic can be written to and read from and should be saved and recalled at boot. It adjusts the PWM frequency from 40 Hz to 1000 Hz The formula is in the PWM chip datasheet.

Default Channel Value

This characteristic can be written to. It should be saved and recalled at boot. It is the default value for a specific channel that the channel should be updated to on initial boot, loss of signal, or loss of connection based on Signal Loss Mode. It allows full PWM timing control.

ADC Channel 0 - 2

This characteristic can be read with or without notification. It should report the value from 0 to 3.3v on the specified ADC pin, with two byte precision...

Digital Out 0 - 1

This characteristic can be written to with or without notification. It should update the value on the specified pin from 0 to 3.3v, 0 = low, anything else = high.

Output Enable

This characteristic can be written to with or without notification. It should turn on or off the PWM output completely for all channels, 0 = low, anything else = high.

User Configurable Board ID

This characteristic can be read and written to. Use this to add more identity to a board for your specific application.

Signal Loss Mode

This characteristic can be read and written to. It should be saved and recalled on boot. There are three valid values for this characteristic, 0 = Default Value, 1 = Coast, 2 = Disable PWM Output. When signal is lost in Default Value mode then the channels should revert to the value specified by the Default Channel Value characteristic. When signal is lost in Coast mode the PWM output should not change. When signal is lost in Disable PWM Output mode then the OE on the PWM chip should be triggered to shutdown the chip, it should not come back on until a command is sent to the Output Enable characteristic, both on reconnection or reboot.

Fast Servo Control

This characteristic can be written to, both with and without notify. It should update 8 channels of PWM starting at the raw channel value in the first byte, channel 1 = 6 (0x06), channel 9 = 38 (0x26), each following byte is a value for the PWM pulse width given by (offset + value), where offset is given by the values written to the Fast Servo Offsets characteristic.

  • The default servo frequency is 50 Hz, and is set in the Frequency Prescaler Characteristic.
  • The PWM chip is 12 bits so the resolution of the PWM of the servo is ( ( 1 / 50 ) / 4096 ) = 4.8828125 us
  • The default offset is 180 so the PWM range is ( (180 + 0) * 4.8828125 us ) to ( ( 180 + 255 ) * 4.8828125 us) which is 0.879 ms to 2.124 ms
  • For a standard servo the value in the channel value byte would range from 1 ms to 2 ms so the equation is ((180 + x) * 4.8828125 us = 0.001 or 0.002; x = 25 or 230 this gives some head room to calibrate the servos

Given the statements above... for a standard servo the range of values for the channel byte is 25 (0x19) to 230 (0xE6) with 128 (0x80) as mid-value or center. Some example packets are:

[0x06, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80] -- Center channels 1 - 8

[0x26, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80] -- Center channels 9 - 16

[0x06, 0x19, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80] -- Center channels 2 - 8, channel 1 is at -90 degrees

[0x06, 0xE6, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80] -- Center channels 2 - 8, channel 1 is at +90 degrees

Fast Servo Offsets

This characteristic can be read and written to. It should be saved and recalled on boot. It defines the offset for Fast Servo Control

Updated