Tema SCPI Negru Rares-Razvan
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_TemperatureEx by
read_me.md@12:7772974713ac, 2016-10-08 (annotated)
- Committer:
- tanasaro10
- Date:
- Sat Oct 08 10:30:15 2016 +0000
- Revision:
- 12:7772974713ac
- Parent:
- 10:c7d53e4e0602
Version ready for use to exercise.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tanasaro10 | 9:303d3628986a | 1 | # nRF51822_SimpleChat Extended With Data Measurements & Logger |
tanasaro10 | 9:303d3628986a | 2 | This repo is derived from the initial SimpleChat Application and is build for BLE Nano Device, used in peripheral mode. |
tanasaro10 | 9:303d3628986a | 3 | This Application scan and measures some inputs and save them in flash with timestamp. A RTC has been implemented. |
tanasaro10 | 12:7772974713ac | 4 | Using chat application (available for smartphones) some commands can be send to BLE Nano in order to perform some tasks. |
tanasaro10 | 9:303d3628986a | 5 | Other types of commands can be send via serial interface from a PC, especially data extraction from flash. |
tanasaro10 | 9:303d3628986a | 6 | |
tanasaro10 | 9:303d3628986a | 7 | #Usage/Description: |
tanasaro10 | 9:303d3628986a | 8 | After flashing or power on, the ble device will start to advertise and also its local time counter starts. While initializing, application |
tanasaro10 | 9:303d3628986a | 9 | will search through all flash pages, last data previosly written. From this pages will retrieve the last data and time available. |
tanasaro10 | 9:303d3628986a | 10 | A Timer Tick (period set to 1 second) is used for updating RTC and for data measurements. When the application starts the data will not be saved |
tanasaro10 | 9:303d3628986a | 11 | in flash until a command is given to start (xf2). When started, it is recommended after connecting to ble device to set the time and date; |
tanasaro10 | 9:303d3628986a | 12 | After the date and time updated, activate measurement logging (xf2). |
tanasaro10 | 9:303d3628986a | 13 | |
tanasaro10 | 9:303d3628986a | 14 | Please be aware that for 5-6 seconds, each 100 seconds the connection is stopped by the application. This is due to fact that |
tanasaro10 | 9:303d3628986a | 15 | writing to flash is safe when radio connection is off. When g_MyDataIdx is between 95..100, connection should remain closed. |
tanasaro10 | 9:303d3628986a | 16 | |
tanasaro10 | 9:303d3628986a | 17 | The Application can use somewhere around 100 flash pages (100K). This means, if data is sampled each second, the pages will start |
tanasaro10 | 9:303d3628986a | 18 | to overwrite after 100*100 seconds = 2.7 hours. Anyway the data is inserted into logger when it is different compared to previous |
tanasaro10 | 9:303d3628986a | 19 | measurement. Therefore the time the flash memory can log is bigger than 2.7 hours. |
tanasaro10 | 9:303d3628986a | 20 | |
tanasaro10 | 9:303d3628986a | 21 | When retrieving the data log via serial, the format is as follows: |
tanasaro10 | 9:303d3628986a | 22 | -> page starts with: |
tanasaro10 | 9:303d3628986a | 23 | 2016_ 4_22 H: 7 => year, month, day, and hour |
tanasaro10 | 9:303d3628986a | 24 | 26:51;363; 1; 15 => minutes: seconds; A3,A4,A5 (no info about digital inputs) |
tanasaro10 | 9:303d3628986a | 25 | -> following rows up to the next page: |
tanasaro10 | 9:303d3628986a | 26 | 0: 5;364; 1; 15 => minutes: seconds - time delta (time elapsed since last measurement); A3, A4, A5; |
tanasaro10 | 9:303d3628986a | 27 | |
tanasaro10 | 9:303d3628986a | 28 | #Hardware Connections |
tanasaro10 | 9:303d3628986a | 29 | The BLE Nano Device is connected to some peripheral components as follows: |
tanasaro10 | 9:303d3628986a | 30 | * Light Sensor ( A3 input) |
tanasaro10 | 12:7772974713ac | 31 | * Temperature Sensor (A5 input) |
tanasaro10 | 9:303d3628986a | 32 | * Buzzer (D6 output) |
tanasaro10 | 9:303d3628986a | 33 | * Push Button (D5 input) |
tanasaro10 | 9:303d3628986a | 34 | [*] Optional: MKUSB 20 Board (for Voltage Supply and for Serial Communication with a PC) |
tanasaro10 | 9:303d3628986a | 35 | |
tanasaro10 | 9:303d3628986a | 36 | # Supported Commands |
tanasaro10 | 9:303d3628986a | 37 | From RedBear Chat Application following messages are valid: |
tanasaro10 | 9:303d3628986a | 38 | * Any message that not start with 'x' is echoed with 'R:' as prefix, and also is send via Serial Interface to PC |
tanasaro10 | 9:303d3628986a | 39 | * Any message that start with 'x' is interpreted as command: |
tanasaro10 | 12:7772974713ac | 40 | * xr1 /xr2 / xR3 / xr4 =>prints tvarious inputs |
tanasaro10 | 9:303d3628986a | 41 | * xl => toggle led status |
tanasaro10 | 9:303d3628986a | 42 | * xtg => returns the current time |
tanasaro10 | 9:303d3628986a | 43 | * xti[0-9]{6} => insert time - exp: xti181004 means: 18H10M and 4 seconds |
tanasaro10 | 9:303d3628986a | 44 | * xdg => returns the current date |
tanasaro10 | 9:303d3628986a | 45 | * xdi[0-9]{6} => insert date - exp: xti160424 means: 2016 Y, 04 Month, 24 Day |
tanasaro10 | 9:303d3628986a | 46 | * xf1 => prints the value of g_MyDataIdx (a value now between 0..99) representing the steps until a new page will be written |
tanasaro10 | 9:303d3628986a | 47 | in flash with new data; It also print the current flash page that will be written (between 155 and 255) |
tanasaro10 | 9:303d3628986a | 48 | * xf2 => activate measurements logging |
tanasaro10 | 9:303d3628986a | 49 | * xf3 => deactivate measurements logging |
tanasaro10 | 9:303d3628986a | 50 | * x* => for invalid syntax a sound for 3 seconds is activated, with a message error |
tanasaro10 | 9:303d3628986a | 51 | From PC serial interface (with MKUSB 20 Board), following commands apply: |
tanasaro10 | 9:303d3628986a | 52 | * xf[0-9] => request printing on serial of a specific flash page ( 0 - current page; 1 - previous page, etc) |
tanasaro10 | 9:303d3628986a | 53 | * xd => request dump of all recorded logs (starting with current page) |
tanasaro10 | 9:303d3628986a | 54 | * xg => prints the value of g_MyDataIdx (a value now between 0..99) representing the steps until a new page will be written |
tanasaro10 | 9:303d3628986a | 55 | in flash with new data; |
tanasaro10 | 9:303d3628986a | 56 | * xca => open Radio Advertising (should be used when the Advertising is Off) |
tanasaro10 | 9:303d3628986a | 57 | * xcc => Close Radio connection (should be used when Connection is in Connected state) |
tanasaro10 | 9:303d3628986a | 58 | * xcs => Stop Radio Advertising (should be used when Advertising is active) |
tanasaro10 | 9:303d3628986a | 59 | |
tanasaro10 | 9:303d3628986a | 60 | Other Commands: |
tanasaro10 | 12:7772974713ac | 61 | |
tanasaro10 | 9:303d3628986a | 62 | |
tanasaro10 | 9:303d3628986a | 63 | # References |
tanasaro10 | 9:303d3628986a | 64 | The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. |
tanasaro10 | 9:303d3628986a | 65 | A good starting point are these pages: |
tanasaro10 | 9:303d3628986a | 66 | * [mbed BLE Homepage](http://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE |
tanasaro10 | 9:303d3628986a | 67 | * [mbed BLE Getting Started Guide](http://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed |
tanasaro10 | 9:303d3628986a | 68 | * [mbed BLE API page](http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/docs/tip/) for the API in generated by doxygen |
tanasaro10 | 9:303d3628986a | 69 | |
tanasaro10 | 9:303d3628986a | 70 | For this Application: |
tanasaro10 | 9:303d3628986a | 71 | * [redBEar Ble Nano] (http://redbearlab.com/blenano/) |
tanasaro10 | 9:303d3628986a | 72 | * [Project Blog - to be updated](http://tanasaro10.blogspot.ro/) |