Content-Length: 457040 | pFad | http://github.com/DavidEGrayson/minimu9-ahrs/commit/fc601d3e115950f90c23c4110c1a5bb80418f847

38 Add support for the LSM6DSO and change the version number to 4.0.0. · DavidEGrayson/minimu9-ahrs@fc601d3 · GitHub
Skip to content

Commit

Permalink
Add support for the LSM6DSO and change the version number to 4.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEGrayson committed Jul 11, 2023
1 parent 36407a6 commit fc601d3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 53 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**minimu9-ahrs** is a program for reading sensor data from the Pololu MinIMU-9
and similar boards over I²C. It supports the following sensor chips:

* LSM6DSO
* LSM6DS33 accelerometer and gyro
* LIS3MDL magnetometer
* LSM303D magnetometer and accelerometer
Expand All @@ -16,8 +17,8 @@ and similar boards over I²C. It supports the following sensor chips:
This program works with any board that has a magnetometer, acceleromter, and a
gyro from the list above. This includes the following Pololu products:

* MinIMU-9 [v0][mv0], [v1][mv1], [v2][mv2], [v3][mv3], [v5][mv5]
* AltIMU-10 [v3][av3], [v4][av4], [v5][av5]
* MinIMU-9 [v0][mv0], [v1][mv1], [v2][mv2], [v3][mv3], [v5][mv5], [v6][mv6]
* AltIMU-10 [v3][av3], [v4][av4], [v5][av5], [v6][av6]
* [Balboa 32U4 Balancing Robot Kit][balboa]

The program can output the raw sensor data from the magnetometor, accelerometer,
Expand Down Expand Up @@ -51,8 +52,8 @@ distribution.
Here are some other related resources that might be useful for you when
figuring out how to enable I²C:

* [Configuring Your Pi for I²C by Adafruit](http://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/configuring-your-pi-for-i2c/)
* [Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi](http://ozzmaker.com/berryimu/)
* [Configuring Your Pi for I²C by Adafruit](https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/configuring-your-pi-for-i2c/)
* [Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi](https://ozzmaker.com/berryimu/)

### Managing device permissions

Expand Down Expand Up @@ -279,19 +280,27 @@ and a precise description of its output format, view the man page by running

## Version history

- 4.0.0 (2023-07-11):
- Added support for the MinIMU-9 v6 (LSM6DSO and LIS3MDL).
- Changed the default I²C bus to /dev/i2c-1 to better serve Raspberry Pi users.
- Updated the minimu9-ahrs-calibrator script to use Python 3.
- 3.0.0 (2017-04-15):
- Added support for the MinIMU-9 v5 (LSM6DS33 and LIS3MDL).
- Added support for a configuration file at `~/.minimu9-ahrs`.
- Fixed a bug that resulted in corrections from the accelerometer always being applied
even if the acceleration magnitude was not close to 1 g (thanks nxdefiant).
- Use a Linux timerfd for more accurate timing (thanks to nxdefiant for the idea).
- Made the `minimu9-ahrs-calibrate` script store the raw data in `~/.minimu9-ahrs-cal-data`.
- Changed the minimu9-ahrs-calibrator Python script to just do simple minima/maxima because the fancy optimization algorithm was not reliable.
- Changed the minimu9-ahrs-calibrator Python script to just do simple minima/maxima
because the fancy optimization algorithm was not reliable.
- Fixed the way boost_program_options is linked.
- Expanded the README so it can replace the wiki.
- 2.0.0 (2014-07-08):
- Added support for the MinIMU-9 v3 (LSM303D and L3GD20H)
- Removed the right-shifting of raw accelerometer outputs; the raw readings are now signed 16-bit numbers that can range from -32768 to 32767. Previously the readings were signed 12-bit numbers, so this new version effectively gives readings that are greater by a factor of 16.
- Removed the right-shifting of raw accelerometer outputs; the raw readings are now
signed 16-bit numbers that can range from -32768 to 32767. Previously the readings
were signed 12-bit numbers, so this new version effectively gives readings that
are greater by a factor of 16.
- Changed the minimu9-ahrs-calibrator Python script to use SciPy instead of the old optimization algorithm.
- Changed the minimu9-ahrs-calibrator script to print a warning if there are fewer than 300 input vectors instead of exiting.
- Changed the minimu9-ahrs-calibrator script to print a warning if the calibration looks wrong.
Expand All @@ -306,11 +315,13 @@ and a precise description of its output format, view the man page by running
[av3]: https://www.pololu.com/product/2469
[av4]: https://www.pololu.com/product/2470
[av5]: https://www.pololu.com/product/2739
[av6]: https://www.pololu.com/product/2863
[mv0]: https://www.pololu.com/product/1264
[mv1]: https://www.pololu.com/product/1265
[mv2]: https://www.pololu.com/product/1268
[mv3]: https://www.pololu.com/product/2468
[mv5]: https://www.pololu.com/product/2738
[mv6]: https://www.pololu.com/product/2862
[balboa]: https://www.pololu.com/product/3575
[ffwires]: https://www.pololu.com/catalog/category/66
[wiring_pic]: http://www.davidegrayson.com/minimu9-ahrs/wiring.jpg
Expand Down
14 changes: 5 additions & 9 deletions lsm6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ void lsm6::handle::open(const comm_config & config)

void lsm6::handle::enable()
{
if (config.device == LSM6DS33)
if (config.device == LSM6DS33 || config.device == LSM6DSO)
{
//// LSM6DS33 gyro
//// LSM6DS33/LSM6DSO gyro

// ODR = 1000 (1.66 kHz (high performance))
// FS_G = 11 (2000 dps)
Expand All @@ -25,11 +25,10 @@ void lsm6::handle::enable()
// defaults
write_reg(CTRL7_G, 0b00000000);

//// LSM6DS33 accelerometer
//// LSM6DS33/LSM6DSO accelerometer

// ODR = 1000 (1.66 kHz (high performance))
// FS_XL = 11 (8 g full scale)
// BW_XL = 00 (400 Hz filter bandwidth)
write_reg(CTRL1_XL, 0b10001100);

//// common
Expand All @@ -51,8 +50,7 @@ void lsm6::handle::write_reg(reg_addr addr, uint8_t value)
void lsm6::handle::read_gyro()
{
uint8_t block[6];
i2c.write_byte_and_read(config.i2c_address,
OUTX_L_G, block, sizeof(block));
i2c.write_byte_and_read(config.i2c_address, OUTX_L_G, block, sizeof(block));
g[0] = (int16_t)(block[0] | block[1] << 8);
g[1] = (int16_t)(block[2] | block[3] << 8);
g[2] = (int16_t)(block[4] | block[5] << 8);
Expand All @@ -61,10 +59,8 @@ void lsm6::handle::read_gyro()
void lsm6::handle::read_acc()
{
uint8_t block[6];
i2c.write_byte_and_read(config.i2c_address,
OUTX_L_XL, block, sizeof(block));
i2c.write_byte_and_read(config.i2c_address, OUTX_L_XL, block, sizeof(block));
a[0] = (int16_t)(block[0] | block[1] << 8);
a[1] = (int16_t)(block[2] | block[3] << 8);
a[2] = (int16_t)(block[4] | block[5] << 8);
}

36 changes: 1 addition & 35 deletions lsm6.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace lsm6
enum device_type
{
LSM6DS33 = 0x69,
LSM6DSO = 0x6C,
};

enum i2c_addr
Expand All @@ -18,15 +19,6 @@ namespace lsm6

enum reg_addr
{
FUNC_CFG_ACCESS = 0x01,

FIFO_CTRL1 = 0x06,
FIFO_CTRL2 = 0x07,
FIFO_CTRL3 = 0x08,
FIFO_CTRL4 = 0x09,
FIFO_CTRL5 = 0x0A,
ORIENT_CFG_G = 0x0B,

INT1_CTRL = 0x0D,
INT2_CTRL = 0x0E,
WHO_AM_I = 0x0F,
Expand All @@ -41,9 +33,6 @@ namespace lsm6
CTRL9_XL = 0x18,
CTRL10_C = 0x19,

WAKE_UP_SRC = 0x1B,
TAP_SRC = 0x1C,
D6D_SRC = 0x1D,
STATUS_REG = 0x1E,

OUT_TEMP_L = 0x20,
Expand All @@ -63,29 +52,6 @@ namespace lsm6

FIFO_STATUS1 = 0x3A,
FIFO_STATUS2 = 0x3B,
FIFO_STATUS3 = 0x3C,
FIFO_STATUS4 = 0x3D,
FIFO_DATA_OUT_L = 0x3E,
FIFO_DATA_OUT_H = 0x3F,
TIMESTAMP0_REG = 0x40,
TIMESTAMP1_REG = 0x41,
TIMESTAMP2_REG = 0x42,

STEP_TIMESTAMP_L = 0x49,
STEP_TIMESTAMP_H = 0x4A,
STEP_COUNTER_L = 0x4B,
STEP_COUNTER_H = 0x4C,

FUNC_SRC = 0x53,

TAP_CFG = 0x58,
TAP_THS_6D = 0x59,
INT_DUR2 = 0x5A,
WAKE_UP_THS = 0x5B,
WAKE_UP_DUR = 0x5C,
FREE_FALL = 0x5D,
MD1_CFG = 0x5E,
MD2_CFG = 0x5F,
};

struct comm_config {
Expand Down
2 changes: 1 addition & 1 deletion minimu9-ahrs.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ minimu9-ahrs - read data from the Pololu MinIMU-9 over I²C
.B minimu9-ahrs [\fIOPTIONS\fP]
.SH DESCRIPTION
minimu9-ahrs is a program for reading data from the Pololu MinIMU-9 over I²C.
It supports MinIMU-9 versions v0, v1, v2, v3, and v5.
It supports MinIMU-9 versions v0, v1, v2, v3, v5, and v6.
The program can output the raw sensor data from the magnetometer, accelerometer,
and gyro or it can use that raw data to compute the orientation of the IMU.
.P
Expand Down
2 changes: 1 addition & 1 deletion minimu9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minimu9::comm_config minimu9::auto_detect(const std::string & i2c_bus_name)
for (uint8_t addr : addrs)
{
int result = bus.try_write_byte_and_read_byte(addr, lsm6::WHO_AM_I);
if (result == lsm6::LSM6DS33)
if (result == lsm6::LSM6DS33 || result == lsm6::LSM6DSO)
{
config.lsm6.use_sensor = true;
config.lsm6.device = (lsm6::device_type)result;
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "3.0.0"
#define VERSION "4.0.0"

0 comments on commit fc601d3

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/DavidEGrayson/minimu9-ahrs/commit/fc601d3e115950f90c23c4110c1a5bb80418f847

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy