5

I know it's pretty standard to set up an Arduino system as a BLE client, and use something like an app running on a smartphone as the GATT server, which receives the data and does something with it.

In my scenario I have a BLE sensor that is not connected directly to the Arduino system, and I want the Arduino to be able to respond to the sensor output (a wearable accelerometer) and, for example, initiate various lighting sequences depending on the data being received.

I would prefer not to introduce a third component (ie: mobile device as GATT server) into the equation. I'd like for the Arduino to listen to the remote device's services and characteristics, analyze the incoming data and then make some decisions about what LEDs to illuminate based on that analysis.

Can an Arduino run as a GATT server?

  • 1
    You have it precisely backward. The GATT server is the peripheral device. The client is typically a mobile device. That said, I'm looking into this exact thing right now. The Arduino 101's Nordic module is capable of running in Central mode, but I'm unable to find any info on loading the S120 Soft Device. I have read that the Arduino lib doesn't have an API for it though. Theoretically possible, but I haven't figured out how to do it yet. – RubberDuck Aug 18 '16 at 0:10
  • Does it have to be an Arduino or can it be Arduino IDE compatible? - e.g. something like the Adafruit Feather Bluefruit LE module? – Simon Peverett Oct 10 at 11:56
  • Sure, I think @Simon – Tom Auger Oct 30 at 16:41
  • @Tom Auger There is an Adafruit Feather 32u4 Bluefruite LE module, you can interact with the BLE part using AT commands, it's pretty basic and can only act as a Server/Peripheral device. It doesn't support notifications or indications, but you can define a custom service with it's own characteristics. – Simon Peverett Nov 1 at 10:52
  • 1
    @ Tom Auger The ESP32 modules also support BLE, but I haven't played with that aspect of the module. Looking at the examples available for the ESP32, that can be both a GATT Client and a GATT Server. – Simon Peverett Nov 1 at 10:54
0

An ESP32 module (Arduino IDE compatible) can act as both a GATT Client and Server, and there are module examples for each of these, as well as github projects.

  • I'll be checking that out soon. To make your answer more complete, you might post some example code or at the minimum some links, for the benefit of others that Google this question. – Tom Auger Nov 2 at 13:43
0

I got this link here that could be helpful - link at the bottom. It is a tutorial that shows you how to control your Arduino with a custom app on an Android. It uses the MIT app creator, an app that lets you create an app. You program it with there IDE in some Java I believe. You can add button to your app so that is sends a message to your Arduino then program the Arduino to do something when it receives that message. For the Arduino side, you could buy an HC-05 Bluetooth module. It is both an transmitter and receiver. It is quite cheap and very popular so there is many libraries out there. I think this is a good module you should get and I recommend to get them in pairs so you can connect them together with 2 Arduinos.

https://www.youtube.com/watch?v=E-1w7dL3Cps

  • Not applicable to the question asked. An HC-05 is a classic bluetooth device. This question is about BLE aka BTLE which is a very different standard, arguably having little more than the word "bluetooth" in common with one another. – Chris Stratton Jul 3 '17 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.