Tilt Compensated Digital Compass based on AVR

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • A simple, easy to build eCompass display using AVR ATmega8, HMC5883L magnetometer module, Accelerometer of MPU6050 module and 128x64 SSD1306 OLED display module.
    For Source Code with detailed description and build instruction, visit the project page at github:
    github.com/vis...
    Link to Circuit Diagram:
    raw.githubuser...

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

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

    Very interesting project. Thanks for sharing the code. I plan to modify for my dual axis solar tracker and replace the LDRs.

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

      Good luck with your project

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

      @@MrFrisky88 Thanks again. For anyone else interested in trying this with the QMC5883L, I found header and parameter files. I'm not smart enough to do, so thanks to the author of these also.: api.riot-os.org/dir_5cce5766881baaa3953e3e6827950470.html

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

    Thanks for the video sir. Your source code helped me a lot. I did this with arduino for rapid prototyping purpose.

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

      What changes did you make to the code? I'm trying to do the same. I did find the address for my HMC5883 was 0x0D, but still not working.

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

      @@xt1200z1 it can be qmc5883l chip. registry address are different.

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

      @@kadrimetin Right, found the datasheet and got the correct registers, think also the LSB and MSB are backwards plus the order X,Y,Z. All is working now with atmega328p but compass is not correct. Thinking the data coming from the qmc5883l is different from the original HMC5883L.

    • @251piyushbandre3
      @251piyushbandre3 5 месяцев назад

      Please provide me hex file of this code

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

    Perfect, it cost me only 10$. Nice project!

    • @251piyushbandre3
      @251piyushbandre3 5 месяцев назад

      Please provide me hex file of this code

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

    Thanks for sharing, very useful.

    • @251piyushbandre3
      @251piyushbandre3 5 месяцев назад

      Please provide me hex file of thus code please 🙏🏻

  • @251piyushbandre3
    @251piyushbandre3 6 месяцев назад

    Code was running in arduino IDE software?

  • @thomazedson2761
    @thomazedson2761 4 года назад +1

    Good evening,
    it is possible for this code to run on the arduino displaying the azimuth and pitch roll information on the serial monitor.
    thanks.

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

      Sorry, code needs modification to send output through serial port.

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

      would it be possible for you to show me how to modify?

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

      It's very important to me.

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

      help me please

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

      thomazedson882@gmail.com

  • @gemeus
    @gemeus 6 лет назад +1

    Nice work,
    I wonder to understand how does it works. Did you require a MPU6050 calibration to get the readings ? i was doing some tests and nothig was like your results.

    • @MrFrisky88
      @MrFrisky88  6 лет назад +1

      I did not calibrate the magnetometer (HMC5883L), but calibration is needed for correcting any magnetic field present in the area. So this is not a perfect solution and may not be very accurate for all case.
      MPU6050 is used to get accelerometer reading only and calibration is not needed for this application.
      If you examine the code, I have only applied the standard method given by application notes for tilt compensation using magnetometer and accelerometer readings.

    • @251piyushbandre3
      @251piyushbandre3 5 месяцев назад

      Please provide me hex file of thus code 🙏🏻

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

    HELP: Hi, i tried the code and everything but when i run the make all command, i keep getting error "../../common/ssd1306/ssd1306.c:467: warning: 'y' may be used uninitialized in this function"
    Please assist.

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

      It's fine. This is not an error, only a warning that you can ignore. The output hex file will be generated anyway.

    • @251piyushbandre3
      @251piyushbandre3 5 месяцев назад

      Please provide me hex file of thus code

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

    Hi
    Thanks for code and schematic diagram. It is possible for this code to run on some slightly larger display?

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

      This code will work only for SSD1306 display.

  • @xmj1131
    @xmj1131 6 лет назад

    Yes, do you have time to record the whole process of production? Thanks

    • @MrFrisky88
      @MrFrisky88  6 лет назад

      Sorry, I could not record making this, but it is only a matter of soldering these components together according to the circuit diagram.

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

    Help please. I got the error "cannot set sck period. Upgrade usb firmware "

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

      I guess you can ignore this error and should not be affecting the programming of the chip. (This happens due to the programmer having Chinese firmware which sets SCK automatically)

  • @_a.z
    @_a.z 3 года назад

    Are there actually any ecompassing chips available today??
    It seems that the market is in limbo between obsolete and very long lead times, apart from all the dev PCB's!

    • @MrFrisky88
      @MrFrisky88  3 года назад +1

      There are many chips having 3D accelerometer + 3D Magnetometer integrated to function as eCompass (like LSM303 from ST). But they are usually available in LGA package, difficult to hand solder. So using their dev. board is ideal for small project like this.
      As for the availability, I have no knowledge of the current situation.

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

    Hey, nice project you've made here, What are the configurations of the sensors you have used? Both for the magnetometer and the accelerometer?

    • @MrFrisky88
      @MrFrisky88  4 года назад +1

      Magnetometer (HMC5883L):
      Continuous Measurement mode, Output rate: 15Hz
      Gain: +/- 1.9 Ga, Averaging: 8 samples
      Accelerometer (from MPU6050):
      MPU6050 is configured in Accelerator only low power mode.
      Accelerometer full scale range: +/- 16g

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

    Hello. The HMC5883L compass X or Y which one will point magnetic north?.

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

      X and Y reading from HMC5883L are used to calculate the Magnetic north direction.
      If you hold the module with X arrow directly pointing to North, the X reading will be maximum and Y reading = 0. Similarly if you point Y arrow to North, Y reading = Maximum and X = 0. So, X and Y reading varies according to the module orientation. From the X, Y reading you can find the Azimuth angle, that is angle between Magnetic north and Forward direction. Here, X arrow of the module is used as forward direction. So, if you get Azimuth = 90 deg, you are holding the module with X arrow pointing directly at East.

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

      MCUatWork so in the video X is pointing North, Y is pointing West. is that correct? 0:43

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

      @@sukhee5 No, at 0:43 X is pointing West and Y is pointing South.

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

      @@sukhee5 In this datasheet:
      www.jameco.com/jameco/products/prodds/2150248.pdf
      on page 21, 22 you can find the formula for Azimuth for different conditions of X and Y.

  • @anupteke2007
    @anupteke2007 6 лет назад

    Hi, Thanks for uploading videos and code. I just want to know whether its possible to get Pitch or Roll in +180 to -180? Currently its + 90 to -90 Degree...

    • @MrFrisky88
      @MrFrisky88  6 лет назад

      The formula used here for finding Pitch and Roll gives result in the range -90 to 90 only (which sufficient for tilt compensation calculations). To get full 3D rotation angles you will need to change the formula, which I don't have enough knowledge about. I think you can easily find some implementation by little bit of search. Good luck.

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

      Hi could you show me how to programme this?

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

    What is that P and R given on the oled display ?

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

    Cool project, but isn't the needle supposed to rotate in the other direction, so that the needle is stationary? 🤔

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

      Right, the dial should have rotated keeping the needle at centre. But that would take more program memory. For this program, ATmega8 took almost the whole flash memory.

  • @shlokjadhav2005
    @shlokjadhav2005 4 года назад +1

    And what is H ?

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

    Hi.
    Thanks for code. I copied your code, compiled, did everything by the same way, BUT compass is changing when I'm tilting it.
    I can't understand what I'm doing wrong.
    I'm working in Atmel Studio (Windows) , I'll send you my project, circuit pictures,.can you help me please? I'm begging you, please.

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

      Hi, I guess the magnetometer and accelerometer modules are not aligned perfectly. Make sure that X-axis of magnetometer and accelerometer point in the same direction.

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

      @@MrFrisky88 Hi. I aligned them .
      May I add you in skype and send my circuit pictures, code ? Please?

    • @MrFrisky88
      @MrFrisky88  4 года назад +1

      @@emmetray9703 ok, may be email is enogh

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

      @@MrFrisky88 Thank you !
      tell me your email please,
      my email is "giorgigelava@yahoo.com"

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

    Hi, will this work with just the MPU-9250 alone?

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

      MPU9250 alone is sufficient for the project. But additional code for MPU9250 is required to retrieve magnetometer and accelerometer readings.

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

      @@MrFrisky88 that sounds great! My first tablet had a working compass, which allowed me to use Google Sky Map. My current tablets don't have a compass. I was wondering if there was a way to get Sky Map to see the MPU-9250 ,so that my tablet will show me what star my telescope is pointed at?

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

      @@WagonLoads Great idea. Though, I don't know how you would pass the sensor data to the tablet so it can be used by Sky Map. May be you could use Bluetooth (BLE).

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

    Works like a charm. Is possible change MPU6050 for ADXL345? Can you help me?

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

      Yes, an ADXL345 accelerometer module can be connected instead of MPU6050 module. Code needs to be adjusted for accessing registers of ADXL345. I don't have a module with me and also need to refer the datasheet of ADXL345 to know more.

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

      @@MrFrisky88 Ok. I will be try. Thanks!

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

      Hello. This code works directly on Arduino ? Thanks!

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

      Hi, if it works on ATmega8, it should definitely work on Arduino. Unfortunately, I never worked on Arduino platform, but only with C on AVRs. I think, creating an Arduino project with the source code of this project should work without any problem. Try it.

  • @sankarsaikumar7701
    @sankarsaikumar7701 6 месяцев назад

    I want this product brother

  • @7grounds
    @7grounds 6 лет назад

    will this compass work when installed on a vertical wall

    • @MrFrisky88
      @MrFrisky88  6 лет назад

      When this compass is installed with its flat face parallel to the wall, the tilt will be 90 degrees (roll or pitch). But the readings will never show 90 degrees. That's a problem in this case. It will show a reading near to 90 deg (85 to 89) for roll or pitch. I think it will be better to install the board perpendicular to vertical wall (parallel to ground) and place the OLED display for vertical reading.

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

    Can I buy that one from you??
    please I'm serious message me back.
    Thank you

    • @MrFrisky88
      @MrFrisky88  4 года назад +1

      Sorry, I don't have this one with me now. Anyway shipping cost will be much more than cost to build this. I guess you can build this without much difficulty.

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

      MCUatWork I just ordered the parts 👍🏼

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

    Ok