Reading virtual pin from server with Bluetooth device (ESP32 Dev Board)

Hi,

Feeling a bit awkward but I’ve been trying to get the most basic function of updating virtual pin on the device from server running for ages with no luck.

I’m using library version 0.6.1 and the Android app + Blynk server

For testing, I made in my app a push button on V1, and a value display for V3.
The weird thing is that the device gets the push button, but not when I update pin V3 on the server even though the display in the app is updated.

(I used cloud API to update values. e.g: http://blynk-cloud.com/NWN3oewLDpwn4jykXhay11c1d_o85oHu/update/V3?value=909).

The exact same code works perfect on WiFi (same issue with BLE though). What’s going on here? Is this because the device is somehow blocked from the server by the mobile?

Thanks!


#define BLYNK_PRINT Serial

#define BLYNK_USE_DIRECT_CONNECT

#include <BlynkSimpleEsp32_BT.h>


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "NWN3oewLDpwn4jykXhay11c1d_o85oHu";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Serial.println("Waiting for connections...");

  Blynk.setDeviceName("TimesenseBT");

  Blynk.begin(auth);
}

void loop()
{
  Blynk.run();
}


BLYNK_WRITE(V1)
{
  
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  Serial.print("V1: "); Serial.println(pinValue);
  // process received value
}

BLYNK_WRITE(V3)
{
  
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  Serial.print("V3: "); Serial.println(pinValue);
  // process received value
}

Have you tried without the #define BLYNK_USE_DIRECT_CONNECT ?

Pete.

Thanks @PeteKnight .

I tried it and now I can’t connect… After reading a bit I get the impression
#define BLYNK_USE_DIRECT_CONNECT is actually necessary for Bluetooth / BLE.

Any other ideas?

BTW, I must say I’m surprised BLE/Bluetooth is not more popular. I’m working on a wearable, so it seams to me like an obvious choice.
Perhaps it’s just because it’s not mature enough…

(and @Mukhtyar_Singh , not sure I understand how this is relevant to this post… Sorry, can’t help you)

Sorry, I never use BT

Blynk is an IoT system which is built around the principal that devices are in constant communication with the server via an open internet connection.
That’s not possible with BT, so the connection is with the mobile device, and in some situations that sends data back to the server.
Personally, I don’t see BT as having a proper role within an IoT system, unless you’re using a dedicated gateway to communicate with BT devices such as soil moisture sensors, scales etc.

Yes, @Mukhtyar_Singh’s post is inappropriate in more than one way, I’ll delete it.

Pete.

Thanks again @PeteKnight .

I actually feel BLE and Bluetooth have a lot of potential for IoT applications, but I can see now the mindset and how it’s not really a priority for the developers, especially as it requires a different architecture than a constant communication setup.

Was hoping I can get around it, but I’m starting to think it’s not going to be an ideal solution for me either way…

Thanks!

1 Like

The priority for the developers is to create systems that sell to paying customers.
As freeloaders we get the crumbs that fall off of that particular table :grinning:

Blynk was developed and given for free to people like us, as a way of generating interest and allowing potential paying customers to develop proof of concept prototypes. I think BT support was part of the second phase of that development, but because of the limitations of the protocol and the underlying Blynk architecture it’s never appealed to business users, so it hasn’t really developed much since its beta launch.

BT isn’t currently a feature of the new version of Blynk that’s being beta tested at the moment, and personally I hope that it gets dropped - because it’s not mature enough and doesn’t mesh well with the corporate offering.

Pete.

1 Like