Introduction: LinkIt One : GATT Server Intro
LinkIt One has support for Bluetooth Low Energy aka BLE. Low Energy mode in Bluetooth is very energy efficient, making it preferred mode for various IoT devices.
In this instructable, I will be giving an intro on how to use BLE GATT services in LinkIt One.
Android Phone/Tab with BLE support
Step 1: Prepare Your LinkIt One
First upload the attached sketch to your LinkIt One.
In this sketch, there are two GATT services implemented "GATTSerive1" and "GATTService2".
For service1, there are four characteristics and service2 has 3.
After uploading, open your Serial Monitor.
There is delay of 20sec before sketch initializes BLE functionalities. This can be used for opening Serial Port. During this time, LEd at pin 13 will blink.
Step 2: View You LinkIt One
in Serial monitor, you can see that GATT Server is being initialized and services and characteristics are being added.
Screen shot shows this initialization.
Now if you start nRf Master Control Panel in your Android device, you will be able to see your LinkIt One.
Step 3: Connect to LinkIt One
To Connect to LinkIt One, simply select "LinkIt One" in nRF MC and click on "connect" button (black).
This will connect your android device to LinkIt One using BLE.
Screenshot 1 shows the message in LinkIt One Serial monitor when connection is done.
Screenshot 2 shows nRf MC with LinkIt one listed with it's BLE capabilities.
Screenshot 3 shows expanded view of "LinkIt One"
Step 4: Read From LinkIt One
Once you are connected, you can communicate to LinkIt One.
In this sketch, I have 2 services. First one has 2 read characteristics and 2 write characteristics. Second one has 2 and 1 each. These are defined in "GATTService1" and "GATTService2" in sketch.
To read from LinkIt One, just press the "down" arrow near a read characteristics.
Screenshot 1 shows LinkIt Serial monitor displaying the read request from android device.
Screenshot 2 shows nRF MC with associated services.
Screenshot 3 shows nRF MC with read data on first characteristics of first service.
Step 5: Write Something to LinkIt One
Now let's try writing something.
in nRF MC, select a characteristic which support write functionality (with "UP" arrow).
Now a pop up will show. Select "Text" in 'Type' and type in some text. (Screenshot 1 )
Click Send to write to LinkIt One.
Now in your serial monitor, you can see the data (Screenshot 2)
Step 6: Disconnect From LinkIt One
To disconnect, simply click "disconnect" button in nRF MC.
In your serial monitor, you can see a message (Screenshot 1)
Now if you go to nRF MC logs(swipe right to see), you can see the log (Screenshot 2)
That's it!! A quick tutorial on GATT services with LinkIt One
We have a be nice policy.
Please be positive and constructive.