ESP32 | BLUETOOTH CLASSIC | FLUTTER - Let's build BT Serial based on the examples. (Ft. Chat App)

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • This video briefly shows a demonstration before starting a project with Bluetooth Classic. I'll show you two examples: the Bluetooth Serial Library for ESP32 and the Bluetooth Serial for Flutter application. Also, it's including the small chat application under the example of the flutter library. It'll be a tutorial series. Thanks. 🙏
    Note: iOS devices connect using Bluetooth Classic, but it must be an MFi certified device in order to connect. Also, the library of Flutter Bluetooth Serial doesn't support iOS build so I don't deal with the iOS build at this time.
    ****
    Updated 06-21-2021
    Due to Flutter's update, many parts have changed from the tutorial video.
    You need to keep @dart=2.9 before starting main to avoid null safety in Flutter 2
    I modified the code to work temporarily.
    [Bluetooth Serial Library]
    github.com/esp...
    [flutter_bluetooth_serial]
    pub.dev/packag...
    [Project Github Link]
    github.com/001...
    Music:
    Music provided by NoCopyRightSounds from TH-cam.
    #ESP32 #FLUTTER #BLUETOOTCLASSIC #SERIAL #RFCOMM #SPP

ความคิดเห็น • 103

  • @ThatProject
    @ThatProject  4 ปีที่แล้ว +1

    Subscribe - th-cam.com/users/ThatProject

  • @BruceWayneReal
    @BruceWayneReal 4 ปีที่แล้ว +8

    Literally the only tutorial that I've found that actually works.

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว +1

      Bruce Wayne Thanks 🙏

  • @pushkarajsalunke3461
    @pushkarajsalunke3461 4 ปีที่แล้ว +3

    Great, you started voiceover.
    Best of luck.

  • @huangsteven8111
    @huangsteven8111 4 ปีที่แล้ว +2

    It's great !
    waiting for the next part。

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว

      huang steven Thanks.

  • @eduardt7253
    @eduardt7253 4 ปีที่แล้ว +3

    Nice video! Exactly what I needed. Maybe you can add subtitles for better understanding?

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว +2

      Sorry. For the time being, I'm going to make a project video without subtitles. It's going to be better. Thanks for your understanding.

  • @lecheelemental4739
    @lecheelemental4739 3 ปีที่แล้ว

    GOOD VIDEO !! It worked for me.

  • @user-ko5zg2ux1m
    @user-ko5zg2ux1m ปีที่แล้ว

    많은 도움이 됐어요!

  • @lafgaflafgaf3253
    @lafgaflafgaf3253 3 ปีที่แล้ว

    thank u bro its great tutorial

  • @GodzillazzZ
    @GodzillazzZ 4 ปีที่แล้ว

    thx u ; as always great works

  • @SaurabhNanda-he8jt
    @SaurabhNanda-he8jt ปีที่แล้ว

    Hi , I have run this code but i am not able to see the list of paired device when you go to chat , please help .. Api level 33 Android

  • @immanuelstephen8006
    @immanuelstephen8006 3 หลายเดือนก่อน

    i tried the code which is in the git link u provided..but it is not showing available devices..can u help me please.

    • @ThatProject
      @ThatProject  3 หลายเดือนก่อน

      Which Android version do you use? Bluetooth Permission settings may vary depending on the Android version.

  • @mouradouddah5934
    @mouradouddah5934 4 ปีที่แล้ว +1

    first comment yessss

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว +1

      mourad oudddah Thanks!

  • @timf9740
    @timf9740 2 ปีที่แล้ว +1

    Please upload subtitles:) Otherwise good

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      haha sorry for that.

  • @user-cp7dm2mq2s
    @user-cp7dm2mq2s 10 หลายเดือนก่อน

    Hello Bro, can you help me? I used the flutter_bluetooth_serial package: ^0.4.0 in a specific project. When I ran the application on a real device with Android version 11, it worked and there were no problems, but when I ran the application on Android version 12 and above, the application crashes (it does not open). Is it possible that there is a problem with the permissions, site permissions, etc.?

    • @ThatProject
      @ThatProject  10 หลายเดือนก่อน

      Have you tried this one? Seems like you've already on this page. github.com/edufolly/flutter_bluetooth_serial/issues/200#issuecomment-1711851838

  • @tomasdelfinageronimo927
    @tomasdelfinageronimo927 4 หลายเดือนก่อน

    Hello! hope everything is well with you.
    I'm creating a glove that translates gestures into text and audio and I need your help to develop the corresponding application with Flutter, ESP32, Arduino IDE and Bluetooth.”
    Just create a flutter application that will receive words coming from the Arduino IDE's serial monitor and print it on the application screen.
    I would really appreciate it.

  • @supremeleader5516
    @supremeleader5516 3 หลายเดือนก่อน

    can u pls update this video according to new flutter update

    • @ThatProject
      @ThatProject  3 หลายเดือนก่อน +1

      I will use the latest version in my next Flutter project.

  • @aminemaiza1935
    @aminemaiza1935 3 ปีที่แล้ว +1

    thanks for the tutorial, I'm trying to build an application that send and receive data from a device, finally I knew how to send data using this function
    void _sendMessage() async {
    connection.output.add(utf8.encode("data here" + "
    "));
    await connection.output.allSent;
    }
    but I did not know how to receive data from device to the smartphone
    can you please guide on how to receive the data ?
    thanks

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      Have you checked this source code?
      github.com/0015/IdeasNProjects/blob/master/ESP32_BT_CLASSIC/ESP32_BLUETOOTH_SERIAL_DEMO/android_bluetooth_serial_app/lib/ChatPage.dart
      From the function, _onDataReceived(Uint8List data) all transmitted data is coming through if there is buffer data that is sent from a device.

    • @aminemaiza1935
      @aminemaiza1935 3 ปีที่แล้ว

      @@ThatProject yeah I checked the code this function is void so it hasn't any returned value, if I want to print the received data how can I do it ? thanks for your time

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      @@aminemaiza1935 The registered function (_onDataReceived) is called via listen because the data enters streaming. You can print string data by using the dataString in the console.

    • @aminemaiza1935
      @aminemaiza1935 3 ปีที่แล้ว

      @@ThatProject I'm sorry to bother you , but I don't understand, but If I want to read data received from bluetooth and print it in the console for example, what to use inside the print function print(), thanks for your time

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      @@aminemaiza1935 try this print(dataString) in _onDataReceived(Uint8List data))

  • @flaviohenrique38
    @flaviohenrique38 3 ปีที่แล้ว +1

    Great job.
    Is it possible to make ESP32 accept multiple smartphone connections/interactions (everyone at home) with a Flutter app?

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +1

      ESP32 needs to allow multiple connections. I'll make another project if I have a good chance. Thanks.

    • @flaviohenrique38
      @flaviohenrique38 3 ปีที่แล้ว

      @@ThatProject Ok. I thought this idea would be possible, it doesn't make sense that only one person in the house can have control of the lights controlled by ESP32.
      Maybe some way to release the bluetooth connection when you close the application, so that the connection is free for the next user.
      I don't know much about electronics and programming, I'm just trying.
      Thanks for answering.

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +1

      @@flaviohenrique38 Sure. I think there is a way to make it as you thought. One thing we need to make sure is that controlling house light is using HomeKit, not BT. What I mean is you can build your own chat app with ESP32 via BT and also controlling IoT devices at your house is by using HomeKit. It's operating totally different. I'd like to get a chance to touch this HomeKit sooner or later on my channel.

    • @flaviohenrique38
      @flaviohenrique38 3 ปีที่แล้ว

      @@ThatProject HM, OK. I do not use any IoT automation solution available on the market.
      The idea is to create your own IoT, using 5v relays available on the market and some way to control via the Flutter application, available so that all authorized smartphones (paired?) Can send commands without competition on the BT connection.
      It would be very interesting if it could be done, I don't have enough knowledge to know that.
      Thanks.

    • @melchiortod29
      @melchiortod29 2 ปีที่แล้ว

      @@flaviohenrique38 what about BLE? There's no connection between the devices, so talking to it via multiple phones should work.. maybe

  • @aqibjaved5120
    @aqibjaved5120 3 ปีที่แล้ว

    hello, i am working on a project to plot realtime ECG sensor's plot in the app(sensor is connected with esp32) .. i am currently using firebase for this but the delays are too much and its totally internet dependent. i wanna make this work on bluetooh.. can u help me ? any help would be appreciated
    thanks in advance

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      What is the end device? PC or mobile? If the data set from ECG is big, you may need to get data via WiFi.

  • @simplifytamiz
    @simplifytamiz 4 ปีที่แล้ว

    Nice bro. Can you try ble using esp32 for navigation oled screen if possible .. Your video are class apart

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว

      Bee Kay Thanks for watching. As you know, I have already carried out many projects with BLE on my channel. If I have a chance, I will proceed with the project. Thanks.

    • @simplifytamiz
      @simplifytamiz 4 ปีที่แล้ว

      @@ThatProject thank you bro... 😇

  • @user-fn2bt7ct3y
    @user-fn2bt7ct3y 8 หลายเดือนก่อน

    Does it work for two devices to connect and use as a chat app over Bluetooth??

    • @ThatProject
      @ThatProject  8 หลายเดือนก่อน

      Yes, but in this case it must support Bluetooth Serial.

  • @shawnashton872
    @shawnashton872 ปีที่แล้ว

    How do you initially pair the devices? Your video seemed like they were already paired.

    • @ThatProject
      @ThatProject  ปีที่แล้ว

      Check this out again. You'll see how I connect it from Flutter App.
      th-cam.com/video/WUw-_X66dLE/w-d-xo.html

  • @AlexGabiGrandmaison
    @AlexGabiGrandmaison 3 ปีที่แล้ว

    Hello , I'm working on a project which I need to send photo that I selected on the gallery images of the smartphone and I want to send it to the ESP-32 , it is possible with Bluetooth serial ?

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +1

      In one of my BT Serial projects, it's sending the QR code image from the Flutter app to ESP32. I hope it'd be helpful for your project. th-cam.com/video/7HLh-7vONT4/w-d-xo.html

  • @lakko8888
    @lakko8888 3 ปีที่แล้ว

    Hi and thank you for this video!
    I need to make an app with multiple page where i can set some delay and turn on some led from Android/iOS to ESP32.
    Can i use this? Instead of sending text from chat i'll send the value form textbox or slider to arduino or using a button to send a "LED1 ON" text.
    Is there another/better wayto do this?
    Thanks in advance

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +1

      This app is for Android only. Data cannot be transferred via Bluetooth Serial on iOS. Bluetooth LE is the possible communication in iOS too. Please refer to other BLE-related projects on my channel.

  • @bennguyen1313
    @bennguyen1313 4 ปีที่แล้ว

    Do you have a phone connected to Flutter? Without android connected, the VSCode halts on this line inside the FlutterBluetoothSerial class (FlutterBuetoothSerial.dart) :
    /// State of the Bluetooth adapter.
    Future get state async => BluetoothState.fromUnderlyingValue( await _methodChannel.invokeMethod('getState'));
    For development, is possible to simulate the ESP32 by using a usb bluetooth dongle (2.1 EDR, 4.1, etc) to send data to the android phone, while debugging the app in Flutter?
    I've tried a few USB BT devices, but can't seem to get android to pair/connect! Does the dongle/stack need to support SPP-over-BLE.. or something like the Cordova (PhoneGap) Plugin?

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว

      Hi. As I mentioned, the android emulator does NOT support Bluetooth. So you must prepare a REAL device to run your code.

  • @burakozdogan3857
    @burakozdogan3857 3 ปีที่แล้ว

    Nice job! But how can we solve that problem? "The plugin `flutter_bluetooth_serial` uses a deprecated version of the Android embedding."

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      Hey Burak! It seems necessary to modify based on the new version 0.4.0 of the flutter_bluetooth_serial. I updated the code to work 3 months ago, but it looks like it needs to be updated again. Have you tried it with the new version?

  • @makeityourself1987
    @makeityourself1987 2 ปีที่แล้ว

    Does it work with Arduino and bluetooth module hc05 or only esp32
    ?

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      This is the project for only ESP32.

  • @Mark-rt3yd
    @Mark-rt3yd 4 ปีที่แล้ว

    Thank you for your tutorial, that really helps to the project I'm working on. However, I'm working with The Adafruit Feather nRF52 Bluefruit device, it's a BLE Bluetooth device, I'm wondering if this ESP32 code works as same as my device. my issues right now are I can't make the connection with my device and sending or receiving a message. If you know how to make a connection between nRF52 and Flutter UI, can you please let me know? Thank you so much!

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว +1

      Hi. Unfortunately, Adafruit nRF52 is a Bluetooth Low Energy board, not Bluetooth Classic. Please watch my BLE video series. It's gonna be helpful for you. th-cam.com/video/w6jo2kJanqU/w-d-xo.html

    • @Mark-rt3yd
      @Mark-rt3yd 4 ปีที่แล้ว

      @@ThatProject Thank you.

  • @rozin6910
    @rozin6910 4 ปีที่แล้ว

    I have a problem with serial communication in chat page when i connect to paired device to chat. It's fail to send chat from serial monitor to my device but success to send chat from device to serial monitor and then when i click conncet to paired device to chat in my device wasn't asking the permission of my device location, is that the problem of it?

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว +2

      Permission is required to use BT on Android devices. What is the version of your Android device? If the version is low, you can register directly on the Android manifest file.

    • @rozin6910
      @rozin6910 4 ปีที่แล้ว

      @@ThatProject Good, it's work sir, thank you very much!

  • @prarthanakandwal6625
    @prarthanakandwal6625 4 ปีที่แล้ว

    Can you please tell me how to enable communication between two mobiles instead of arduino board and mobile?

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว

      On one side, it should be a Bluetooth server. If I have a good project idea, I will proceed with it. Thank you for your understanding.

  • @leogobo
    @leogobo 4 ปีที่แล้ว

    Hello, im new on this. Arduino doesnt recognized the #include "BluetoothSerial.h". How can i solve this?

    • @ThatProject
      @ThatProject  4 ปีที่แล้ว

      Hi, Did you install the Arduino core for the ESP32?? Please take a look at this, github.com/espressif/arduino-esp32

  • @ashickyogithan416
    @ashickyogithan416 ปีที่แล้ว

    flutter bluetooth serial main page is missing in git

    • @ThatProject
      @ThatProject  ปีที่แล้ว

      Are you looking for this? github.com/0015/ThatProject/blob/master/ESP32_BT_CLASSIC/ESP32_BLUETOOTH_SERIAL_DEMO/android_bluetooth_serial_app/lib/MainPage.dart

    • @ashickyogithan416
      @ashickyogithan416 ปีที่แล้ว

      Scan is not working

    • @ThatProject
      @ThatProject  ปีที่แล้ว

      @@ashickyogithan416 Maybe permission issue? try to add them in the AndroidManifest.xml

  • @abdulrehman-ws9wl
    @abdulrehman-ws9wl 2 ปีที่แล้ว

    How can we build same app for IOS.? it is not supporting IOS

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      No. There is no way to use the BT Classic on iOS.

  • @shawnashton872
    @shawnashton872 ปีที่แล้ว

    Is the esp32 emulated? Is that what the code at the start is doing?

    • @ThatProject
      @ThatProject  ปีที่แล้ว

      The ESP32 has not emulated anything.

  • @konerugeethareddy6438
    @konerugeethareddy6438 2 ปีที่แล้ว

    my chat page is generating an error in "widget.server.name" saying string type cant be used directly pls help me to resolve it

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      widget.server.name is just string data from BluetoothDevice class and it's just showing the name of the device. If it has an issue, you can delete it.

    • @konerugeethareddy6438
      @konerugeethareddy6438 2 ปีที่แล้ว

      @@ThatProject i am getting another error for "await FlutterBluetoothSerial.instance.isEnabled" saying A "nullable expression can't be used as a condition.
      Try checking that the value isn't 'null' before using it as a condition." . please help me to resolve it

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      @@konerugeethareddy6438 just put ! like this
      await FlutterBluetoothSeri­al.instance.isEnable­d!
      This project was created before the Flutter null-safety concept came along. Some modifications are required to work with the latest version of Flutter. Please take a look here.
      dart.dev/null-safety/understanding-null-safety

    • @immanuelstephen8006
      @immanuelstephen8006 3 หลายเดือนก่อน

      @@konerugeethareddy6438 hey hi..wondering if it worked for you

  • @alphalimit8
    @alphalimit8 2 ปีที่แล้ว

    is this using BLE or using standard Bluetooth connection?

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      Not BLE but BT Classic.

    • @alphalimit8
      @alphalimit8 2 ปีที่แล้ว

      @@ThatProject is it possible to use ble for this app? do you have references?

  • @hajerwael7690
    @hajerwael7690 2 ปีที่แล้ว

    Is it possible to apply this between two android devices ?

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      There are many better solutions for two Android devices instead of this way. I recommend that you find another way.

    • @hajerwael7690
      @hajerwael7690 2 ปีที่แล้ว

      ​@@ThatProject thanks for ur quick response , I'm trying to develop a flutter application with feature chat offline without internet ,would you please recommend which way is the best and applicable ?

    • @ThatProject
      @ThatProject  2 ปีที่แล้ว

      @@hajerwael7690 I see. Based on the code in this video, please try to implement the Bluetooth server-side and client-side of Flutter. Good Luck.

    • @hajerwael7690
      @hajerwael7690 2 ปีที่แล้ว

      @@ThatProject thanks alot , I found an alternative called nearby connection,applied it and worked like charming ...

  • @nelsonlee9859
    @nelsonlee9859 3 ปีที่แล้ว

    is tis wok on iPhone ???

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว

      Of course not. This works for Android only.

  • @wasih19
    @wasih19 ปีที่แล้ว

    hello brother can you help . In my app the bluthoot names is not showing

    • @ThatProject
      @ThatProject  11 หลายเดือนก่อน

      Sorry I don't remember anything for this project. I think you need to check whether the information for the connected device is correct or not.

  • @FabioContardi
    @FabioContardi 3 ปีที่แล้ว

    When I compile the project i get many error: "... can't have a value of 'null' because of its type ...".
    How I can resolve the problem?

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +1

      Have you changed anything in my code?

    • @FabioContardi
      @FabioContardi 3 ปีที่แล้ว +1

      @@ThatProject no, I think the problem is the last version of dart and flutter, but I can't resolve it

    • @ThatProject
      @ThatProject  3 ปีที่แล้ว +2

      @@FabioContardi Oh, oh, you're right. There is a problem that the old code does not work as it is updated to Flutter 2. I modified the code to work temporarily. Please check the code again. github.com/0015/ThatProject/tree/master/ESP32_BT_CLASSIC/ESP32_BLUETOOTH_SERIAL_DEMO/android_bluetooth_serial_app

    • @FabioContardi
      @FabioContardi 3 ปีที่แล้ว +1

      @@ThatProject Tomorrow I try it, ty for the support