June 17, 2018 at 5:10 pm #7394
A observation on GRYX/Y/Z angle numbers is that they accumulate over time. They never gave me a different number when moving the raspberry with the BerryIMU on the pins.
The ACCX and ACCY do give other readings when moving the pi.
Also the CFangleX and CFangleY give different readings when moving.
Using the gyro readings on my Iphone I do get different readings on X,Y,Z when moving the iphone.
What is wrong with my assumption that I expect change in readings on x,y,z with BerryIMU?
Attached my berryIMUsimple.py
ACCX Angle 179.75 ACCY Angle -175.49 GRYX Angle -668.20 GYRY Angle 743.21 GYRZ Angle -471.04 CFangleX Angle 179.37 CFangleY Angle -175.10 HEADING 105.00 tiltCompensatedHeading 100.25June 17, 2018 at 5:11 pm #7395June 17, 2018 at 7:35 pm #7397Mark WilliamsKeymaster
can you please attached the first 200 lines of the program output. From this output i will be able to get more information
Please have the IMU laying flat and not moving.
Mark --OzzMaker.com --June 20, 2018 at 1:33 am #7410June 20, 2018 at 11:51 am #7414
They gyro readings look good.
The accelerometer readings don't look good.
Are you running this on a Raspberry Pi? Has the code been modified in anyway?
Is it up the correct way? this is when the skull logo is facing down.
We need to have a look at the raw values for the accelerometer;
Just after this section of code;
ACCx = IMU.readACCx() ACCy = IMU.readACCy() ACCz = IMU.readACCz() GYRx = IMU.readGYRx() GYRy = IMU.readGYRy() GYRz = IMU.readGYRz() MAGx = IMU.readMAGx() MAGy = IMU.readMAGy() MAGz = IMU.readMAGz()
can you add an extra line as shown below;`
ACCx = IMU.readACCx()
ACCy = IMU.readACCy()
ACCz = IMU.readACCz()
GYRx = IMU.readGYRx()
GYRy = IMU.readGYRy()
GYRz = IMU.readGYRz()
MAGx = IMU.readMAGx()
MAGy = IMU.readMAGy()
MAGz = IMU.readMAGz()
print ("accXYZ %i %i %i ") % (ACCx,ACCy,ACCz),`June 20, 2018 at 3:38 pm #7415June 20, 2018 at 3:39 pm #7417
skull is not upside down.
Attachments:June 20, 2018 at 4:19 pm #7419
You need to make some modifications to the code. Have a look at berryimu.py in the same folder, it has comments within on what needs to be done.June 20, 2018 at 4:30 pm #7420
"some modifications" is a bit too fage.
Do I need to make all the suggested modifications bcz of the skull upside down issue?
"what is meant by upside down? : skull is not visible at all or it is not facing the same as on your assembly pages/instructions?
Bcz the latter is the case with mine BerryIMU.
adJune 20, 2018 at 5:23 pm #7421
yes. make all of the changes.
When the skull logo is underneath and the chips on top, this is the correct orientation.
When the skull logo is on top and the chips are underneath, this is upside down.June 21, 2018 at 1:05 am #7422
I have made the neccessary changes in the code for upside down.
Funny that a gyro , which is upside down or not influences the readings?
So the gyro should not go head over heels?
the "+=" is the reason why the gyroXangle is accumulating!
is this correct?
adriaanJune 21, 2018 at 12:14 pm #7428Mark WilliamsKeymaster
no need to change gyro calcs.
Regarding the accumulating of the gyro readings. This is normal, this is due to the noise from the gyro sensor. This is why the gyro and accel readings are fused to get a accurate result.
The values you need to use are CFangleX and CFangleY. CF = complementary filter.
You can see that the complementary filter doesn't use the accumulated gyro value, it only uses the rate of rotation since since the last loop.
rate_gyr_x*LPThis is rate of gyro x rotation (degrees per second) since the last reading. multiple this by the loop time.
#Complementary filter used to combine the accelerometer and gyro values. CFangleX=AA*(CFangleX+rate_gyr_x*LP) +(1 - AA) * AccXangle CFangleY=AA*(CFangleY+rate_gyr_y*LP) +(1 - AA) * AccYangle
more info here
Mark --OzzMaker.com --June 21, 2018 at 6:54 pm #7430
The usage for the GYRO readings is to monitor the swing of my caravan/trailer.
I want the PI in my caravan and send readings via websocket server on the pi ( via wifi) to my iPhone app ( a websocket client) in my car.
The iPhone app will then render the readings into graphs or warning signals when the x or y is too large, meaning the caravan is swinging to much, please break.
For this I can use the X and Y readings only, right?
adJune 21, 2018 at 7:33 pm #7431
- You must be logged in to reply to this topic.