| 38 | |
| 39 | Now that the packet structure and values are established, the candle can be controlled by the Gateworks SBC & GW16126 BLE card. |
| 40 | |
| 41 | The following was done with a Gateworks Ventana SBC using Ubuntu Bionic software. |
| 42 | |
| 43 | 1. Load the following modules |
| 44 | {{{ |
| 45 | modprobe algif_hash; modprobe algif_skcipher; modprobe algif_rng; modprobe algif_aead; modprobe af_alg; modprobe hci_uart; |
| 46 | }}} |
| 47 | 1. Start the bluetooth daemon |
| 48 | {{{ |
| 49 | bluetoothd -E & |
| 50 | }}} |
| 51 | 1. Find the device the bluetooth is connected to |
| 52 | {{{ |
| 53 | dev=$(basename $(ls -d /sys/bus/usb/drivers/ftdi_sio/*/ttyUSB*)) |
| 54 | }}} |
| 55 | 1. Attach bluetooth to inferface dev |
| 56 | {{{ |
| 57 | btattach -B /dev/$dev -S 1000000 -P h4 & |
| 58 | }}} |
| 59 | 1. Now scan for BLE devices and confirm we have found the candle |
| 60 | {{{ |
| 61 | hcitool -i hci0 lescan |
| 62 | }}} |
| 63 | 1. Change the color of the candle to red: |
| 64 | {{{ |
| 65 | gatttool -i hci0 -b 3C:A3:08:10:51:FE --char-write-req -a 0x002e -n 56ff000000f0aa |
| 66 | }}} |
| 67 | 1. Change the color to green: |
| 68 | {{{ |
| 69 | gatttool -i hci0 -b 3C:A3:08:10:51:FE --char-write-req -a 0x002e -n 5600ff0000f0aa |
| 70 | }}} |
| 71 | |
| 72 | == IoT and Beyond == |
| 73 | |
| 74 | The LED Candle is only an example. |
| 75 | |
| 76 | BLE can be used for many industrial sensors, such as tags for location information. |
| 77 | |
| 78 | The CAT M1 modem on the GW16126 can then further enable internet connectivity, allowing sensor data to be pushed to the cloud. |