npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mpu6050-gyro

v1.1.1

Published

Reads roll and pitch from a mpu6050

Downloads

49

Readme

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