Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
nodejs-qmc5883l
Advanced tools
10.X - 12.X
!!!This is a simple NodeJS module that talks to the DA5883 magnetometer (on the QMC5883L board). You can install it by running npm install --save nodejs-qmc5883l
. Every magnetometer reading is a bit mistaken (caused e.g. by soft and hard iron effect), but that can be corrected by calibrating the compass. Calibration gives you an offset matrix and a scale matrix that needs to be applied on raw magnetometer data before any further computation. To do this, run node calibrate
in the module's main directory, rotate the magnetometer in all directions until the script finishes running and the matrixes will be printed in the console, and then call setOffsetMatrix
and setScaleMatrix
on the module object. After doing so, you can read the compensated data via the readCorrectedData()
function (if you use the readAzimuth
function, then the azimuth is computed on the already compensated data).
The module is very simple - it provides three methods:
Before you start Simply require the module library and assign it to a variable:
var compass = require("nodejs-qmc5883l");
1. initialize()
2. readRawData()
3. readCorrectedData()
4. setOffsetMatrix(offsetX, offsetY, offsetZ)
5. setScaleMatrix(scaleX, scaleY, scaleZ)
6. readAzimuth()
7. setDeclinationAngle(declinationAngle)
A functional example is located in the test.js file in the module's main directory (you can also run it by executing npm run test
in it).
The module works on the Raspberry PI 3 (tested) on NodeJS 8, but You can clone the repo and change the proper fields (I2C bus device path, I2C device address, I2C device register, etc.) in the binding.cc & other files, so that it is compatible with Your device.
The module utilises Jeff Rowberg's I2Cdev library for talking to I2C devices and uses modified parts of code from MechaQMC5883 library, which contains all needed register addresses. The calibration code is based on the one used in this HMC5883 library.
This project is licensed under the GNU General Public License v3. You're allowed to clone the code, modify it and use provided that You mention the author (artus9033) and provide a link to this repository.
FAQs
A NodeJS driver for the QMC5883L magnetometer
We found that nodejs-qmc5883l demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.