BLE with ESP32 tutorial part 2: the client

  Переглядів 26,721

MoThunderz

MoThunderz

Рік тому

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.com/specificati...
Starting point for the server:
github.com/mo-thunderz/Esp32B...
Final code:
github.com/mo-thunderz/Esp32B...
Create a mobile app for your phone to control an ESP32:
• Create a BLE app for y...

КОМЕНТАРІ: 60
@DavidSunshine
@DavidSunshine Рік тому
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 Рік тому
excellent, you have a clear and pleasant way of talking, and explaining.
@mothunderz
@mothunderz Рік тому
Thank you very much!
@SKotekar
@SKotekar 8 днів тому
Great tutorial, thank you so much.
@mansurkhairullin2219
@mansurkhairullin2219 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 27 днів тому
:-D Yes, compared to funny cats this is quite niche, but glad I was able to help!
@gaborungvari784
@gaborungvari784 3 місяці тому
Good tutorial, thanks!!!
@mothunderz
@mothunderz 27 днів тому
You are welcome :-)
@user-pi7dl3mf7e
@user-pi7dl3mf7e Рік тому
Really appreciate this video. It helps me with my school project.
@mothunderz
@mothunderz Рік тому
Great to hear!
@user-qp8lz7sf9b
@user-qp8lz7sf9b 2 місяці тому
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.
@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 Рік тому
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?
@arthurclement5046
@arthurclement5046 Рік тому
merci le S tu sauves mon projet
@mothunderz
@mothunderz Рік тому
You are very welcome :-)
@michealmorrow1481
@michealmorrow1481 Місяць тому
Please turn on line numbers to help us keep up with where you are.
@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 Рік тому
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
@elguenfo8784
@elguenfo8784 8 місяців тому
Thank you for the valuable information posted. One question can we have multiple clients ?
@mothunderz
@mothunderz 7 місяців тому
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 7 місяців тому
@@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 7 місяців тому
Great! Yes, as long as you use only ESPs you should be fine with ESPNow
@sjsarchive4647
@sjsarchive4647 Місяць тому
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 Місяць тому
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
@user-zx9bk8sx5s
@user-zx9bk8sx5s 6 місяців тому
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 6 місяців тому
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 (ukposts.info/have/v-deo/iqaTi6JvqZCA0IU.html) and Xamarin (ukposts.info/have/v-deo/i5Z4qYKqgpuAxnk.html)
@zoharshinar1461
@zoharshinar1461 6 місяців тому
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 6 місяців тому
My apologies, but I have not looked into this aspect yet...
@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
@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!
@Tomyb15
@Tomyb15 2 місяці тому
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.
@37shubhamgupta64
@37shubhamgupta64 6 місяців тому
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 6 місяців тому
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...
@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 Рік тому
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
@piotrolczyk2679
@piotrolczyk2679 2 місяці тому
Do you have any example of communication between a BLE server and a BLE client in INDICATE characteristic mode. Any hint?
@mothunderz
@mothunderz 27 днів тому
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 2 місяці тому
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 27 днів тому
Yes, multi-connect is possible, but I have not looked into this yet unfortunately
@user-fh9nh2hn8n
@user-fh9nh2hn8n 4 місяці тому
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 3 місяці тому
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 3 місяці тому
Thanks for your reply , I solved the the issue with the help of your videos and other resources.@@mothunderz
@hemavathiselvaraj4434
@hemavathiselvaraj4434 3 місяці тому
can esp ble be communicate with nrf51822 bluetooth module?
@mothunderz
@mothunderz 3 місяці тому
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 9 місяців тому
Why do the server and client connect after I click the reset button? Can someone please tell me
@mothunderz
@mothunderz 9 місяців тому
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 2 дні тому
24:31 / 36:06
@eugenecrane6093
@eugenecrane6093 9 місяців тому
I have a errors when uploading esp32/ int is not a member of 'BLEDevice can you help please?
@northshorepx
@northshorepx 9 місяців тому
post your code
@huyhuynh7061
@huyhuynh7061 Рік тому
Error compiling for board DOIT ESP32 DEVKIT V1. help me
@mothunderz
@mothunderz Рік тому
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 11 місяців тому
@@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
BLE with ESP32 tutorial part 1: the Server
25:23
MoThunderz
Переглядів 69 тис.
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Переглядів 34 млн
Їжа Закарпаття. Великий Гід.
1:00:29
Мiша Кацурiн
Переглядів 675 тис.
Make Your Own Arduino BLE App in Android or iOS with Capacitor
1:22:45
Getting Started with ESP32 - Step-By-Step Tutorial
19:50
Tomasz Tarnowski
Переглядів 296 тис.
Bluetooth Low Energy - Protocol Stack (Part 1)
8:39
Bina Bhatt
Переглядів 54 тис.
ESP-NOW - Peer to Peer ESP32 Network
43:02
DroneBot Workshop
Переглядів 326 тис.
ESP32-to-ESP32 Simplex Communication via ESP-NOW
6:31
Anas Kuzechie
Переглядів 47 тис.
#419 ESP32 Audio Tutorial with lots of examples
13:48
Andreas Spiess
Переглядів 221 тис.
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Переглядів 34 млн