How to Open I2C Bus

Forums General discussion How to Open I2C Bus

This topic contains 22 replies, has 4 voices, and was last updated by  PeterP 1 month ago.

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #4159

    Patrick
    Participant

    Hi again. I have a few problems:

    1) Unlike the other codes, why do I always have to CD into the library when running these executables:
    a) pi@raspberry~$ sudo./gyro_accelerometer_tutorial02
    b) pi@raspberry~$ sudo./compass_tutorial03

    Only these two tutorials don’t execute without having to CD.. while others work perfectly fine even if i type the executable straight after “pi@raspberrypi~$

    2) Calibration Questions

    a) Step 3 says “Stop the program with ‘Ctrl-C’ and you will see some definitions printed out in blue text which needs to be added to your compass program. E.g. compass_tutorial03.c in the above Git repository”

    –> I was able to get the definitions in blue text (pls see image). What do I do next? By “adding the values to compass program” means I have to replace the values below to the ones I got? Or do i simply just type the values i got under it? Pls help me understand.

    `#define magXmax 1210
    #define magYmax 1245
    #define magZmax 1178
    #define magXmin -1335
    #define magYmin -1142
    #define magZmin -1303

    b) Could you pls check if my “rawdatauncalibrated.txt” file has the right contents? (see image)

    c) The first two steps of plotting…

    Do i type it like this:
    pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt
    pi@raspberrypi ~ $ awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt

    Or like this:
    pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt
    awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt

    3) How can I rotate the compass display by 90 degrees … i’m using an led tv so it’s displaying in landscape orientation, how can i make it portrait.

    Thanks a lot.

    #4165

    Mark Williams
    Keymaster

    2 A) The values already in the code are the calibration data for my BerryIMU. You replace these values with the data from your calibration results.
    2 B) I checked both images and that data looks good in both.
    2 C)Use the first example.
    Run the code with the command below for a few minutes. While it is running rotate the BerryIMU in all directions to try and gather as much information as you can.
    pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt

    You then need to remove the first and last line before plotting it with Mathematica, you can do this manually or you can use this command;
    awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt

    Mark --OzzMaker.com --

    #7383

    ilyas
    Participant

    I purchased BerryGPS-IMU a few weeks ago. I have no problem using GPS. But when i try to use IMU i2c addresses not detected. I attached the screen shoot.

    I made the settings as indicated on the link below. But I did not succeed.

    How to Enable i2c on the Raspberry Pi

    Could you please help me.

    #7387

    PeterP
    Participant

    Can you please show me the output of these commands;

    ls -l /dev/ic*
    
    lsmod | grep i2c
    
    grep i2c  /boot/config.txt

    Peter --OzzMaker.com --

    #7388

    ilyas
    Participant

    pi@raspberrypi:~ $ ls -l /dev/ic*
    ls: cannot access ‘/dev/ic*’: No such file or directory

    pi@raspberrypi:~ $ lsmod | grep i2c
    i2c_bcm2835 16384 0
    i2c_bcm2708 16384 0
    i2c_dev 16384 0

    pi@raspberrypi:~ $ grep i2c /boot/config.txt
    # dtparam=i2c_arm=on
    # dtparam=i2c1=on
    dtparam=i2c_arm=on
    dtparam=i2c1=on

    thanks for your help.

     

    #7389

    PeterP
    Participant

    i2c isn’t actually enabled..
    I see that you have the new Pi 3+… maybe our instructions don’t work with that model Pi.. I will need to test.

    Trying enable i2c using sudo raspi-config. It is under interface options

    Peter --OzzMaker.com --

    #7391

    ilyas
    Participant

    I did it, but the result is the same.

    #7392

    PeterP
    Participant

    I double checked the commands above and I made a typo. Please show me the output of;

    pi@raspberrypi:~ $ ls -l /dev/i2*

    You should see this;

    pi@raspberrypi:~ $ ls -l /dev/i2*
    crw-rw---- 1 root i2c 89, 1 Jun 15 10:17 /dev/i2c-1
    pi@raspberrypi:~ $

    If you do, then your IMU isn’t working. and you need to contact sales< at > ozzmaker.com

    Peter --OzzMaker.com --

Viewing 8 posts - 16 through 23 (of 23 total)

You must be logged in to reply to this topic.

Blip, blop, bloop…