Тёмный

Arduino for STM32 + MPU-6050 == Improve your programming skills! 

Joop Brokking
Подписаться 79 тыс.
Просмотров 208 тыс.
50% 1

In this video I connect a MPU-6050 gyro to the STM32F103 microcontroller via I2C. And as always there are problems that need to be solved. And that’s great! Hopefully you learn something from this video as I did while I was making it.
Getting started with the STM32 microcontroller - STM32F103C8T6 via Arduino:
• Getting started with t...
The Arduino_STM32 project of Roger Clark on GitHub
github.com/rog...
The Arduino for STM32 forum page:
www.stm32duino....
I bought the STM32F103C8T6 here:
www.dx.com/p/st...
The MPU-6050 gyro/accelerometer
www.dx.com/p/gy...
And also the FTDI programmer:
www.dx.com/p/cr...

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

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 199   
@rljzathras
@rljzathras 6 лет назад
Great description of 2's complement. After 40 years I've still been complementing the lot, then adding 1 to get the magnitude result. Just using -128, or -32768 for the MSB - sheer genius!
@bassome3000ify
@bassome3000ify 7 лет назад
Underrated channel
@ramimehyar481
@ramimehyar481 2 года назад
Indeed!
@ethereum3742
@ethereum3742 3 года назад
There are lots of clever people, but not many who are able to pass on the knowledge efficiently. Thank you Joop!👍
@preveenpadmanabhan7994
@preveenpadmanabhan7994 7 лет назад
The validation of the i2c was really inspiring.. Great video for everybody who is looking for "where to begin";-). Thanks Joop! Great Work!
@jparky1972
@jparky1972 5 лет назад
Awesome! So clearly explained. I liked that you showed what the problem was then how to fix it instead of just doing the code in its finished state and not explaini g why these things are done. Thank you!
@blaser80
@blaser80 7 лет назад
Nice explanation on two's complement, that was the easiest explanation I've come across. Seems obvious now.
@TetraluxOnPC
@TetraluxOnPC 5 лет назад
I never understood that two's compliment is that you just invert the sign of the value of the high bit. Quite why I haven't come across that rather important simple detail before is beyond me.
@harshalnikhade7058
@harshalnikhade7058 4 года назад
Best explanation I've ever seen on microcontrollers on RU-vid.
@mikemontana7436
@mikemontana7436 7 лет назад
Thank you for the excellent explanation on why pull-up resistors are necessary. For me, a newbie, this was a huge "ah ha!" moment.
@malgailany
@malgailany 7 лет назад
I had a similar problem when I was using an I2C sensors with STM32F429 Disco board and had to change the pull-up resistors to 1.5K ohm to enhance the stability of communication between the MCU and sensors because I was using a long wires for the I2C bus. Very nice video.
@olavogazzola2650
@olavogazzola2650 4 года назад
So gladly I found this channel, most people just library everything and the supposed tuttorials are very vague, Joop in other hand have a completely different approach, simple but down to the roots of the thing
@TanishqIsHere
@TanishqIsHere 7 лет назад
*I've been waiting for this since eternity, continue with STM32 as it is the future, similar to Arduino, back in 2007.*
@rodstartube
@rodstartube 6 лет назад
*don't forget ESP32*
@paulbraathen688
@paulbraathen688 7 лет назад
As always, an extremely high quality tutorial. Please keep up the good work as it is very much appreciated.
@ImaginaPower
@ImaginaPower 6 лет назад
Hi Joop ! Thank you for being patient to talk calmly and not rush when saying things it makes it much easier to understand and you take your time to teach very detailed that`s why i subscribed at once after watching this video. I learned a lot. Nice job! Are you the Joop that is interested in making PI metal detectors? If you are I would just love to see you make a video series and teach with that topic and use the stm32 for that purpose! I would appreciate it alot. Thanks again .
@philtaylor5467
@philtaylor5467 4 года назад
Great extra level of detail on I2C pull-ups w.r.t. clock speeds and the 2's complement stuff. Thanks so much :-)
@BerndSchmitt-Martinique
@BerndSchmitt-Martinique 3 года назад
Excellent video. Engineering quality , where also experienced people can learn important things.. Greetings from DE.
@GnuReligion
@GnuReligion 6 лет назад
The first thing to do with a "Blue Pill" stm32, is to put the Maple USB bootloader on board, so you can power, program and debug through the micro USB bus. Nice note there ... putting extra pull-ups on the i2c lines to improve speed. I've read that the pull-ups should go closest to the lowest voltage device.
@SpeccyMan
@SpeccyMan 6 лет назад
Or just buy an ST-LINK.
@pixelflow
@pixelflow 7 лет назад
This was a great set of problems just about anyone is going to face moving to a platform with different data width! Thanks.
@adelashour3253
@adelashour3253 7 лет назад
great easy work ,that shows how deep your understanding is. CAN I ASK what your Profession ؟ is
@angrycatowner
@angrycatowner 4 года назад
His profession is "funeral director"
@RickeySmithEric
@RickeySmithEric 6 лет назад
Very informative tutorial. Thanks also for the 2's complement explanation.
@TanishqIsHere
@TanishqIsHere 7 лет назад
8:58 If I'm not wrong, there is small correction I think '0' represents 'Positive' and '1' represent 'Negative' "Most Significant Bit" in 1s as well as 2s compliment.
@VamosConLaPeli
@VamosConLaPeli 4 года назад
2019-12-11: I've just bought a couple of those same modules, those two pull-up resistors are now 2k2, they must have seen this great video Joop :D And the frequency is 400.0 kHz spot-on, but the wire library must have undergone some changes, Wire.setClock(400000UL) must now be called _after_ Wire.begin(), because the latter sets the clock to the default speed of 100 kHz.
@eyal4
@eyal4 3 года назад
Thank you very much!! i went crazy not knowing why when I change the frequency the time of the data reading doesn't change. thank you sir!!
@VamosConLaPeli
@VamosConLaPeli 3 года назад
@@eyal4 My pleasure sir!
@sudhirgupta7558
@sudhirgupta7558 7 лет назад
Hello Joop, Excellent presentation with detailed and to the point explanation.
@hassiaschbi
@hassiaschbi 7 лет назад
Just when I need this information, great timing! :D
@soumyasarkar5692
@soumyasarkar5692 4 года назад
Your Video tutorial is really great and probably the best and most comprehensive I have ever seen. Keep it up! You deserve more subscribers and more thumbs up. What I do not understand is; while calibrating gyro in setup loop there is a delay for 3700 microseconds to simulate the main program loop time (4000 microseconds). What happen if loop time is different in setup loop than that of in the main loop?
@omsinha6614
@omsinha6614 4 года назад
mpu 6050 not reponding .. please help
@maarcnylmz39
@maarcnylmz39 7 лет назад
I hope you'll cover YMFC-AL code again for stm32 in new videos. Great explanation, thank you buddy.
@PA3CSX
@PA3CSX 7 лет назад
Bedankt Joop voor je duidelijke uitleg!
@muhammadibtisam4364
@muhammadibtisam4364 4 года назад
Why are you using FDTI ???....there is an onboard usb input...can't we program it directly from there??
@treereaverjones6535
@treereaverjones6535 7 лет назад
Joop any chance of you putting that code where I can get at it? My eyes are 80 years old and need really thick glasses so I can't read that code, and type it in at the same time. Thanks for a great tutorial. I have just started with STM32 and my LED on pin 13 is wired so LOW is on, weird or what?
@SPECIALZONE123
@SPECIALZONE123 4 месяца назад
Why are you use HWire library instead of wire library, already you get out put in stm32 at same code of Arduino Uno , and it's working fine
@canari.satiné
@canari.satiné 7 лет назад
Hello how could I improve my mpu6050 code with brushless motor because the signal is stable but when the motor begin turning the mpu signal will be instable!!
@cameravala
@cameravala 4 года назад
Where can i find the given program?
@antoriphaldar5723
@antoriphaldar5723 2 года назад
Well, I tried to upload the code to my stm 32 and it didn't work. Please help me
@RaadYacu
@RaadYacu 7 лет назад
Hi Joop - great video. Keep them coming.
@Spiderelectron
@Spiderelectron 6 лет назад
HI and thanks for a great channel! One small point.. That gyro.. I am pretty sure that it uses a 5 V power supply, but on board is a 3V3 LDO and all the IO is actually 3.3 V, so no worries about connecting it to STM32.
@Spiderelectron
@Spiderelectron 6 лет назад
Just looked the MPU-60x0 Data Sheet and it definitely is a 3.3 V device with 3.3 V IO.
@ramimehyar481
@ramimehyar481 2 года назад
What an explanation!!! Thank you man indeed. You said you hope we learned something! Are kidding???
@caffeinatedinsanity2324
@caffeinatedinsanity2324 4 года назад
This board is also a great to transition from arduino to STM32CubeIDE, if you can get your hands on an ST-Link. Or the Nucleo 64 is also a great start, since it comes with the ST-Link already attached
@sergiourquijo4000
@sergiourquijo4000 4 года назад
Hello man. I hope you can solve my questions. I neeeed it please :))) So it seems to be two ways of adding the board support to the IDE. Yours is one (throught the "arduino SAM boards (32-bits ARM Cortex-M3) by Arduino") and another way is throught the library called "stm32f1xx/gd32f1xx boards by stm32duino". This other way doesn`t require any download except for just pasting an url in the "additional boards manager URL`s" and installing the library with the boards manager. What is exactly the "stm32 for arduino addon" what do you refer by that name? And lastly, in 16:15 you say that by updating the "stm32 for arduino addon" you can now generate 400khz clock because it now uses the hardware i2c library. Does that mean that in the video you were using the software based one and that`s why you needed to add those two resistors? Or is the resistor problem another separate problem? I just want to thank you in advance. Just your channel has gotten me into the microcontroller stuff. I have ordered a lot of stm32, arduinos and sensors hahaha. I have a lot of projects in mind involving an autonomus plane wich i already starting and i already have it maintain a constat airspeed throught a cascade pid system.
@lucdrouin2625
@lucdrouin2625 5 лет назад
Thank You for detailed explanation and theory. Very useful information.
@antonioc760
@antonioc760 7 лет назад
Bravo! Great video with lots of learning points! Thank you.
@fjrg76
@fjrg76 6 лет назад
Nice tutorial, but I missed the part where you explain your obsession for 400 kHz I2C channel. Why 100 kHz are wrong? Without technical justification, the pull up resistors values are too low.
@rljzathras
@rljzathras 6 лет назад
I'd suspect the slow rise time would also have equally affected the 100kHz bit rate. The RC time constant would be the same, still taking too long to reach the 1.5V threshold. Nothing wrong using the correct value resistors to achieve a decent slew rate. 10k pullups are generally useless on I2C. The oscilloscope clearly reveals the sins of poor component choice.
@frankaalbers1099
@frankaalbers1099 6 лет назад
Thanks for the great tutorial. There is one problem though. You have to put setClock AFTER begin. begin will set it to 100 kHz. If you run begin first and THEN set the clock it will work at 400 kHz.
@lumberjack4096
@lumberjack4096 2 года назад
Code worked only after this change. Thanks.
@filipstojanovicmechanicale9265
@filipstojanovicmechanicale9265 2 года назад
You got a subscriber, good job
@jamescullins2709
@jamescullins2709 7 лет назад
Very good and practical information, great presentation.
@heyarno
@heyarno 7 лет назад
This was rather helpful, thanks a lot.
@orarinnarni6886
@orarinnarni6886 7 лет назад
Great Videos, keep up the good work. Really helpful !
@EarthWalkerMan
@EarthWalkerMan 5 лет назад
Great video, many useful information can be learned from it.
@qa-majeed
@qa-majeed 4 месяца назад
Hi, I am constantly getting -1 value from gyro meter. I have validated the connections and the code, but its not working for me. Any help would be greatly appreciated!
@RakshithPrakash
@RakshithPrakash 4 года назад
With the new bootloader, you can use inbuilt microusb to program it.
@compaqsow1
@compaqsow1 7 лет назад
Excellent video!! Congrulations
@_numanair_
@_numanair_ 2 года назад
Learned a bunch. Thank you.
@nemobondt9117
@nemobondt9117 7 лет назад
Hey joop, perhaps you can increase your font size next time. That makes it a little easyer to read!
@ZeedijkMike
@ZeedijkMike 7 лет назад
The Arduino IDE also supports line numbers and code folding now. Found it in the preferences by coincidence.
@imoldovan
@imoldovan 7 лет назад
It looks OK on my 55in 4K TV... ;)
@Spiderelectron
@Spiderelectron 6 лет назад
Have you tried full-screen mode? Or maybe you're on a hand-held device, that would be pretty hard to read!
@k6l2t
@k6l2t 6 лет назад
And also get a dark theme while you're at it. Dark text on white background in 2018??? Y I K E S. My eyeballs are bleeding.
@exosdel
@exosdel 7 лет назад
Great tutorials on this channel!
@assetedgeindia
@assetedgeindia 7 месяцев назад
did the same things but the reading for all the values is 0 don't know why the mpu is not communicating with the stm board
@tibtipitib
@tibtipitib 5 лет назад
¿ Porque no haces el video en Español ?
@PLopezproduction
@PLopezproduction 7 лет назад
Awesome video!
@alirezaghaderi
@alirezaghaderi 5 лет назад
one of the best videos..thanks
@omarroldan5276
@omarroldan5276 5 лет назад
Woaaaa! it's a really nice video. Thank's so much for the easy ti understand explanation
@nyder1331
@nyder1331 Год назад
where STM32cubeIDE ?
@keen2461
@keen2461 7 лет назад
Great video as usual. Thanks mate.
@BillXT11
@BillXT11 5 лет назад
Great video with good details! Thanks
@jackyb695
@jackyb695 2 года назад
I did every things as explained and when running the program I receive only zeros and not real values, I the program with Arduino UNO and it working well. what should I DO?
@1misteruser
@1misteruser 7 лет назад
How can I connect 3 MPU?
@harryobrien9035
@harryobrien9035 4 года назад
Have you got any videos in the works? I'd love to see more content from you!
@Harrzack
@Harrzack 7 лет назад
Good review of basics! Thanks. 😃
@RahulSingh-fn1qr
@RahulSingh-fn1qr 4 года назад
Hey Joop, did a silly mistake. Taken the variable to store the addition of gyro value as 16 bit. After taking it as a 32bit variable problem got solved. But still my gyro is outputting from -16 to +17 on all the three axis. Should I purchase a new one and try it out?
@javierpallalorden
@javierpallalorden 7 лет назад
Excellent video, dankje!
@charlesbiggs7735
@charlesbiggs7735 7 лет назад
Awesome!!! Thanks so much for your efforts.
@ucanhtrannhan7558
@ucanhtrannhan7558 7 лет назад
thank you ! finally i can solve my problem that i've previously asked ! keep up the good work and nice explanation
@muhammedalperenylmaz9000
@muhammedalperenylmaz9000 5 лет назад
is it works at 9600 baudrate
@andygyakobo7122
@andygyakobo7122 5 лет назад
I used the TwoWire library to no avail... for some reason I cannot relocate i2c to sda2 and scl2... I tried everything, even tried to access the circuit's registers... what shall I do?
@hakerunknown4375
@hakerunknown4375 3 года назад
Mama mia you are talking with very Italian pizza mafia accent ;)
@adityaanandiitb5302
@adityaanandiitb5302 7 лет назад
hi joop please help me in the YMFC-AL I want to know the minimum vibration you get after adding tapes mine is between 30-40 of one motor and of 4 motor the vibrations are between 40-70
@adityaanandiitb5302
@adityaanandiitb5302 7 лет назад
is it ok??
@Joop_Brokking
@Joop_Brokking 7 лет назад
The vibration levels are ok.
@RahulSingh-fn1qr
@RahulSingh-fn1qr 3 года назад
@Joop, I was able to use the I2C communication with the pins PB6(clock) and PB7(data) but when I try to use the use PB10 and PB11 for I2C it is not working. Have gone through the internet and manual to my best but found nothing useful. I was able to connect the gyro l3g4200d and accelerometer ADXL345 on the same bus line of (I2C1 -> PB6, PB7) but pulling data from these two seem to be on the slower side. I want to connect them each to the separate I2C bus lines (I2C1 -> PB6, PB7 and I2C2 -> PB10, PB11). Any help from you or the community is highly appreciated, Thanks.
@hamradio323
@hamradio323 4 года назад
Great video! In the gyro the pullups are not 10k but 4k7 and so adding parrallel resistors of 4k7 the pullups becomming half 2k35. But i realy love your channel.
@davidbradley3074
@davidbradley3074 3 года назад
Thanks for the great video!
@lovemozard
@lovemozard 7 лет назад
Great job! Thank you, you made my life a lot easier
@hardikgupta3752
@hardikgupta3752 3 года назад
I am using an STM32WB30 MCU with MPU6050.If I program it with Arduino IDE, do I have to add the extra 4.7k resistors? Does it still happen or have the drivers been updated?
@jimmorrison6294
@jimmorrison6294 6 лет назад
Where can I download the Arduino_MPU-6050_testfile from. I need to test my breadboard build before I can move on to a PCB videos very much appreciated Joop
@Joop_Brokking
@Joop_Brokking 6 лет назад
You can test it with the test program that is available here: www.brokking.net/YMFC-32_downloads.html It will also work on a breadboard.
@civoludo
@civoludo 5 лет назад
@@Joop_Brokking Hi joop, I have dowloaded the file, unfortunatly I cannot ind the file Arduino_MPU-6050_test.ino . great video and website, congratulation for this great job usful for an 100% begginer like me.
@heuehwbebjd2100
@heuehwbebjd2100 6 лет назад
I get the erroe: 'Wire" was not declared in this scope, i try many ways but it ditnt work, pls show me what to do
@yunusemreates6976
@yunusemreates6976 7 лет назад
great tutrial. thanks very much
@Tyrone-Ward
@Tyrone-Ward 6 лет назад
Do you plan on making a "better" custom PCB with the STM32?
@pascalou95pascal52
@pascalou95pascal52 5 лет назад
Hello would it be possible to have the program for the STM32F103C8T6 because those who accompany the video are for arduino uno. thank you
@yxhankun
@yxhankun 5 лет назад
Can u turn on the CC in the right bottom corner so that we can note down important points? PLEASE!
@jimmorrison6294
@jimmorrison6294 6 лет назад
When I try running "MPU-6050_IMU" I get the following error error:- exit status 1 'LiquidCrystal_I2C' does not name a type Tried looking for library 'LiquidCrystal_I2C' with no luck.Help please
@ngaungau363
@ngaungau363 Месяц назад
Do you have example project you work here
@mohammedmaamo9437
@mohammedmaamo9437 2 года назад
What is the idea of using STM32 when i can connect Arduino to MPU6050 directly!!?
@tigrafrog
@tigrafrog 7 лет назад
0:49 -- is this some kind of factory reject? Soldering looks horrible, and board screams for reflowing solder joints and cleaning.
@Joop_Brokking
@Joop_Brokking 7 лет назад
Welcome to the world of cheap Chinese products.
@juststeve5542
@juststeve5542 7 лет назад
Indeed! i had one where the MicroUSB connector didn't have a single conductor connected to the board! Unfortunately the chassis points had soldered, so I had a great fight getting it to sit 0.5mm closer to the board so I could solder the 5 tiny pins. I really should have just broken out the hot air gun, but I'd already started the fight with pointy iron tip and solder wick. BTW Joop, I notice your STM32 board has the standard incorrect D+ pull-up resistor (R10). These blue boards all seem to come with 10K, which is too big, it should be 1K5. Just thought I'd mention it as that caused me some fun... One PC didn't care, another refused to talk to the board! It's worth storing that little gem in your memory for that 3am moment when things are getting weird! Keep up the good work.
@buiciucdaniel6794
@buiciucdaniel6794 5 лет назад
Hi, from where did you took the driver for STM32?
@AmineMahdhiChaine
@AmineMahdhiChaine 5 лет назад
you're the boss @Joop
@frantech6935
@frantech6935 3 года назад
Great work, thank you.
@PG-do9zl
@PG-do9zl 2 года назад
waht shuldo you do if you have die chines version of the stm and its not working?
@JaydenLawson
@JaydenLawson 7 лет назад
Can someone please explain the advantages of why you'd want to use this?
@superdau
@superdau 7 лет назад
Compare the datasheets of the ATmega328 and the STM32F103 and you'll know why. At least start with the first few pages where the hardware features are explained.
@louco2
@louco2 6 лет назад
Thank you so much! Love you way to teach.
@noweare1
@noweare1 7 лет назад
I really like the stm32's The documentation is excellent. I don't like using HAL to program them. The SPL is good and also their LL functions are awesome if you want to stay closer to the hardware. I wish st32 had all the libraires that the arduino has. Then I would switch.
@sameerk12982
@sameerk12982 4 года назад
Thank you very much for this informative video... Please zoom in on the code while explaining it
@MarvbitProject
@MarvbitProject 5 лет назад
Great video !
@juanalcalde766
@juanalcalde766 4 года назад
hello joop thanks for your videos ive started programing the stm32 a couple of days ago and i cannot get the i2c clock signal to reach 400khz it does stays fixed at 100khz and ive been using updated wire libraries from the same github developer that you got it, the signal ive measured with an oscilloscope but i think is a library issue becouse it doesnt matter what Wire.setClock value i write it stays fixed at 100khz which is the default value... im asking becouse i dont know what to do at this point... ive reduced pullup resistor with 5kohm resistors as you did, updated arduino/stm32 libraries and full hardware folder and no results.. can you help me? or at least send me on the correct way to solve the problem?
@spectrumto8521
@spectrumto8521 3 года назад
Put set.clock(400000) after Wire.begin
@spectrumto8521
@spectrumto8521 3 года назад
Does your mpu work?
@juanalcalde766
@juanalcalde766 3 года назад
@@spectrumto8521 Yes I made It work a couple of days after I posted this comment, but thanks anyway mate.
@spectrumto8521
@spectrumto8521 3 года назад
@@juanalcalde766 can you send me the code please? I am experiencing some difficulties and i really need code
@maulanawahyudi7127
@maulanawahyudi7127 3 года назад
how to choose the pin from some of the i2c pins? does it work for all I2C pins? . And do we need to avoid other I2C pins for other purposes?
Далее
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Просмотров 2,2 млн
Build an Electronic Level with MPU-6050 and Arduino
33:37
14 | Measure angles with the MPU6050 accelerometer
13:03
STM32 Blue Pill vs Black Pill Microcontroller Boards
18:31
A Beginner's Guide to Microcontrollers
15:18
Просмотров 38 тыс.