Create your own App! Control an ESP32 (Arduino) via Bluetooth - Part 3

preview_player
Показать описание
IMPORTANT UPDATE (30.09.2022): MIT App Inventor updated their Bluetooth library without backward compatibility. Might you have downloaded this code from my Github page before 30.09.2022, please download the updated version. Changes only affect the general Bluetooth connection stuff discussed in Part 1.

Part 1 and 2 of this series focused on realization of a bi-directional Bluetooth communication channel between an ESP32 and your phone (using MIT app inventor). However, the length of the communication was limited to a single byte. In part 3 I will show you to send over values larger than 256 values and introduce a simple protocol to send over an ID with an associated value. This is practical for sending over control and/or sensor values. Might you have missed part 1 and 2:

Please make sure your ESP32 has Bluetooth to make this work. I used the ESP32-WROOM-32D. For creation of the app I use the MIT app inventor in combination with the MIT AI2 Companion. Note that this code will only work on Android. The reason is that BluetoothSerial does not work on an Iphone. For an Iphone only BLE works. Code for this will follow shortly...

If you want to code along, this is the starting point:

For the final code, please refer to:

MIT App Inventor:

Might you have problems programming the ESP32, pls refer to:

Have fun with the code and let me know in the comments below what application you are working on :-)
Рекомендации по теме
Комментарии
Автор

The concept of high value for Id and Low value for data is a clever way to separate the 3 bytes
without the need of starting and ending character. I don't know if it's a common use, but I like the concept
and will use it for my projects. Thank you very much for the idea and the introduction of inventor APP
which I Found pretty useful.

michelpoisson
Автор

Amazing job walking us through the thought process, and testing the results. I started learning app inventor a long time back, but never gathered any traction. I can see where this will be very beneficial in many situations.

bobdurk
Автор

Thx u so much, jansen. So we can learn step by step 🙏
Ur a great teacher and humble person too ❤️❤️❤️❤️

vancefd
Автор

Very under rated video, thank you so much, I have learned so much. Look forward to more of you videos along this topic. I noticed you made a mistake in app inventor with button 3 too, whole time I was waiting for you to click it when testing but you either edited it out or just happened to have not clicked it :P

dansxmods
Автор

Great work here. I found this series of tutorials to be very informative and quite helpful for using the ESP32 and making an app with MIT App Inventor. I hope to see more tutors like this here. You deserve more subs and views!

drabodows
Автор

Thanks a lot! Very helpful. I want to read some sensor values and send commands back to the ESP. This should do the job!

borishuikeshoven
Автор

Your video popped up in my feed. Great info sir. Very helpful. Thank you Sir

ehvway
Автор

i need to display from esp32 to phone with different label pleas any help such as reading sensr such as irms temprature power factor ...

mhamadhafez
Автор

Thank you for the tutorial, its easy to follow and informative! Can't wait for the next one :D

jeandeux
Автор

Thank you for the tutorial, but how I can receive JSON commands over Bluetooth through a smartphone application and store the data received on flash memory(ROM) then reboot the system and call back the stored data?
please reply sir.

anandharsh
Автор

I can't thank you enough for this video. This is so valuable and I suggest you make a Udemy course about the subject. ( ESP32 BT and App Inventor).
I had the exact same problems when I tried BT with ESP32 and APP inventor, and my communication were either 1 or 2 bytes long.
I eventually made all communication 2 bytes long which worked, but i have glitches when a byte gets lost during communication.
The -1 trick is very neat and I will try it out and hopefully it works better than what I have now.
Thanks again!

haythamhakla
Автор

How do I could send (write) a realtime variable to show on the app. Example : a variable contain temperature sensor.

samrev
Автор

Still a excellent way to transmit short information. Thank you for this example and excellent tutorial! Implemented it to my project and works like a charm! 😀 I'm only a bit confused why it only transmits 14 bits and not 16.

bobbycount
Автор

VERY NICE AND VERY THANKS, IF POSSIBLE PLEASE MAKE VIDEOS FOR WIFI CONNECTIVITY ALSO

MrSikkandar
Автор

Sir, can you please tell me, from where you learnt from making app through mit app inventor

domain
Автор

Thank you!
But why cannot we use "receive unsigned 2byte number" in the app instead going through this process of breaking down the sensor data.?
could you make a tutorial or comment on how to receive 2byte number?

keerthik
Автор

Can we learn like this sketch with bluetooth BLE coding sir?

vancefd
Автор

Hi, thanks for the great video. Though I didn't understand few things... I have checked your code and I don't understand how it knows what val_byte is. You just declare it to be -1 but how does arduino relate that to the msb or lsb of the incoming message. Also, @20:26 you are saying if( val_byte == -1) { val_byte1 = incoming; }. This confused me a bit. If val_byte1 = -1 then that means we haven't received it. If we haven't received it how come do we say val_byte1 = incoming ?

yayser
Автор

You really did an amazing and awesome job man. You are great. So informative and helpful. What if I want to send files from my android app to my ESP32 (the ESP32 is connected to an SD card already so the SD card just saves the file) via bluetooth?

muslimalaran
Автор

This is a great tutorial! Thanks to you I was able to add bluetooth app support to my ESP32/TFT car sensor reading project. Would you be willing to take a look at my code and see what could be improved?

jankovalski