1.1.1 • Published 4 years ago

mpu6050-gyro v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

mpu6050-gyro

A node driver for the MPU-6050 IMU. Tested and working on Raspberry pi.

Installation

npm install mpu6050-gyro

Usage

var gyro = require("mpu6050-gyro");

var address = 0x68; //MPU6050 address
var bus = 1; //i2c bus used

var gyro = new gyro( bus,address );

async function update_telemetry() {
	
	var gyro_xyz = gyro.get_gyro_xyz();
	var accel_xyz = gyro.get_accel_xyz();
	
	var gyro_data = {
		gyro_xyz: gyro_xyz,
		accel_xyz: accel_xyz,
		rollpitch: gyro.get_roll_pitch( gyro_xyz, accel_xyz )
	}
	
	console.log(gyro_data);
	
	setTimeout(update_telemetry, 500);
}

if ( gyro ) {
	update_telemetry();
}

Hardware setup

This driver reads MPU-6050 datas over I2C. Plug VCC to 3.3V ( pin #1 ), GND to GROUND ( pin #6 ), SDA to SDA ( pin #3 / GPIO 2 ), SCL to SCL ( pin #5 / GPIO 3 ).

RPI Wiring Diagram

Available Methods

gyro.get_gyro_xyz()
Returns JSON object with raw x,y,z datas from gyroscope.

gyro.get_accel_xyz()
Returns JSON object with raw x,y,z datas from accelerometer.

gyro.get_roll_pitch( gyro_xyz, accel_xyz )
Returns JSON object with roll and pitch in degrees.

Contributions

Pull requests welcome.

License

MIT

https://nodei.co/npm/mpu6050-gyro.png?downloads=true&downloadRank=true&stars=true

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago