Тёмный

Unity | ESP32 | MPU6050 | MahonyAHRS - Rotate 3d Object in Unity(ft. Quaternion) 

That Project
Подписаться 33 тыс.
Просмотров 21 тыс.
50% 1

In this project, I'm gonna show you how to rotate a cube in Unity with a quaternion value getting from ESP32 and MPU6050 via BLE.
[ESP32 | MPU6050 - Using MahonyAHRS (ft. dice)
• ESP32 | MPU6050 - Usin... ]
[ESP32 | MPU6050 | MahonyAHRS - Adding BLE module(ft. String vs Float)]
• ESP32 | MPU6050 | Maho...
[Bluetooth LE for iOS, tvOS and Android]
assetstore.uni...
** Note **
This project does NOT include the Bluetooth asset. You need to prepare it yourself.
[Project Github Link]
github.com/001...
#Unity #Quaternion #ESP32 #MPU6050 #MahonyAHRS #6DoF #accelerometer #gyroscope #I2C

Опубликовано:

 

18 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 76   
@sentinel2592
@sentinel2592 2 года назад
This is an impressive RU-vid tutorial series! Personally for my work I need my ESP32 to communicate with Unity either in the editor or in a build for PC or Mac instead of mobile device. If you ever revisit this project, I would be very interested to see if you can get the ESP32-ble to talk to Unity without the paid plugin. Still, thanks for the series and keep up the awesome work!
@ThatProject
@ThatProject 2 года назад
I tried to do this project without purchasing a BLE asset, but it was difficult to implement it to work properly. I'll try again when I get a chance. Thank you anyway.
@sentinel2592
@sentinel2592 2 года назад
@@ThatProject Gotcha, that makes sense haha. I'm getting ready to use a different plugin now, but thinking of trying again using a second esp32 and esp-now to do the wireless data transmission, then open a serial port from the tethered esp32 for unity to read, but haven't tried yet.
@ThatProject
@ThatProject 2 года назад
@@sentinel2592 Oh, that's an interesting project. Finger crossed!
@Krauleidys
@Krauleidys 3 года назад
I really love what you do.
@tonypitman5648
@tonypitman5648 3 года назад
This is fantastic! Thank you for sharing.
@OMNI_INFINITY
@OMNI_INFINITY Год назад
A little heavy on the shill there tony. Haha. Glad he put a tutorial online for how to use that package though.
@tonypitman5648
@tonypitman5648 Год назад
@@OMNI_INFINITY LOL
@georgeoconner735
@georgeoconner735 3 года назад
freakin' Sweet!..Thank You for sharing!!
@ThatProject
@ThatProject 3 года назад
Glad you liked it!
@icecapsportsclub4838
@icecapsportsclub4838 3 года назад
Thank you for an extremely helpful tutorial. I have followed all the steps and have an application running on an Android device, and an ESP32 sending Quaternion packets over BLE. I can connect to the device using third party apps like LightBlue and subscribe to the data, but when I run the mobile app the statusText is stuck on "Initializing...". Any help would be very appreciated! Thanks again for the great video!
@ThatProject
@ThatProject 3 года назад
oh sorry for the late reply. Did you build it to your Android or iOS devices? As I mentioned, the Bluetooth asset I used here is for iOS, tvOS, and Android only so it's not working in Unity Editor mode.
@T1D0zTMChannel
@T1D0zTMChannel 2 года назад
Hi, one question, on the script if i want to be sure to connect my device, in the devise address if i put my bluetooth hc05 address, my phone will connect only with that device right? I see in you video that u out the address = null, why?
@ThatProject
@ThatProject 2 года назад
Did You mean the _deviceAddress? This is a variable that stores the address of the target device after finding the target device. When this program is initiated, there is no device connected yet, so it is null. I have no idea about using the HC05 module.
@Enoch_The_Gent
@Enoch_The_Gent 2 года назад
Great job , how will you then put your self in vr and use this?
@ThatProject
@ThatProject 2 года назад
Well, I don't know yet but still, it takes effort to integrate real and virtual objects more completely.
@larrychen4983
@larrychen4983 3 года назад
I’m trying to follow along and have a few questions: 1) how do you line up the coordinates from ESP32 program and that in Unity? 2) I don’t quite understand the purpose of inverse of quaternion during your testing of x/y/z and reset, can you explain a bit more? Thanks.
@ThatProject
@ThatProject 3 года назад
Hi Larry. 1) I didn't quite understand your question. What do you mean by coordinates? coordinates for the position of the object? 2) The reason for inverse is to change the direction of rotation.
@lamgoctam
@lamgoctam 3 года назад
Hi I am a newbie. From my understanding, I can modify the code on Unity Editor on Ubuntu/Window, then building an app on iOS.Android devices that can connect to the ESP board. Is that right? Or I need to buy an Macbook for coding c# on Unity to build an app? or I have to install Unity on my Iphone for coding? Hope to have your advice. Thanks!!!
@ThatProject
@ThatProject 3 года назад
You need a Mac to build an app for iOS on Unity. Build for Android apps is possible on Ubuntu/Windows/Mac. This project is communicating an iOS or Android app made in Unity with an ESP32 via BLE. So you need to make not only an application on Unity but also ESP32. For the iOS app, yes you need to have Mac and Unity.
@freenomon2466
@freenomon2466 2 года назад
Thanks for the vidoe. Will this work with xsens DOT imu sensor? (it has ble function).
@ThatProject
@ThatProject 2 года назад
It has BLE and IMU sensors but my code will not work with it. Seems like you'll have to modify everything to run my code.
@printlife9016
@printlife9016 3 года назад
Hi, just a quick question to confirm one thing. Does the bluetooth plugin you are using work with Windows system?
@ThatProject
@ThatProject 3 года назад
This BLE plug-in is for mobile (iOS, Android). It does not work in Windows applications.
@printlife9016
@printlife9016 3 года назад
@@ThatProject Thanks
@vladdobra.a
@vladdobra.a Год назад
Hi! I've tried your tutorial and it works great and I was wondering if we can connect multiple inputs (accelerometers+ESP32) for the unity+android application ? :) Thanks!
@ThatProject
@ThatProject Год назад
That's a good point. To connect multiple ESP32s, it is necessary to distinguish the device address of each ESP32. This part should be implemented in Unity's script. Then you can control BLE data coming from multiple devices.
@vladdobra.a
@vladdobra.a Год назад
@@ThatProject Hi, i changed the code in Unity script and i managed to subscribe 3 inputs :D. It works nice.
@abolfazlmohammadi-gw1ds
@abolfazlmohammadi-gw1ds 3 месяца назад
The name 'BluetoothLEHardwareInterface' does not exist in the current context error?
@ThatProject
@ThatProject 3 месяца назад
DId you get this Unity Asset? assetstore.unity.com/packages/tools/network/bluetooth-le-for-ios-tvos-and-android-26661
@omidnikoosefat1112
@omidnikoosefat1112 7 месяцев назад
Hi I imported your simple test code from gith into unity and got an error on console about line scan for peripheral devices How to fix that? Thanks
@ThatProject
@ThatProject 7 месяцев назад
I haven't tried this in a while, so I'm not sure exactly what the issue is. Are there any issues with the Unity BLE package?
@lecheelemental4739
@lecheelemental4739 3 года назад
Gracias.
@1tsarisonlyway
@1tsarisonlyway Год назад
Hello. Is that possible to visualize multiple sensors with 3d models in unity? I want to use unity in my application, but i wannna be sure that it is possible to visualize both of my MPU6050 sensors.... pls help
@ThatProject
@ThatProject Год назад
When you send data from ESP32 to Unity via BLE, you need to add a kind of prefix to distinguish the device it is from. 0, data1, data2 .... 1, data1, data2 ....
@1tsarisonlyway
@1tsarisonlyway Год назад
@@ThatProject ok
@phillipnewman9174
@phillipnewman9174 3 года назад
Thank you for a really great tutorial. I would like to know what was the maximum frame rate or update rate that you were able to achieve. I am using a Samsung Galaxy A50 together with a BM78 Bluetooth module connected to a PCB with an IMU. I am having problems with lag of about 6 seconds, after about 1 minute of running. Also I am only able to reach about 3-4 fps on the visual update even though my stats show that every packet is received.
@ThatProject
@ThatProject 3 года назад
Do you send data through BLE in the BM78 module? There may be a delay because the receiver cannot handle all the data. Please check where the problem occurred by adding a delay after sending the data.
@phillipnewman9174
@phillipnewman9174 3 года назад
@@ThatProject I finally got it working at 10 FPS or real time without any lag after I reconfigured the BM78 module setup parameters.
@ThatProject
@ThatProject 3 года назад
@@phillipnewman9174 Great! Glad to hear that!
@mango3814
@mango3814 3 года назад
Hi! I really really enjoy your video:) I have a problem during following along your project. When I run the unity with the code you give us in githube, I can't get quaternion values. It just sticks to initializing state. Can you tell me why? and is it right to upload "MahonyAHRS_ESP32_BLE" code to ESP32? (I mean the code you give us in "ESP32 | MPU6050 | MahonyAHRS - Adding BLE module(ft. String vs Float)"video. Additionally when i upload the "MahonyAHRS_ESP32_BLE" code to ESP32 and see the serial monitor, just "start advertising" sign repeatly coming up)
@ThatProject
@ThatProject 3 года назад
It's stuck? Are you using MPU6050 based on ESP32? The result should be the same as my video.
@mango3814
@mango3814 3 года назад
@@ThatProject Yes, unfortunately it stops there. I use MPU6050 and ESP32 Lolin D32. Is there any point to modifiy in "MahonyAHRS_ESP32_BLE" code?
@ThatProject
@ThatProject 3 года назад
@@mango3814 Are you using Unity Editor or Real devices like Android or iPhone(iPad)? The BLE library for Unity is not working in Unity Editor. ​YOU HAVE TO BUILD IT ON A MOBILE DEVICE
@DimasHerjuno
@DimasHerjuno 2 года назад
Hi, does the yaw rotation drift a lot in your project?
@ThatProject
@ThatProject 2 года назад
It has a rotation drift but not that much. If you want to see the ACC and Gyro drift, check this out. BNO055 is better in my experiment. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3-IBOJ5FQvI.html
@namanprat
@namanprat 10 месяцев назад
Can I use the same method using the esp8266? Also what bluetooth module do I use to make it work?
@ThatProject
@ThatProject 10 месяцев назад
Why don't you use ESP32? It has a built-in BT module(BLE).
@namanprat
@namanprat 10 месяцев назад
That's what I'm doing now. I am using the MAX30102, but the heart rate values are not accurate. What can I do about it?@@ThatProject
@ThatProject
@ThatProject 10 месяцев назад
​@@namanprat Sorry but this project is not related to MAX30102 and I have no idea what the issue is.
@خالدرشدى-ك8ذ
@خالدرشدى-ك8ذ 3 года назад
Plz make tutorial about arduino buttons play specific video on pc screen
@shannog1363
@shannog1363 3 года назад
cool
@spacemini24
@spacemini24 3 года назад
Is your monitor the lg34gk950f ?
@ThatProject
@ThatProject 3 года назад
I believe it’s LG34WN80C
@bhaskar377
@bhaskar377 3 года назад
Hi thanks for this awesome tutorial 🔥, Just one thing I need to ask that When I implemented this into ios It didn't work.
@ThatProject
@ThatProject 3 года назад
Hey! Actually, I haven't tested it in the iOS environment yet. What part of the problem does it occur? Does the BLE connection work properly?
@bhaskar377
@bhaskar377 3 года назад
Hi, Thanks for the reply. The problem I am facinf is that I am able to connect to the esp32 but data is coming only in xcode console but not showing in console of the app, In app it get stuck on Subscribing to ESP32.
@ThatProject
@ThatProject 3 года назад
Are you sure that have a test on a real device, aren't you? If so, try to use the BLE scanner app to connect your ESP32 from your iOS device and check the connection and incoming values. You can download any BLE Scanner app from App Store.
@bhaskar377
@bhaskar377 3 года назад
Hi, I am using a real device(ipad) with ios 14.4 and its getting connected and also I have confirmed it via nordic app, but the issue is that in subscribe case its get stuck and the function defined inside it doesn't behave as in android as data is coming but not getting transferred into the variables defined there
@bhaskar377
@bhaskar377 3 года назад
hey, I got it working on ios thanks to tony from shatalmic llc(ble asset creator). And thanks to you for this wonderfully crazy tutorial.
@Bukva_B
@Bukva_B Год назад
Hello, how to get accelerometer data from ESP32?
@ThatProject
@ThatProject Год назад
I don't get the point of your question. You can collect the accelerometer from MPU6050 which is an IMU sensor.
@Bukva_B
@Bukva_B Год назад
​@@ThatProjectThe video uses some bytes in order to get data from the gyroscope (0, 4, 8, 12). I didn't understand how it works. Probably in a similar way you can get accelerometer data?
@ThatProject
@ThatProject Год назад
@@Bukva_B Please refer to this video first. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-lpnG7K0-E88.htmlsi=j9-D8Egst6ucEvT9&t=471 I need to send Quaternion values from ESP32 via Ble. BLE can send 20 bytes per packet. The problem is that the values we need to send have decimal points, so if we change them to strings and send them, we can't include them all in 20 bytes. So, each value was converted into bytes and sent, and the receiving side used BitConverter to restore them. learn.microsoft.com/en-us/dotnet/api/system.bitconverter?view=net-7.0
@RicardoSurfMusic
@RicardoSurfMusic 3 года назад
How do u get the position of the object?
@ThatProject
@ThatProject 3 года назад
No, I tried to get a position but I gave up due to the failure of the IMU sensors drifting correction.
@OMNI_INFINITY
@OMNI_INFINITY Год назад
Nihonjin?
@ThatProject
@ThatProject Год назад
いいえ
@OMNI_INFINITY
@OMNI_INFINITY Год назад
@@ThatProject Ah, didn't think so. I'm guessing Taiwanese then.
@parvprobotz3735
@parvprobotz3735 3 года назад
plz make esp32 cam joystick car
@parvprobotz3735
@parvprobotz3735 3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qbvkQvIMnX8.html like this
@ThatProject
@ThatProject 3 года назад
yeah it'll be one of my projects one day.
@parvprobotz3735
@parvprobotz3735 3 года назад
@@ThatProject actually there is an compitition soo please an you make a new tutorial for that
@ThatProject
@ThatProject 3 года назад
That Project's Channel - ru-vid.com Join FB Group - facebook.com/groups/138965931539175
Далее
Holding Bigger And Bigger Dogs
00:18
Просмотров 26 млн
Семья с двойным дном. Рассказ
2:45:06
How would you react?!😳
00:44
Просмотров 6 млн
Forget About Raspberry Pi! Use Your Old Phone Instead.
9:09
ESP32 | MPU6050 - Using MahonyAHRS (ft. dice)
11:28
Просмотров 11 тыс.
Why Are Open Source Alternatives So Bad?
13:06
Просмотров 637 тыс.
Mesh Networking demo on ESP8266 & ESP32 | LCSC
8:28
Просмотров 160 тыс.
2D Player Movement In Unity
5:34
Просмотров 436 тыс.
Monitor Temperature using Augmented Reality & IoT
17:33
Holding Bigger And Bigger Dogs
00:18
Просмотров 26 млн