fang chen
/
mdot_two_way
test _oliver
Diff: README.md
- Revision:
- 0:20fbd6f66b11
- Child:
- 1:b604a2d6c54d
diff -r 000000000000 -r 20fbd6f66b11 README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Tue Jan 03 13:20:36 2017 +0000 @@ -0,0 +1,52 @@ +# LoRa Soap dispenser + +Smart soap dispenser that sends out stuff over LoRa. Does not build with GCC, only ARMCC (also with mbed CLI). + +## Setup + +1. Set jumper JP95 (next to RESET button) to the two pins closest to the mDot. +2. Attach something that generates an interrupt on D6 / PA_1. +3. RFID code needs to be implemented, currently spits out a random ID. + +To get data into Device Connector: + +1. First get keys by exchanging a device cert for LoRa keys at http://apm-lora-eu2.cloudapp.net:5101. +2. Add the keys to ``main.cpp``. +3. Then under 'Resources' add: + + ``` + { + "dispenser/0/value": { + "mode": "r", + "defaultValue": "0" + }, + "meta/0/timestamp": { + "mode": "r", + "defaultValue": "" + }, + "meta/0/ids_seen": { + "mode": "r", + "defaultValue": "" + } + } + ``` + +4. Under 'Process Data' add: + + ```js + function (bytes) { + var ids = []; + for (var i = 0; i < (bytes.length - 2) / 4; i++) { + var c = bytes.slice(2 + (i * 4), 2 + (i * 4) + 4); + ids.push((c[0] << 24) + (c[1] << 16) + (c[2] << 8) + (c[3])); + } + + return { + "dispenser/0/value": (bytes[0] << 8) + bytes[1], + "meta/0/timestamp": new Date().toISOString(), + "meta/0/ids_seen": ids.join(',') + }; + } + ``` + +5. Click 'Save' and your data should show up in Device Connector (after the next transmission).