Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
- uses: actions/checkout@v6
- uses: arduino/arduino-lint-action@v2
with:
library-manager: update
compliance: strict
3 changes: 1 addition & 2 deletions .github/workflows/arduino_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ jobs:
runTest:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/jsoncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
paths:
- '**.json'
pull_request:
paths:
- '**.json'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: json-syntax-check
uses: limitusus/json-syntax-check@v2
with:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.6.2] - 2026-01-03
- update GitHub actions
- update examples
- minor edits

## [0.6.1] - 2024-07-25
Co-authored-by: Maik Menz
- redo of **calibrate()** function, Kudos to Maik Menz.
Expand All @@ -17,7 +22,6 @@ Co-authored-by: Maik Menz
- update readme.md
- improve initialization


## [0.6.0] - 2024-06-22
- fix #54, calibrate() function, Kudos to jens-kuerten and MArimont3
- minor edits
Expand Down
2 changes: 1 addition & 1 deletion GY521.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: GY521.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.6.1
// VERSION: 0.6.2
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
// URL: https://github.com/RobTillaart/GY521

Expand Down
12 changes: 6 additions & 6 deletions GY521.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: GY521.h
// AUTHOR: Rob Tillaart
// VERSION: 0.6.1
// VERSION: 0.6.2
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
// URL: https://github.com/RobTillaart/GY521

Expand All @@ -11,7 +11,7 @@
#include "Wire.h"


#define GY521_LIB_VERSION (F("0.6.1"))
#define GY521_LIB_VERSION (F("0.6.2"))

const float GRAVITY = 9.80655;

Expand All @@ -32,10 +32,10 @@ const float GRAVITY = 9.80655;


// CONVERSION CONSTANTS
#define GY521_RAD2DEGREES (180.0 / PI)
#define GY521_DEGREES2RAD (PI / 180.0)
#define GY521_RAW2DPS (1.0 / 131.0)
#define GY521_RAW2G (1.0 / 16384.0)
#define GY521_RAD2DEGREES (180.0 / PI)
#define GY521_DEGREES2RAD (PI / 180.0)
#define GY521_RAW2DPS (1.0 / 131.0)
#define GY521_RAW2G (1.0 / 16384.0)


class GY521
Expand Down
2 changes: 1 addition & 1 deletion GY521_registers.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: GY521_registers.h
// AUTHOR: Rob Tillaart
// VERSION: see GY521.cpp
// VERSION: see GY521.cpp / CHANGELOG.md
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
// URL: https://github.com/RobTillaart/GY521
//
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2024 Rob Tillaart
Copyright (c) 2017-2026 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ It needs to be tested a lot more.
See changelog.md for latest updates.


#### 0.6.1
### 0.6.1

Improved **calibrate()** to support any angle.


#### 0.6.0
### 0.6.0

Fixed a bug in calibration function, making previous versions obsolete.


#### 0.5.0 Breaking change
### 0.5.0 Breaking change

Version 0.5.0 introduced a breaking change.
You cannot set the pins in **begin()** any more.
Expand All @@ -43,7 +43,7 @@ The user has to call **Wire.begin()** and can optionally set the Wire pins
before calling **begin()**.


#### Examples
### Examples

- **GY521_angle** read angleX, angleY, angleZ.
- **GY521_performance_calibrate.ino** determine calibration performance.
Expand All @@ -58,7 +58,7 @@ for analysis e.g. in a spreadsheet.
- **GY521_two_sensors** demo for two sensors.


#### Related
### Related

- https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf
- https://cdn.sparkfun.com/datasheets/Sensors/Accelerometers/RM-MPU-6000A.pdf register map.
Expand All @@ -82,7 +82,7 @@ From left to right
| 7 | INT | interrupt |


#### Address
### Address

AD0 connected to GND => 0x68
AD0 connected to VCC => 0x69
Expand All @@ -102,7 +102,7 @@ sensor can be calibrated in any angle.
**bool calibrate(times, angleX = 0, angleY = 0, inverted = false)**


#### Manual calibration
### Manual calibration

1. load and run calibration example
it shows a header containing 6 numbers and 10 lines of 8 numbers
Expand Down Expand Up @@ -209,7 +209,7 @@ One must explicitly call **read()** to get new values.

#### Experimental Pitch Roll and Yaw

Pitch Roll and Yaw is work in progress and should not be used for projects yet.
Pitch Roll and Yaw is **work in progress** and should not be used for projects yet.

- **float getPitch()** idem. May return any number.
If **setNormalize(true)** return value will be 0-359.999
Expand Down Expand Up @@ -250,7 +250,7 @@ Read the register PDF for the specific value and meaning of registers.
- check details registers - MPU-6000-Register-Map1.pdf


#### Error codes
### Error codes

| Error code | value | notes |
|:----------------------------|:-------:|:-------:|
Expand All @@ -261,7 +261,7 @@ Read the register PDF for the specific value and meaning of registers.
| GY521_ERROR_NOT_CONNECTED | -3 |


#### Sensitivity Acceleration
### Sensitivity Acceleration

The strength of Earth's gravity varies with latitude (equator = 0�, poles = 90�).
The standard value for gravity (gn) is 9.80665 m/s^2 (often 9.81 m/s^2)
Expand All @@ -278,7 +278,7 @@ The library provides the constant GRAVITY = 9.80655
| 3 | 16 g | 156.9048 |


#### Sensitivity Gyroscope
### Sensitivity Gyroscope

unit dps = degrees per second.

Expand All @@ -302,12 +302,11 @@ However if one specific is needed, please open an issue.

#### Must

- time
- improve documentation
- investigate Pitch Roll and Yaw math in detail.
- investigate math needed.
- implementation.
- when?
- improve documentation
- test test and test ...(ESP too)

#### Should
Expand Down
1 change: 1 addition & 0 deletions examples/GY521_angle/GY521_angle.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand Down
7 changes: 4 additions & 3 deletions examples/GY521_performance/GY521_performance.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: GY521_performance.ino
// AUTHOR: Rob Tillaart
// PURPOSE: minimal demo
// PURPOSE: performance measurements
// URL: https://github.com/RobTillaart/GY521

#include "GY521.h"
Expand All @@ -19,6 +19,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand All @@ -36,12 +37,12 @@ void loop()
uint32_t start = micros();
int16_t x = sensor.read();
uint32_t duration = micros() - start;

Serial.print(x);
Serial.print('\t');
Serial.print(duration);
Serial.println();

delay(1000);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: GY521_performance_calibrate.ino
// AUTHOR: Rob Tillaart
// PURPOSE: read angleX, angleY, angleZ
// PURPOSE: measure calibration performance
// URL: https://github.com/RobTillaart/GY521


Expand All @@ -17,6 +17,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand Down
5 changes: 4 additions & 1 deletion examples/GY521_pitch_roll_yaw/GY521_pitch_roll_yaw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// AUTHOR: Rob Tillaart
// PURPOSE: demo pitch roll yaw
// URL: https://github.com/RobTillaart/GY521

//
// WORK IN PROGRESS - not working well

#include "GY521.h"

Expand All @@ -19,7 +20,9 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();
Serial.println("warning: Pitch roll yaw is work in progress.");
Serial.println();

Wire.begin();

Expand Down
1 change: 1 addition & 0 deletions examples/GY521_raw_cooked/GY521_raw_cooked.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();
delay(100);
Expand Down
3 changes: 2 additions & 1 deletion examples/GY521_readCalibration_2/GY521_readCalibration_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();
delay(100);
Expand Down Expand Up @@ -77,7 +78,7 @@ void loop()
Serial.print("sensor.aze = ");
Serial.print(sensor.aze, 7);
Serial.print(";\n");

Serial.print("sensor.gxe = ");
Serial.print(sensor.gxe, 7);
Serial.print(";\n");
Expand Down
3 changes: 2 additions & 1 deletion examples/GY521_test_1/GY521_test_1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand All @@ -34,7 +35,7 @@ void setup()

sensor.setThrottle();
Serial.println("start...");

// set calibration values from calibration sketch.
sensor.axe = 0;
sensor.aye = 0;
Expand Down
1 change: 1 addition & 0 deletions examples/GY521_test_2/GY521_test_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand Down
1 change: 1 addition & 0 deletions examples/GY521_two_sensors/GY521_two_sensors.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void setup()
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION);
Serial.println();

Wire.begin();

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/GY521.git"
},
"version": "0.6.1",
"version": "0.6.2",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GY521
version=0.6.1
version=0.6.2
author=Rob Tillaart <[email protected]>
maintainer=Rob Tillaart <[email protected]>
sentence=Arduino library for GY521 angle measurement
Expand Down