Home › Forums › Forums › General discussion › How to Open I2C Bus
- This topic has 22 replies, 4 voices, and was last updated 5 years, 3 months ago by PeterP.
- AuthorPosts
- June 23, 2015 at 5:15 am #4159PatrickParticipant
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 -1303b) 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.txtOr like this:
pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt
awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt3) 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.
June 23, 2015 at 9:24 pm #4165Mark WilliamsKeymaster2 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 --
June 15, 2018 at 12:01 am #7383ilyasParticipantI 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.
Could you please help me.
June 15, 2018 at 12:48 pm #7387PeterPParticipantCan you please show me the output of these commands;
ls -l /dev/ic* lsmod | grep i2c grep i2c /boot/config.txt
Peter --OzzMaker.com --
June 15, 2018 at 6:27 pm #7388ilyasParticipantpi@raspberrypi:~ $ ls -l /dev/ic*
ls: cannot access ‘/dev/ic*’: No such file or directorypi@raspberrypi:~ $ lsmod | grep i2c
i2c_bcm2835 16384 0
i2c_bcm2708 16384 0
i2c_dev 16384 0pi@raspberrypi:~ $ grep i2c /boot/config.txt
# dtparam=i2c_arm=on
# dtparam=i2c1=on
dtparam=i2c_arm=on
dtparam=i2c1=onthanks for your help.
June 15, 2018 at 7:09 pm #7389PeterPParticipanti2c 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 optionsPeter --OzzMaker.com --
June 16, 2018 at 5:53 am #7391ilyasParticipantI did it, but the result is the same.
June 16, 2018 at 1:58 pm #7392PeterPParticipantI 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 --
- AuthorPosts
- You must be logged in to reply to this topic.