Connect arduino nano 33 ble to my mobile phone

Hello,

I have a project for school which consists in the creation of a hit captor for boxer (sac de frappe in french). To do this, i have to connect an Arduino nano 33 ble Sense with the Bluetooth. The idea is to transfer measurements of the accelerometer to a smartphone with an application by using bluetooth (maybe made with MIT app Inventor ??).

I also want to add a fonction in the code that can calculate power of the boxer's hit from the measurements of acceleration (accelaration --) force ---) power) to finally create a graphic showing to the boxer the power of his hits on the punching bag (with simple visual values ) .

But i didn't manage to connect my arduino to my smarthphone with the classic bluetooth button of my smartphone. I followed a tuto to connect it and I only succeeded in connecting the arduino with an application called "nFr connect" but I can't do anything except read "hello world".

Do you know if "nFr connect" is capable of display a graph of something like this in order to have simple and intuitive informations for a boxer ?
The code (for bluetooth nFr connect) in question is here : (it's just an example because my final goal is to do this but with the accelerometer)

#include <ArduinoBLE.h>

static const char* greeting = "Hello World!";

BLEService greetingService("180C");  // User defined service

BLEStringCharacteristic greetingCharacteristic("2A56",  // standard 16-bit characteristic UUID
    BLERead, 13); // remote clients will only be able to read this

void setup() {
  Serial.begin(9600);    // initialize serial communication
  while (!Serial);

  pinMode(LED_BUILTIN, OUTPUT); // initialize the built-in LED pin

  if (!BLE.begin()) {   // initialize BLE
    Serial.println("starting BLE failed!");
    while (1);
  }

  BLE.setLocalName("Sac de frappe");  // Set name for connection
  BLE.setAdvertisedService(greetingService); // Advertise service
  greetingService.addCharacteristic(greetingCharacteristic); // Add characteristic to service
  BLE.addService(greetingService); // Add service
  greetingCharacteristic.setValue(greeting); // Set greeting string

  BLE.advertise();  // Start advertising
  Serial.print("Peripheral device MAC: ");
  Serial.println(BLE.address());
  Serial.println("Waiting for connections...");
}

void loop() {
  BLEDevice central = BLE.central();  // Wait for a BLE central to connect

  // if a central is connected to the peripheral:
  if (central) {
    Serial.print("Connected to central MAC: ");
    // print the central's BT address:
    Serial.println(central.address());
    // turn on the LED to indicate the connection:
    digitalWrite(LED_BUILTIN, HIGH);

    while (central.connected()){} // keep looping while connected
  }
    // when the central disconnects, turn off the LED:
    digitalWrite(LED_BUILTIN, LOW);
    Serial.print("Disconnected from central MAC: ");
    Serial.println(central.address());
    }

Thanks for your help (sorry for my english)

I would recomend you Blynk. It is mainly focused on IOT but you can connect it with bluetooth.
I use it in a lot of my projects!

Blynk has its own site, blynk.io , but I would recommend you take a look here and it also has its own documentation.
You can find a GitHub link here for the library.

It looks difficult, but the code isn't difficult at all! and the app is really good.

Isaak

I would suggest my (paid) pfodApp which connects via WiFi, Classic Bluetooth, BLE or SMS.
It has a free pfodDesigner app which will design graphs for you as well as control buttons etc. and then generate all the necessary Arduino code.

All the menu/graph code is in your Arduino sketch. The pfodApp is just the display (like a mini browser)
See the nano 33 examples in this tutorial

Be aware that BLE connections can be sloooow so you may need to buffer your data first before you send it to the graph.

Hello,
Thanks for your answers

I already try blynk but i don't manage to connect it in bluetooth...

But if i simply want to "activate" the bluetooth of my arduino BLE and connect it like any other more common bluetooth device (smartphone,earphones..) how i am suppose to do that ??
because i developped a little cheap application with MIT App Inventor but i can't "detect" my arduino with my phone
I think the module bluetooth inside the Arduino is not "initialisated" or "activated" and so it do not work...

Its just a problem of activate the bluetooth but if i try my program (in my first post) i see my module "sac de frappe" on my phone in the bluetooth settings but i have the following message :"application is needed to use this device" so i cant pairing the arduino with my phone...

Thanks you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.