Quadcopter Building: How I'm Troubleshooting my i2c Compass Problem

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024

Комментарии • 97

  • @Painless360
    @Painless360  5 лет назад +8

    UPDATE: Thank you to ALL of you that offered constructive support ideas. What a fab community we are - that wasn't the idea of the video but I've had some great suggestions and support. After getting to the point where it has to be the FC hardware or something in iNav (despite there being no other reports of i2c problems on this flight controller), I've flashed it with Betaflight 3.5.2 and guess what - the compass worked straight away! So, not hardware at all but either iNav or something to do with iNav and this version of the FC.. Stay tuned!

    • @andrewsweet43
      @andrewsweet43 5 лет назад

      Try reflashing the FC with the latest iNav firmware with the "erase all memory" option enabled. The FC keeps some settings in its internal memory even after a firmware reflash that can mess up the configuration (especially while migrating from betaflight to iNav or vice-versa. Btw i had the exact same issue with iNav and and a GPS/Compass combo in my build some dayw ago (the i2c bus seemed dead on the oscilloscope like yours). The solution for me was to wire a different standalone external compass module. There is deffinetly a bug in iNav somewhere...

    • @Painless360
      @Painless360  5 лет назад

      That is an excellent idea. I will try that as I can see it's not hardware now...

    • @sickvic3909
      @sickvic3909 5 лет назад

      Good stuff mr P. Although not your current problem I've had wire connections inside gps modules disconnect.

  • @MCsCreations
    @MCsCreations 5 лет назад +1

    Yeah, Lee... I agree with you. There's not much to try other than swapping the FC... 😕
    I hope you can solve it soon!

    • @Painless360
      @Painless360  5 лет назад +1

      I'm one step closer - the compass works fine on Betaflight!

    • @MCsCreations
      @MCsCreations 5 лет назад

      @@Painless360 Oh, awesome! Great to know! 😃
      Must be something with iNav then. 😕

  • @pspicer777
    @pspicer777 5 лет назад

    My first car - 1970s Austin Allegro - engine the size of a breadbox (seriously), electrical problems, build quality problems, unattractive as all get out. Man how I *LOVED* that thing. Could work on it all day ... but could work on it - not like today's cars... those were the days my friend .... Oh (comes out of reminiscing) - love this series and look forward to following in your footsteps.

    • @Painless360
      @Painless360  5 лет назад

      Mine was a 1977 Ford Escort 1100. Not a bad car but one that needed lots of attention to keep happy.. :)

  • @chattonlad9382
    @chattonlad9382 5 лет назад

    Had the same problem with a similar setup Lee, got around it by using an M8N compass module for a NAZA lite. Just tick the box for GPS compass.

  • @maxgraphpocztaonetpl
    @maxgraphpocztaonetpl 5 лет назад

    Tnx Lee!
    I'm stuck with the same problem, but with Ombnibus F4 v3. FC does not recognize GPS, but when I flash it with Betaflight works! Tested with F4 v3 and F3 v2 Pro. It looks like the problem is with iNav 2.0.0. Now I know that I do not need this new spare GPS, just what I ordered. ;)

    • @Painless360
      @Painless360  5 лет назад

      Looks like there are a few 'issues' in iNav 2.0. I'm hoping that they get fixed in 2.1..

  • @vchan1501
    @vchan1501 5 лет назад +4

    Check whether the UART for I2C is already occupied by something else.... spare that for magnetometer and the compass will work

    • @Painless360
      @Painless360  5 лет назад +1

      Nice idea. It’s not. Happy flying!

    • @brightontilifly
      @brightontilifly 5 лет назад

      that was exactly what I was going to suggest

    • @Painless360
      @Painless360  5 лет назад +1

      Thanks Jack, see the pinned update on this one - it works in Betaflight so it's not an i2c or hardware issue.. Looks like something in iNav or in the iNav/Hardware interaction.. So frustrating!

  • @mikeboon55
    @mikeboon55 5 лет назад

    Hi,
    I have searched high and low for the same issue, and believe me, I have done exactly the same steps even down to the position where we soldered the pull up resistor. I've done all of that even before stumbling on your video! Just FYI I'm using the same BN-880 GPS/Compass and if you look at the unit PCB, there are already 2 1k pull-up resistor on the GPS unit. Technically it should already work out of the box on a I2C.
    Unfortunately I'm using a Airbot F7 (not the Omnibus F7 or the NXT), which is not supported on iNav (there is no barometer, even if I install an external Baro, there is no such Target in iNav). As for Betaflight the Target is there, but I can't try the older firmwares before 4.0 as the Targets were not there. I somehow believed that the issue lies with the Betaflight FW.

    • @Painless360
      @Painless360  5 лет назад +1

      Very possibly, the testing of this open-source code can sometime miss when less used features are broken in an update.. Happy flying!

    • @mikeboon55
      @mikeboon55 5 лет назад

      @@Painless360 Yes, so I have managed to get my magnetometer to finally work on Betaflight.
      1) I can confirmed that the BN-880 GPS already has a built in pull-up resistor and will work out of the box. No additional pull up resistor needed.
      2) Magnetometer and Barometer definitions for Airbot F7 in Betaflight was omitted in 4.0 and hence it was not working. I amended the definitions file and recompile my custom firmware and it now works.
      Unfortunately for iNav, they didn't define Airbot F7 as a target. To do so requires more info to write the target code and its beyond me.

  • @amitsekhon
    @amitsekhon 5 лет назад +1

    Hi Lee, Once i had I2C problem with OLED screen that wouldn't work.After struggling for days,i found that the problem was 5V.I was feeding 5V instead of 3.3v.So your I2C signal line's pull up resistors should be connected to 3.3v.

    • @Painless360
      @Painless360  5 лет назад

      Thanks for the idea but I don't think that the resistors are the issue here as if I check the GPS on it's own I can see them.. I'm checking the other end in case the combined values of the pull-ups at both ends is dropping the effective resistance.. Thanks for the comment.

  • @StigBSivertsen
    @StigBSivertsen 5 лет назад

    Nice video Lee 😊 very strange that you we're not able to get it work... as you mentioned I am able to get it to work and it works fine...

    • @Painless360
      @Painless360  5 лет назад +1

      Something is obviously not the same. Thanks for the help..

  • @dempa3
    @dempa3 5 лет назад +2

    As always great content! Especially for someone who is just getting in to this hobby. Quite curious if the gps and compass modules work on another fc (maybe connect them to a fc where you have gps and compass working with iNav?) or maybe with a different fc-firmware combo. But I guess that is something for the next video! :)

    • @Painless360
      @Painless360  5 лет назад

      They are universal. It’s usually the connectors that are different. See my other videos..

    • @dempa3
      @dempa3 5 лет назад

      I thought that of these modules work on another fc with the same versiob of iNav, one would be able to conclude that there is an issue with the fc. If not, and it works on another fc, with ardupilot for example, then maybe it is the iNav-fc combo. Or am I on the weong track?

    • @Painless360
      @Painless360  5 лет назад

      You could conclude that if you're also able to rule out a problem with the inav software itself. Happy flying

  • @mr_sheen_asg
    @mr_sheen_asg 5 лет назад

    Some compass modules have pullup resistors fitted on so if your FC board has them aswell then you can have issues with i2c,
    I've had this issue with a compass and a pixhawk FC, I have found and removed the resistors from the compass module and it works.

    • @Painless360
      @Painless360  5 лет назад

      Thanks for the idea - I'll check this one! :D

  • @roberteicke2540
    @roberteicke2540 3 года назад

    What size Pull Up Resistors did you add? (I'll give that idea a try) I am having difficulties getting Baro & Compass for Mamba F405 Mk2 working on INAV. FYI Thank You Lee for your contributions to this hobby!

  • @easyfpv3606
    @easyfpv3606 2 года назад

    I got this problem the same now. I think its the flight controll

  • @Jonas-kj1ke
    @Jonas-kj1ke 4 года назад

    i have a xrotor f4 flight controller dont have a i2c port kann i resource it somehow??

  • @atschris
    @atschris 5 лет назад

    I had something similar with a different project and used an Arduino with a really simple sketch to verify whether the i2c interface was working -and it wasn’t in my case. It’s just another tool in our box.

    • @Painless360
      @Painless360  5 лет назад

      Great idea, see the update comment - I've flashed with Betaflight and the compass works great so it's a code/interaction issue..

  • @didactylos4diddy474
    @didactylos4diddy474 5 лет назад +1

    Hmm. Your test regime seems entirely suitable and seemingly you are left with two possible failure points. But as they are linked I'm not at all sure how you can separate them or, indeed, if you can. Not without changing from iNav and/or changing the FC as well. And that wouldn't solve the problem you have. It would just bypass it (at best).
    _I still believe that if it is possible to solve it you will solve it eventually and I look forward to seeing how_ :)

    • @Painless360
      @Painless360  5 лет назад +1

      Testing with another lot of code (Betaflight) has proved that the mag is working.. Looks like iNav now..

  • @Departedalone
    @Departedalone 5 лет назад +2

    Same problem here. It's the FC.
    I tried 2 different NEOM8N with Omnibus F4 Pro V3 and Omnibus F4 Pro V2. Adding Pullup resistors, changing I2C speed, etc like you did using the latest version of INAV(until last week).
    Then I switched the FC to Matek f405-STD.
    Magic!!! No need for pull-up resistors or reducing I2c speed. It detects the compass automatically.
    Well.. it's not a solution :(
    I'll wait someone will find the actual issue and tell us how to solve it.

    • @Departedalone
      @Departedalone 5 лет назад

      I'd like to add to it that I had nothing else connected on the UARTs except GPS and compass on SCL(TX3)/SDA(RX3).

    • @Painless360
      @Painless360  5 лет назад

      I've just ruled out the hardware by setting up the FC with Betaflight and the compass is working.. Hmmm..

  • @lptrung
    @lptrung 5 лет назад

    The video is awesome, you can post the video connect hc-sr04 ultrasonic sensor to INAV 2.0, because I want my quad hold is low height, thank you

  • @salukikev
    @salukikev 3 года назад

    I'm here trying to learn about I2c- this is because unlike FC's with assorted UARTs, it seems like most controllers have only one I2c, and crucially that is the preferred (only) interface for GPS, Compass and Barometer. I'm lacking a barometer but using a BN880 compass/gps. Now I have to find a way to integrate an external baro. Any ideas? (Flywoo F411 Hex FC).

    • @Painless360
      @Painless360  3 года назад

      Assuming they have different I2C I.D.s then you can connect all of the SDL wires together and all of the SCL wires together.. www.bluedot.space/tutorials/how-many-devices-can-you-connect-on-i2c-bus/ covers the basics of how the bus works. Best of luck.

  • @narok801
    @narok801 5 лет назад

    I will change the mapping for the I2C pins to other free UART. Whit "resource i2c_scl 2 b10"
    and "resource i2c_sda 2 b11" for example I am using an I2C magnetometer in an old Matek F405 under betaflight

    • @Painless360
      @Painless360  5 лет назад

      Thanks for the idea. Could be worth a shot!

  • @tedbrosky
    @tedbrosky 5 лет назад

    I had an issue with the pull up resistors it made the i2c errors jump to 9000 and more so i added two 1k pull ups to the module and it got fixed.
    What I’m saying is if your i2c errors in the inav window is less than 3 your pull ups are fine

    • @Painless360
      @Painless360  5 лет назад

      Errors are zero so It's not even getting that far! :D

  • @Rcbeacon
    @Rcbeacon 5 лет назад +1

    I haven't used INAv so these are just guesses based on some I2C experience. Is there another firmware you can load (even if not INav) just to check the I2C port and connection to the compass ? The scope should have shown something. Is INav using the correct CPU pins for the I2C port on the fc board ?
    I haven't had any I2C problems recently but the last time was on a large DSLR gimbal. The sensor wire run was over 500mm. Solution was I2C buffers at each end. Not likely a problem on your quad.

    • @Painless360
      @Painless360  5 лет назад

      Thanks for a great suggestion. It's possible but as others are reposting that this exact compass/FC setup works then it's possible it's a HW/FW issue on these pieces. Interestingly there are no i2c errors at all on the interface so I'm guessing that it's not initialising at all..

    • @Rcbeacon
      @Rcbeacon 5 лет назад

      I guess your fc has the same processor chip as the others are using - same family member with all the IO in the same place. I haven't looked at the code and wonder if it's a hardware I2C port of handled in firmware. I've seen a lot of fc boards over the years with no protection on the lines leaving the board, so the processor can be easily damaged. IMO series resistors are minimum requirement, although you can't do too much to high speed data lines without upsetting the data.

    • @Painless360
      @Painless360  5 лет назад

      I've ruled out the Hardware now, see pinned comment, this is one of those areas that does need to be a lot more robust from developers in their code.. thanks again!

  • @TomaszTurczynski
    @TomaszTurczynski 5 лет назад

    Good points and explanation, I actually have a similar issue but with the barometer (BMP280), added compass to I2C (which works), and then in parallel the barometer, with pull-up resistors and without, basically tried everything you talk about and it does not pick it up :-/

    • @Painless360
      @Painless360  5 лет назад

      This is one of those areas that does seem tricky. With the different revisions, clones and changes in flight controllers you can't rely on one model working every time. I'm suspecting a Hardware issue on the FC or bad code in iNav at this point..

    • @TomaszTurczynski
      @TomaszTurczynski 5 лет назад

      @@Painless360 I couldn't stop investigating this yesterday, so I've taken apart my weather station I built long time ago on Arduino and took barometer from there. Soldered it quickly to my quad, and it worked! So I de-soldered everything to put back together the whole thing, powered it on and it's not recognising it anymore... gave up at this point, maybe I overheated it or something 🤔

    • @Painless360
      @Painless360  5 лет назад

      In my investigations I was reading that you can't put them both on the same I2c line for some flight controllers, so maybe that's part of the problem in your case?

  • @fpvjules3557
    @fpvjules3557 2 года назад

    Hey man, my FC has no SDA/SCL pad, is there any way to remap it or any way to solve it?

    • @Painless360
      @Painless360  2 года назад

      Not that I've come across.... Best of luck

  • @jeffbluejets2626
    @jeffbluejets2626 5 лет назад

    Possible that the I2c hex address of the compass is not matching the software in the controller. This problem comes up with Oled displays as an example.

    • @jeffbluejets2626
      @jeffbluejets2626 5 лет назад

      There is a small program available that fits on to any Arduino and you can scan for whatever i2c devices are on the line and what their address is.
      Easy to use.

  • @landlifem5872
    @landlifem5872 5 лет назад

    Hope you can get this solved and show us all how . Also do you think you might consider doing a series on putting ardupilot on a f4 board ?

    • @Painless360
      @Painless360  5 лет назад

      I'm planning to, but waiting for a little more time to pass as it seems to be very board specific at the moment with specific steps for the board you're looking at.. Oscar Liang has some good stuff on it - oscarliang.com/flash-ardupilot-kakute-f4-f7-fc/

    • @landlifem5872
      @landlifem5872 5 лет назад

      Oh great I look forward to it. I've done some research on it , some guys make it look easy but I'm yet to take the plunge. But ardupilot on omnibus board is a very attractive idea.

    • @midnightmike6273
      @midnightmike6273 5 лет назад

      Just done a Matek F405 with Arducopter today. Here is a link to a video on how to.
      ruclips.net/video/meUxq6eN2tU/видео.html

    • @richardcjoy
      @richardcjoy 5 лет назад

      I am in the process of setting up a Holybro F7 (non AIO) board with Ardupilot and have it working on the bench. Initially I had an issue with the onboard barometer not being recognized but only when I had the external compass connected. As these are both on the I2C interface I found that the order of powering up the board was important. I first needed to connect the battery and then connect the USB cable to the PC, the reverse would not work. The reason is that the GPS/compass was getting power from the FC but only with the battery was connected.

    • @landlifem5872
      @landlifem5872 5 лет назад

      @@richardcjoy
      Oh good job Richard. Hopefully you may be able to do a video on your setup and your trouble shooting tips ?

  • @shuflie
    @shuflie 5 лет назад

    By swapping the GPS and the second one not working you are assuming that at least one of them works, was this confirmed on a different quad? It is quite possible if you got both from the same place that you have two faulty ones.Try hooking one up to an arduino's I2C port and see if you get a response from it.

    • @Painless360
      @Painless360  5 лет назад

      The GPS does work on all three - all GPS elements get a beautiful solid 3D GPS lock in seconds. It's the external compass connected by the i2c cables that has the issue. Thanks for the comment, happy lfying!

  • @shythephotoguy
    @shythephotoguy 5 лет назад

    Very nice video Lee! Also very recognisable situation! I tried changing the baud rates in the ports tab and that fixed the issue for me. When GPS is connected what does the GPS statistics says in the GPS tab about Total messages, timeout and errors?

    • @Painless360
      @Painless360  5 лет назад +1

      GPS is perfect, it's the i2c bus that doesn't seem to initialise/transmit successfully ad I have also changed the i2c speed to no effect. It looks more and more like a H/W issue on the FC I'm using....

    • @Arhifisyant
      @Arhifisyant 5 лет назад +1

      @@Painless360 I got the same problem with my omnibus F4 v2, and general M8N gps with compass. My compass is not detected on inav 2.0., but, changing the i2c speed to lower speed, fix my issue. Im sorry i cant help you out...

    • @shythephotoguy
      @shythephotoguy 5 лет назад

      @@Painless360 big bummer, this GPS and flight controller communication technology can use some extra development to create some universal standard.

  • @steveedwards90
    @steveedwards90 5 лет назад

    Hi lee just a thought there are 2 version's of the hml5883 have you tried the other option in drop down selection qml?

    • @Painless360
      @Painless360  5 лет назад

      I have, sadly no luck - thanks for the idea! Happy flying!

  • @AhmetOmerOzgen
    @AhmetOmerOzgen 5 лет назад

    Do you calibrate compass while esc's are turned on?

    • @Painless360
      @Painless360  5 лет назад

      You normally calibrate the compass with the model powered but with the motors not running. See my latest Ardupilot series for tips on finding a great place for the compass where it won't be affected by stray magnetic fields..

  • @hansturpyn5455
    @hansturpyn5455 5 лет назад

    The plug or the connector on the compass? Voltage a bit to low?

    • @Painless360
      @Painless360  5 лет назад

      Thanks for the idea. Voltage is good - GPS runs at 5v, the HMC5883L runs at about 3v and the GPS is powered so there is enough for the voltage regulator on the GPS/Compass module to run too.. Thanks for the idea though..

  • @fpetev6925
    @fpetev6925 5 лет назад

    Hey Lee how do you select the external compass when the FC has the same type of compass built in? So far the only solution I can find is to manually remove the compass off the FC board, is that the best thing to do? Thanks

    • @Painless360
      @Painless360  5 лет назад

      You have to disable the on-board one. You can't have two i2c devices with the same ID..

    • @fpetev6925
      @fpetev6925 5 лет назад

      What's the best way to disable it.. desolder it? Thanks @@Painless360

    • @Painless360
      @Painless360  5 лет назад

      @@fpetev6925 probably. I used to shield the FC with NuMetal back in the day if it was too near the power wires..

  • @quetiano
    @quetiano 4 года назад

    Hi Painless360, I know that its been a while now from this video, however, did you find a solution to your problem ?
    I am a total beginner but I have picked up some info after changing settings in betaflight in cli, I managed to get all sensors to be detected in betaflight, however a few hangs of the FC now and then and one of the sensors, either baro or built in mag from gps doesnt work.
    According to my testing, on my mamba f405 mk2, i have just one set of psychical sda and scl pins, so after a few days of figuring it out and eventually finding the FC pin out table, I found the remapping pin tables and read that my uart 3 rx and tx can be remapped into i2c sda 2 and i2c scl 2 ports, which I did, and it worked, but what was actually preventing me from making the compass and baro work together in betaflight was the bustype, i2c addresses, i2c device, the speed of the i2c ports, the serialrx half duplex being on or off, and even the correct models of the baro and mag had to be set to have it all shown and working in betaflight 4.1.5. , but, either the baro did not function or the mag did not function even though they were showing that they were detected by betaflight. It was either that or betaflight halts , so I'm still trying to figure out what can cause the halt, its definitely FC configuration in cli.
    I think I might have to try pull up resistors because I tried a few things but no luck. I wanted to activate the SPI mode on the baro but there arent any pins for spi on the FC and it seems that my FC cant remap the spi protocol to other inputs that I can literately see, I dont know which pins the spi 1,2 or 3 are .

    • @Painless360
      @Painless360  4 года назад

      Yes, it was a software issue in iNav.. See my other recent iNav builds for kits that works better out of the box. Best of luck.

  • @nigellark
    @nigellark 5 лет назад

    Try "set i2c_speed=200kHz" or even 100kHz.

    • @yokonunz
      @yokonunz 5 лет назад

      This will higher the CPU usage and limit the looptime. Not a solution. I guess the issue is on the FC.

    • @nigellark
      @nigellark 5 лет назад

      That depends on if your gyro chip is i2c. Many modern flight controller boards use SPI connected motion sensors. If this is the case you can reduce i2c_speed without adversely affecting the looptime.

    • @Painless360
      @Painless360  5 лет назад

      I’ve tried that but thanks for the suggestion.. :)

  • @humbertomontalban3932
    @humbertomontalban3932 5 лет назад

    I founded that the best route in this is use hardware that are compatible to each other, and stick to it. I had inav on a SP racing F3 flight controller, and this has a compass incorporate, I found that the FC do not like magnetic fields, so keep all possible power wire away, and the omnibus f4 v2 and v3 work perfect with external gps compass combination.

    • @Painless360
      @Painless360  5 лет назад +1

      Agreed, see all my other iNav builds. This one is an experiment so handily does show some of the problems that you can run info..

    • @humbertomontalban3932
      @humbertomontalban3932 5 лет назад

      @@Painless360 yea experiments are fantastic but some time you go crazy. LOL

    • @Painless360
      @Painless360  5 лет назад

      This is the only experimental build on the entire channel so not sure how that constitutes 'crazy' ;) Happy flying! :D

    • @humbertomontalban3932
      @humbertomontalban3932 5 лет назад

      @@Painless360 Nothing is crazy, you doing one of the best channel in you tube, with 1000's of answers.

  • @alexis9200
    @alexis9200 5 лет назад

    That's where using chinese is a wrong place to buy your parts: if you need a replacement, you'll have to wait a month to see that it maybe not be this component the problem. So either ship more component twice or use local online/offline shop 👌

  • @steveedwards90
    @steveedwards90 5 лет назад

    hi lee just checked my hmc 5883l compass just uploaded vid my voltage is 5v ruclips.net/video/AklcIjBoeUY/видео.html

  • @Siamect
    @Siamect 5 лет назад

    I think you need an oscilloscope...

    • @Painless360
      @Painless360  5 лет назад +1

      Got one - see video ;)

    • @Siamect
      @Siamect 5 лет назад

      So... do you get any clock signal and data on the I2C bus? Can you see the address part of the message and does it match the address of your sensor?