BLE with ESP32 tutorial part 2: the client

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024
  • In part 2 of this tutorial we will cover the receiver for ESP32 to ESP32 communication and explore how Notify, Read and Write work with Bluetooth Low Energy (BLE).
    Link for the pre-defined Services, Characteristics and Descriptors:
    www.bluetooth....
    Starting point for the server:
    github.com/mo-...
    Final code:
    github.com/mo-...
    Create a mobile app for your phone to control an ESP32:
    • Create a BLE app for y...

Комментарии • 62

  • @mansurkhairullin2219
    @mansurkhairullin2219 6 месяцев назад +2

    Great tutorials. Thank you a lot. Maybe your video is not such popular as videos about funny cats, but you save hours and hours of time to learn this knowledge personally.

    • @mothunderz
      @mothunderz  5 месяцев назад

      :-D
      Yes, compared to funny cats this is quite niche, but glad I was able to help!

  • @veedonfleece3694
    @veedonfleece3694 Год назад +1

    excellent, you have a clear and pleasant way of talking, and explaining.

  • @DavidSunshine
    @DavidSunshine Год назад +1

    Thank you for posting this information! I was just thinking about having two of my ESP32s communicate so I can build a system in the house!
    Keep up the great work on tutorials! They're really helpful and help us all build our inventions!
    Cheers,
    David.

    • @mothunderz
      @mothunderz  Год назад

      Glad I could help! Thank you for your feedback :-)

  • @mars3142
    @mars3142 3 месяца назад

    Are you planning to do this series also for ESP-IDF? I know the Arduino wrapper is much easier, but it will be great to understand what will be done low level.
    I would be also be interested in seeing how to transfer large data (larger than one value could transfer in one pass).

  • @SKotekar
    @SKotekar 4 месяца назад

    Great tutorial, thank you so much.

  • @user-pi7dl3mf7e
    @user-pi7dl3mf7e Год назад

    Really appreciate this video. It helps me with my school project.

  • @michealmorrow1481
    @michealmorrow1481 5 месяцев назад

    Please turn on line numbers to help us keep up with where you are.

  • @user-qp8lz7sf9b
    @user-qp8lz7sf9b 6 месяцев назад

    This has been very helpful, thank-you. I'm trying to add addition "characteristics" like at 9:07, which work, but they all appear multiple times?? Any thoughts.

  • @gaborungvari784
    @gaborungvari784 7 месяцев назад

    Good tutorial, thanks!!!

    • @mothunderz
      @mothunderz  5 месяцев назад

      You are welcome :-)

  • @helentsai4518
    @helentsai4518 3 месяца назад

    is anyone facing the "Compilation error: 'BLEUUID' does not name a type" issue? I import the library. didn't change the example code, but just ran out with this issues

  • @sjsarchive4647
    @sjsarchive4647 5 месяцев назад

    Is it possible to run client and server simultaneously in one Esp32. I think its possible using the coex module in ESP-IDF but thats a bit too tough for me.

  • @christiancalderon7428
    @christiancalderon7428 5 месяцев назад

    Thanks for the tutorial. Your tutorials are very clear. I have the following errors in the client: would you know what these errors has to do with?
    - Connected to server
    - Found our characteristics
    E (500048) BLE_INIT: Malloc failed
    App is onDisconnect part
    Disconnected from server...
    Rescan...
    E (508871) BT_APPL: Client_if: 255 Not Registered

  • @Tomyb15
    @Tomyb15 6 месяцев назад

    Why are you using bit shifting to cast 4 bytes into a uint32? You could just bitcast into a uint32 unless you did it to avoid a possible problem with endianness differences.
    Another thing I would change is to keep using the nrf app to test the esp32 code. You can set the app to act as a server and advertise. Otherwise people will need to buy another esp32.

  • @sumedhkulkarni1794
    @sumedhkulkarni1794 Год назад

    Hey, really inspired by the work you are doing! Can you make a video about sending data from mobile app to esp32 using ble as well?

    • @mothunderz
      @mothunderz  Год назад +2

      Yes, actually I am working on such a video. However, I am currently a bit busy with work so it will take another 2 weeks or so for me to complete it...

    • @BlurMediaStudios
      @BlurMediaStudios Год назад

      @@mothunderz We're all hyped for it :) Thank you for your efforts. May i ask whether such a video would also be planned for iOS?

  • @elguenfo8784
    @elguenfo8784 Год назад

    Thank you for the valuable information posted.
    One question can we have multiple clients ?

    • @mothunderz
      @mothunderz  Год назад

      Multiple clients can be supported on the ESP, but I have not looked into this so far. There is a demo for multiple clients in the examples you get with the library. I recommend looking into that.

    • @elguenfo8784
      @elguenfo8784 Год назад

      @@mothunderz I think I have found a substitute which is the ESPNow protocol, it is used only by ESP microcontrollers which is the only drawback I can see
      Thanks for the reply 👍

    • @mothunderz
      @mothunderz  Год назад

      Great! Yes, as long as you use only ESPs you should be fine with ESPNow

  • @arthurclement5046
    @arthurclement5046 Год назад

    merci le S tu sauves mon projet

  • @zoharshinar1461
    @zoharshinar1461 10 месяцев назад

    Thanks for posting this. Can you operate ESP32 and force it to never overlap Channels between Wifi and BLE? or the ESP will always dynamically will allocate channels based on channel availability ?

    • @mothunderz
      @mothunderz  10 месяцев назад

      My apologies, but I have not looked into this aspect yet...

  • @user-zx9bk8sx5s
    @user-zx9bk8sx5s 10 месяцев назад

    Really appreciate your videos.
    I was wondering, Can I see my phone's battery percentage or some other sensor data of the phone in the RPI by creating GATT server and phone be a BLE device.
    Any tips and suggestions most appreciated!!
    Thanks in advance.

    • @mothunderz
      @mothunderz  10 месяцев назад +1

      Well, the ESP does not connect with the Android operating system, it connects with an app that you have running on the Android operating system. So yes, you can send the phone's battery percentage over to an ESP, but the way that would work is that the app you write on the phone reads out the phone's battery percentage and then sends it over. You can write the app on the phone in many different languages. I covered so far MIT App Inventor (ruclips.net/video/RvbWl8rZOoQ/видео.html) and Xamarin (ruclips.net/video/SfGuLsKeOeE/видео.html)

  • @NenadNaukovic
    @NenadNaukovic Год назад

    Thank you for uploading this tutorial.
    I am trying to read my blood pressure monitor with an ESP32. The characteristic holding the relevant values has the property 'Indicate'.
    With the phone app it's easy to trigger it, but how would you fire the "indicate trigger" from an ESP32 client?
    Thanks,
    Nenad

    • @mothunderz
      @mothunderz  Год назад +1

      I have not so far looked into indicate. The main reason for that is that I dont have a device with indicate here. I will see though if I can set that up from ESP32 to ESP32. Regards, Sander

  • @michaelhcorrigan
    @michaelhcorrigan Год назад

    Hey this is great, thanks! I'm just getting into some BLE as part of trying to connect to an existing device. The trouble I am having is that the device shows a passkey which is required to be provided from the client, and I'm not sure how to build out that work flow... Any thoughts or demo code using passkeys?

    • @mothunderz
      @mothunderz  Год назад

      I assume you want to implement this as a client, right? I have not tried myself yet to make passkeys work, but this example looked very clear to me:
      github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLETests/Arduino/security/BLE_client/BLE_client_passkey/BLE_client_passkey.ino
      So basically you need to define a callback BLESecurityCallbacks that takes care of all the passkey communication. I dont have a suitable device here to test with, but hope you can manage to make it work.

    • @michaelhcorrigan
      @michaelhcorrigan Год назад

      @@mothunderz Hey thanks! That is the same example I have been trying to get to work but so far it's been unsuccessful for my case. I have a camera with Bluetooth capabilities, and some of the characteristics are encrypted and some are not. I can find the device but when I go to pair it hasn't worked yet.
      BTW, the nRF app is awesome, I'm hoping going through that log where the phone connected to the camera will give me hints on how to do it with the esp32. Can't wait to see what you do next!

    • @mothunderz
      @mothunderz  Год назад

      Too bad that you were not able to get that code working. If I find a suitable device for debugging I will give you an update.

    • @michaelhcorrigan
      @michaelhcorrigan Год назад

      ​@@mothunderz Thanks, likewise if I get it to work, I'll let you know

  • @piotrolczyk2679
    @piotrolczyk2679 6 месяцев назад

    Do you have any example of communication between a BLE server and a BLE client in INDICATE characteristic mode. Any hint?

    • @mothunderz
      @mothunderz  5 месяцев назад

      I have not looked into indicate too much. At the moment though I am too busy with work, so dont have the time required to look into this unfortunately.

  • @ollydsouza
    @ollydsouza Год назад

    Hi Mo - I am doing the exact same thing using the Arduino Nano 33 BLE Sense (they call it the Peripheral) and the Arduino Nano 33 BLE (which is called the Central. I can generate all the data via the sense into the nrf - but I cannot receive anything on the "Central" -(all these in the examples). They have the "Explore" sketch which allows one to "find" peripherals including the "Sense" and gets its ibasic information like name and number - but the Peripheral does not connect (this generates a message "not connected". In short what code in the Central will "connect?

    • @mothunderz
      @mothunderz  Год назад

      Hi Ollencio, my apologies, but I unfortunately dont have a Nano 33 BLE Sense and as such cannot verify what the correct way is to connect with BLE on that device. I did look online and there is quite some documentation such as:
      docs.arduino.cc/tutorials/nano-33-ble-sense/ble-device-to-device
      Hope you find a way to solve your problem!

  • @yan-mm5np
    @yan-mm5np 6 месяцев назад

    Hi! Would it be possible for me to connect two clients to the same server, and both send data? f possible, would you have an example code or could you make a video about it. I would be very grateful.

    • @mothunderz
      @mothunderz  5 месяцев назад

      Yes, multi-connect is possible, but I have not looked into this yet unfortunately

  • @37shubhamgupta64
    @37shubhamgupta64 10 месяцев назад

    Hey man i am working on Smart Security System project i just want to ask is it possible to connect esp32 cam and esp32 Dev module to connect can you make the video based on that how to communicate between them ?

    • @mothunderz
      @mothunderz  10 месяцев назад

      Thank you for the suggestion. Unfortunately I am overloaded with (non-YT related) work and dont get to make videos lately. Hope that I can upload some things this winter again...

  • @user-fh9nh2hn8n
    @user-fh9nh2hn8n 8 месяцев назад

    Hello , how to send data from BLE client to specific BLE server when client is connected to multiple servers where all has servers has same service and characteristics UUIDs??

    • @mothunderz
      @mothunderz  7 месяцев назад

      Unfortunately I have not yet looked into multiple servers. Currently I am overloaded with work and dont get to make videos, but I did put it on the list for future videos...

    • @user-fh9nh2hn8n
      @user-fh9nh2hn8n 7 месяцев назад

      Thanks for your reply , I solved the the issue with the help of your videos and other resources.@@mothunderz

  • @Paul122M
    @Paul122M Год назад

    Is it possible to make a small network with more than 2 devices via BLE? Like, 2 ESP32 boards that receive data from sensors and then send data via BLE to a 3rd ESP board.

    • @mothunderz
      @mothunderz  Год назад +1

      Hi Paul, yes, this is definitely possible, but I have not had the time yet to check into this. However, there is an example in the BLE library to get you started.
      Just open File->Examples->ESP32 BLE Arduino->BLE_server_multiconnect.
      Good luck with the project!
      Sander

    • @vats8087
      @vats8087 Год назад

      Actually I'm working on a very similar project. These two vids were amazing and succinct

  • @hemavathiselvaraj4434
    @hemavathiselvaraj4434 7 месяцев назад

    can esp ble be communicate with nrf51822 bluetooth module?

    • @mothunderz
      @mothunderz  7 месяцев назад

      I dont have that module nor have I tested it. Just from looking at the datasheet I think that will be possible. Let me know if it worked for you!

  • @k.raghuramchakravorthy6047
    @k.raghuramchakravorthy6047 Год назад

    Why do the server and client connect after I click the reset button? Can someone please tell me

    • @mothunderz
      @mothunderz  Год назад

      The reason why they connect is that we tell the client to do so ;-) Please have a look at the client code and in MyAdvertisedDeviceCallbacks you see that boolean doConnect is set to true when a device with the correct UUID is found. In the loop() this will trigger running the function connectToServer()

  • @shazebsheikh1401
    @shazebsheikh1401 4 месяца назад

    24:31 / 36:06

  • @eugenecrane6093
    @eugenecrane6093 Год назад

    I have a errors when uploading esp32/ int is not a member of 'BLEDevice can you help please?

  • @huyhuynh7061
    @huyhuynh7061 Год назад

    Error compiling for board DOIT ESP32 DEVKIT V1.
    help me

    • @mothunderz
      @mothunderz  Год назад +1

      HI Huy, can you add some more details on the error you are getting? It is a bit difficult to help you otherwise. Thank you

    • @ton12047
      @ton12047 Год назад

      @@mothunderz I am have the same problem . Compiling message - "\Arduino\libraries\ArduinoBLE\src\utility\HCIVirtualTransport.h:27:36: fatal error: freertos/stream_buffer.h: No such file or directory". Very greatful for your tutorial for us