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!
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!
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
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.
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.
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 .
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?
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.
@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.
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?
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.
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.
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!!
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?
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?
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.
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!
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
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
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.
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.
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 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.
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.
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.
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.
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?
.... So I only need to connect the SDA and SCL pins of the MPU 6050 to the 12C interface pins on my board. No need to worry about the INT pin or the other pins for the matter. Could someone please point me in the right direction
hi, i'm trying to communicate arduino(slave) and blue pill(master) with i2c using wire library on both devices. on slave reset, blue pill master seems hang. but not if i use arduino as master. anyone know why?
Arduino's (ATMega base) have a hardware bug in the silicon which also prevents it receiving more than one byte at a time. I2C spec indicates that multiple byte transfers are possible with ACK signal after each byte but arduino hardware does not ACK back and just freezes the data bus. STM32 maybe does not have this issue in hardware. ( i found this issue after building a big circuit board in which a Raspberry Pi was trying to talk to two ATMega328p over I2C and the arduino's could not receive 8 bytes in one data packet. Only one byte at a time. This made my project work slow and I had to implement a different solution with the Pi and MCP3008's (a SPI base ADC)
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.
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?
waoooooooo!!!! Such a good explanation. Thank you thank you thank you so much. Please make more video. I understand alot of thing by going through ur video. Thank you so much
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.
Hello Joop, Again a very great video sir.. Since the STM32F108C8T6 microcontroller contains 3 USART, 2 I2C and 2 SPI ports, is it possible to change the port number..? Or is it possible to instruct the microcontroller that which port we want to use..?
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.
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
For the programming, I found that it would not show the correct output when I followed your code but when I changed the serial port from 57600 to 9600 it displayed the correct output. Am I doing something wrong? Why does this change cause the correct output? If you could please explain that would be helpful.
If you set Serial.begin(57600); in the code, you also need to set the serial monitor of the Arduino IDE to 57600bps. Are you using the serial upload method or the USB?
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!
There are lots of clever people, but not many who are able to pass on the knowledge efficiently. Thank you Joop!👍
The validation of the i2c was really inspiring.. Great video for everybody who is looking for "where to begin";-). Thanks Joop! Great Work!
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!
Nice explanation on two's complement, that was the easiest explanation I've come across. Seems obvious now.
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
Best explanation I've ever seen on microcontrollers on TH-cam.
Thank you for the excellent explanation on why pull-up resistors are necessary. For me, a newbie, this was a huge "ah ha!" moment.
Underrated channel
Indeed!
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.
As always, an extremely high quality tutorial. Please keep up the good work as it is very much appreciated.
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.
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 .
Great extra level of detail on I2C pull-ups w.r.t. clock speeds and the 2's complement stuff. Thanks so much :-)
What an explanation!!! Thank you man indeed. You said you hope we learned something! Are kidding???
Excellent video. Engineering quality , where also experienced people can learn important things.. Greetings from DE.
*I've been waiting for this since eternity, continue with STM32 as it is the future, similar to Arduino, back in 2007.*
*don't forget ESP32*
Well, I tried to upload the code to my stm 32 and it didn't work.
Please help me
This was a great set of problems just about anyone is going to face moving to a platform with different data width! Thanks.
Why are you using FDTI ???....there is an onboard usb input...can't we program it directly from there??
You got a subscriber, good job
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
Very informative tutorial. Thanks also for the 2's complement explanation.
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?
Hello Joop,
Excellent presentation with detailed and to the point explanation.
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.
Or just buy an ST-LINK.
@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.
waht shuldo you do if you have die chines version of the stm and its not working?
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?
is it works at 9600 baudrate
where STM32cubeIDE ?
Привет как это подключить к приложению
Just when I need this information, great timing! :D
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
Where can I buy your completed circuit board?
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.
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!!
@@eyal4 My pleasure sir!
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.
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!!
Bravo! Great video with lots of learning points! Thank you.
Mama mia you are talking with very Italian pizza mafia accent ;)
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?
Bedankt Joop voor je duidelijke uitleg!
great easy work ,that shows how deep your understanding is.
CAN I ASK what your Profession
؟ is
His profession is "funeral director"
Thank You for detailed explanation and theory. Very useful information.
Hi Joop - great video. Keep them coming.
I hope you'll cover YMFC-AL code again for stm32 in new videos. Great explanation, thank you buddy.
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?
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.
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!
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
Where can I download arduino code from?
It's on the screen, type it out ya lazy bum ;)
Great Videos, keep up the good work. Really helpful !
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
is it ok??
The vibration levels are ok.
Great video, many useful information can be learned from it.
Woaaaa! it's a really nice video. Thank's so much for the easy ti understand explanation
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.
Just looked the MPU-60x0 Data Sheet and it definitely is a 3.3 V device with 3.3 V IO.
thank you ! finally i can solve my problem that i've previously asked ! keep up the good work and nice explanation
Where can i find the given program?
Very good and practical information, great presentation.
Hello. I ran your code. It works very well but I only get 2 different values. How can I get the values of all axes, that is, the 6 axes?
0:49 -- is this some kind of factory reject? Soldering looks horrible, and board screams for reflowing solder joints and cleaning.
Welcome to the world of cheap Chinese products.
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.
Excellent video!! Congrulations
Good review of basics! Thanks. 😃
Great video with good details! Thanks
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
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.
@@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.
Learned a bunch. Thank you.
With the new bootloader, you can use inbuilt microusb to program it.
This was rather helpful, thanks a lot.
mpu 6050 not reponding .. please help
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.
Code worked only after this change. Thanks.
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.
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.
Great tutorials on this channel!
Great video as usual. Thanks mate.
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?
....
So I only need to connect the SDA and SCL pins of the MPU 6050 to the 12C interface pins on my board. No need to worry about the INT pin or the other pins for the matter.
Could someone please point me in the right direction
What is the idea of using STM32 when i can connect Arduino to MPU6050 directly!!?
Great job! Thank you, you made my life a lot easier
Awesome!!! Thanks so much for your efforts.
hi, i'm trying to communicate arduino(slave) and blue pill(master) with i2c using wire library on both devices. on slave reset, blue pill master seems hang. but not if i use arduino as master. anyone know why?
Arduino's (ATMega base) have a hardware bug in the silicon which also prevents it receiving more than one byte at a time. I2C spec indicates that multiple byte transfers are possible with ACK signal after each byte but arduino hardware does not ACK back and just freezes the data bus. STM32 maybe does not have this issue in hardware. ( i found this issue after building a big circuit board in which a Raspberry Pi was trying to talk to two ATMega328p over I2C and the arduino's could not receive 8 bytes in one data packet. Only one byte at a time. This made my project work slow and I had to implement a different solution with the Pi and MCP3008's (a SPI base ADC)
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?
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
Thank you very much for this informative video... Please zoom in on the code while explaining it
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.
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?
waoooooooo!!!! Such a good explanation. Thank you thank you thank you so much. Please make more video. I understand alot of thing by going through ur video. Thank you so much
How do I convert 16 bit 2s complement values into a normal int?
Can someone please explain the advantages of why you'd want to use this?
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.
Hello Joop,
Again a very great video sir.. Since the STM32F108C8T6 microcontroller contains 3 USART, 2 I2C and 2 SPI ports, is it possible to change the port number..? Or is it possible to instruct the microcontroller that which port we want to use..?
Yes, you can use all the ports with the STM32 for Arduino add-on.
Thanks for the great video!
Hello
would it be possible to have the program for the STM32F103C8T6
because those who accompany the video are for arduino uno.
thank you
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.
I learned something new, thank you. Question, with i2c at 100khz this slowdown does not appear?
Most of the time the 100kHz works fine.
Have you got any videos in the works? I'd love to see more content from you!
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
For the programming, I found that it would not show the correct output when I followed your code but when I changed the serial port from 57600 to 9600 it displayed the correct output. Am I doing something wrong? Why does this change cause the correct output? If you could please explain that would be helpful.
If you set Serial.begin(57600); in the code, you also need to set the serial monitor of the Arduino IDE to 57600bps.
Are you using the serial upload method or the USB?
I think I'm using the serial upload method but I do have the arduino connected to my computer with a USB.
@@Joop_Brokking are there any difference between bottloader and ftdl for code
Hey joop, perhaps you can increase your font size next time. That makes it a little easyer to read!
The Arduino IDE also supports line numbers and code folding now. Found it in the preferences by coincidence.
It looks OK on my 55in 4K TV... ;)
Have you tried full-screen mode? Or maybe you're on a hand-held device, that would be pretty hard to read!
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.
Can u turn on the CC in the right bottom corner so that we can note down important points? PLEASE!
Thank you so much! Love you way to teach.
Do you have example project you work here