BLE with ESP32 tutorial part 2: the client

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.ย. 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...

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

  • @mansurkhairullin2219
    @mansurkhairullin2219 7 หลายเดือนก่อน +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!

  • @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 :-)

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

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

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

      Thank you very much!

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

    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 5 หลายเดือนก่อน

    Great tutorial, thank you so much.

  • @retsalb3517
    @retsalb3517 11 วันที่ผ่านมา

    Hey man, it's me again. Thank you for your tutorials! I have another question; can you make your android phone the client that receives the data through an MIT invented app? Thank you!

  • @然浩-p7i
    @然浩-p7i ปีที่แล้ว

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

  • @forwarder-m7n
    @forwarder-m7n 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.

  • @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 6 หลายเดือนก่อน

    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

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

    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

  • @Tomyb15
    @Tomyb15 7 หลายเดือนก่อน

    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.

  • @michealmorrow1481
    @michealmorrow1481 6 หลายเดือนก่อน

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

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

    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...

  • @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

  • @gaborungvari784
    @gaborungvari784 7 หลายเดือนก่อน

    Good tutorial, thanks!!!

    • @mothunderz
      @mothunderz  5 หลายเดือนก่อน

      You are welcome :-)

  • @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!

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

    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 (th-cam.com/video/RvbWl8rZOoQ/w-d-xo.html) and Xamarin (th-cam.com/video/SfGuLsKeOeE/w-d-xo.html)

  • @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

  • @piotrolczyk2679
    @piotrolczyk2679 7 หลายเดือนก่อน

    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.

  • @yan-mm5np
    @yan-mm5np 7 หลายเดือนก่อน

    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 11 หลายเดือนก่อน

    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...

  • @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?

  • @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

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

    merci le S tu sauves mon projet

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

      You are very welcome :-)

  • @EleDesignKeen
    @EleDesignKeen 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  8 หลายเดือนก่อน

      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...

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

      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

  • @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()

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

    can esp ble be communicate with nrf51822 bluetooth module?

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

      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!

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

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

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

    24:31 / 36:06

  • @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