blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.84k stars 1.39k forks source link

having issue connecting to microbit via BLE #459

Closed kenken64 closed 5 years ago

kenken64 commented 5 years ago

Blynk library version: 0.6.1 IDE: Arduino IDE version: 1.8.9 Board type: BBC Microbit Additional modules:

Install the Arduino-nRF5 board core. Follow instructions here: https://github.com/sandeepmistry/arduino-nRF5 Install the Adafruit Micro:Bit Library. https://github.com/adafruit/Adafruit_Microbit and learn more about it here: https://learn.adafruit.com/use-micro-bit-with-arduino Install the arduino-BLEPeripheral library by following instructions here: https://github.com/sandeepmistry/arduino-BLEPeripheral Install the NewPing Library: https://github.com/eliteio/Arduino_New_Ping Experimental, but useful: Sparkfun's Mag3110 compass library - https://github.com/sparkfun/SparkFun_MAG3110_Breakout_Board_Arduino_Library

https://learn.adafruit.com/use-micro-bit-with-arduino?view=all

Scenario, steps to reproduce

[What you are trying to achieve and you can't?] Follow the steps http://help.blynk.cc/hardware-and-libraries/arduino/bbc-microbit-arduino-ide

Expected Result

[What are you expecting to happen as the consequence of above reproduction steps?] Should be able to connect to micro bit

Actual Result

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.] Serial monitor stuck at waiting for connection ...and occasionally I see packet is too BIG Serial print out

kenken64 commented 5 years ago

17:55:53.927 -> Waiting for connections... 17:55:53.927 -> [38] 17:55:53.927 -> _ __ 17:55:53.927 -> / 187] Connecting... 17:55:53.927 -> Connecting... 17:55:53.927 -> [324188] Connecting... 17:55:53.927 -> [333[342188] Connecting... 17:56:02.921 -> [351188] Connecting... 17:56:11.903 -> [360188] Connecting... 17:56:13.860 -> [362145] >3b1be 17:56:13.894 -> [362163] Packet too big: 25189 17:56:13.928 -> [362196] >b087b 17:56:13.928 -> [362214] Packet too big: 14178 17:56:13.962 -> [362248] >5ac3a 17:56:13.996 -> [362266] Packet too big: 13153 17:56:17.021 -> [365299] Bad hdr len: -1 17:56:17.055 -> [365326] Connecting... 17:56:18.875 -> [367155] >3b1be 17:56:18.910 -> [367173] Packet too big: 25189 17:56:18.944 -> [367206] >b087b 17:56:18.944 -> [367224] Packet too big: 14178 17:56:18.978 -> [367257] >5ac3a 17:56:19.013 -> [367276] Packet too big: 13153 17:56:22.029 -> [370309] Bad hdr len: -1 17:56:22.062 -> [370336] Connecting... 17:56:31.075 -> [379336] Connecting... 17:56:40.069 -> [388336] Connecting... 17:56:49.074 -> [397336] Connecting...

kenken64 commented 5 years ago

Compiling the arduino code

Using library Blynk at version 0.6.1 in folder: C:\Users\kenke\Documents\Arduino\libraries\Blynk Using library BLEPeripheral at version 0.4.0 in folder: C:\Users\kenke\Documents\Arduino\libraries\BLEPeripheral "C:\Users\kenke\Documents\ArduinoData\packages\sandeepmistry\tools\gcc-arm-none-eabi\5_2-2015q4/bin/arm-none-eabi-size" -A "C:\Users\kenke\AppData\Local\Temp\arduino_build_492048/BBC_MicroBit.ino.elf" Sketch uses 35976 bytes (23%) of program storage space. Maximum is 151552 bytes.

kenken64 commented 5 years ago

Simple Arduino Source Code

define BLYNK_USE_DIRECT_CONNECT

define BLYNK_DEBUG

define BLYNK_PRINT Serial

include

include

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

// Create ble serial instance, parameters are ignored for MicroBit BLESerial SerialBLE(0, 0, 0);

void setup() { Serial.begin(9600); // Configure on-board buttons

SerialBLE.setLocalName("BlynkRobot1"); SerialBLE.setDeviceName("BlynkRobot1"); SerialBLE.setAppearance(0x0080); SerialBLE.begin();

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

Blynk.begin(SerialBLE, auth);

}

void loop() { SerialBLE.poll();

if (SerialBLE) { // If BLE is connected... Blynk.run(); } }

kenken64 commented 5 years ago

Serial monitor logs

18:19:53.778 -> Waiting for connections... 18:19:53.778 -> [38] 18:19:53.778 -> 18:19:53.778 -> / ////\\ 18:19:53.778 -> Waiting for connections... 18:19:53.778 -> [38] 18:19:53.825 -> 18:19:53.825 -> / )/ / / / 18:19:53.860 -> / / / // / \/ '/ 18:19:53.895 -> /____//_, /////_\ 18:19:53.895 -> // v0.6.1 on nRF5 18:19:53.942 -> 18:19:53.942 -> [188] Connecting... 18:20:02.935 -> [9188] Connecting... 18:20:11.967 -> [18188] Connecting... 18:20:13.390 -> [19645] >3b1be 18:20:13.424 -> [19662] Packet too big: 25189 18:20:13.464 -> [19695] >b087b 18:20:13.464 -> [19711] Packet too big: 14178 18:20:13.510 -> [19744] >5ac3a 18:20:13.510 -> [19761] Packet too big: 13153 18:20:16.544 -> [22793] Bad hdr len: -1 18:20:16.584 -> [22819] Connecting... 18:20:18.403 -> [24640] >3b1be 18:20:18.403 -> [24657] Packet too big: 25189 18:20:18.438 -> [24690] >b087b 18:20:18.484 -> [24707] Packet too big: 14178 18:20:18.484 -> [24739] >5ac3a 18:20:18.531 -> [24756] Packet too big: 13153 18:20:21.523 -> [27787] Bad hdr len: -1 18:20:21.558 -> [27814] Connecting... 18:20:30.557 -> [36814] Connecting...

kenken64 commented 5 years ago

Really hope someone can look into this issue!

kenken64 commented 5 years ago

can someone from blynk teach me how to deploy and debug so i can help

kenken64 commented 5 years ago

any update on this issue ?

kenken64 commented 5 years ago

I try updating to the latest firmware also no luck

https://microbit.org/guide/firmware/

kenken64 commented 5 years ago

00:11:08.619 -> Waiting for connections... 00:11:08.619 -> [38] 00:11:08.619 -> 00:11:08.619 -> / )/ /_ ___ / / 00:11:08.619 -> / / / // / \/ '/ 00:11:08.619 -> /____//_, /////\\ 00:11:08.619 -> /__Waiting for connections... 00:11:08.652 -> [38] 00:11:08.652 -> 00:11:08.686 -> / )/ / _ / /_ 00:11:08.721 -> / / / // / \/ '/ 00:11:08.721 -> ///_, /////_\ 00:11:08.755 -> /___/ v0.6.1 on nRF5 00:11:08.789 -> 00:11:08.789 -> [188] Connecting... 00:11:17.802 -> [9188] Connecting... 00:11:26.781 -> [18188] Connecting... 00:11:35.807 -> [27188] Connecting... 00:11:44.804 -> [36188] Connecting... 00:11:53.796 -> [45188] Connecting... 00:12:02.800 -> [54187] Connecting... 00:12:09.007 -> [60417] Packet too big: 12646 00:12:09.041 -> [60450] Packet too big: 25909 00:12:09.076 -> [60482] Packet too big: 24930 00:12:12.130 -> [63515] Connecting... 00:12:14.035 -> [65412] Packet too big: 12646 00:12:14.035 -> [65445] Packet too big: 25909 00:12:14.070 -> [65477] Packet too big: 24930 00:12:17.106 -> [68509] Connecting... 00:12:21.132 -> [72515] Connecting...

kenken64 commented 5 years ago

if there isn't any serious support for microbit why did blynk post an article like this? http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/bbc-microbit-arduino-ide

Refenz commented 5 years ago

@kenken64 Blynk team is busy developing a new product and unfortunately this leads to delays in communication. For communication and troubleshooting use: https://community.blynk.cc/ Please create a topic in an appropriate section. Someone from the participants can help you in solving this issue or give advice. Note: Blynk developers are also monitoring the community

rei-vilo commented 5 years ago

Already done. Please refer to https://community.blynk.cc/t/problem-with-example-bbc-micro-bit-arduino-ide/34942

FedericoBusero commented 5 years ago

Not the packet is too big, it's the buffer that is too small ... https://github.com/FedericoBusero/blynk-library/blob/master/src/Adapters/BlynkBLEPeripheralSerial.h

Also replaced the UUID's with Blynk's UUID and changed WriteNoResponse to Write Still to do: use Blynk's FIFO

FedericoBusero commented 5 years ago

I created a pull request with a fix https://github.com/blynkkk/blynk-library/pull/463

vshymanskyy commented 5 years ago

The fix was merged. Let us know how it works!