Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional examples #3

Open
sandeepmistry opened this issue Jul 25, 2019 · 7 comments
Open

Additional examples #3

sandeepmistry opened this issue Jul 25, 2019 · 7 comments

Comments

@sandeepmistry
Copy link
Contributor

Suggested by @tigoe:

  • six faces (you did this for the Curie as I recall)
  • accelerometer tap
  • gyroscope as a knob, rotating around the Z axis
@tigoe
Copy link

tigoe commented Aug 4, 2019

Here's an example with the Madgwick library that I tested with the Processing visualizer sketch in the Madgwick folder. It's delivering pretty good results, someone else might want to test it:

#include <Arduino_LSM6DS3.h>
#include <MadgwickAHRS.h>

// initialize a Madgwick filter:
Madgwick filter;
// sensor's sample rate is fixed at 104 Hz:
const float sensorRate = 104.00;

void setup() {
  Serial.begin(9600);
  // attempt to start the IMU:
  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU");
    // stop here if you can't access the IMU:
    while (true);
  }
  // start the filter to run at the sample rate:
  filter.begin(sensorRate);
}

void loop() {
  // values for acceleration & rotation:
  float xAcc, yAcc, zAcc;
  float xGyro, yGyro, zGyro;
  
  // values for orientation:
  float roll, pitch, heading;
  // check if the IMU is ready to read:
  if (IMU.accelerationAvailable() &&
      IMU.gyroscopeAvailable()) {
    // read accelerometer & gyrometer:
    IMU.readAcceleration(xAcc, yAcc, zAcc);
    IMU.readGyroscope(xGyro, yGyro, zGyro);
    
    // update the filter, which computes orientation:
    filter.updateIMU(xGyro, yGyro, zGyro, xAcc, yAcc, zAcc);

    // print the heading, pitch and roll
    roll = filter.getRoll();
    pitch = filter.getPitch();
    heading = filter.getYaw();
    Serial.print("Orientation: ");
    Serial.print(heading);
    Serial.print(" ");
    Serial.print(pitch);
    Serial.print(" ");
    Serial.println(roll);
  }
}

@tigoe
Copy link

tigoe commented Aug 4, 2019

Updated the madgwick example to use handshaking, and added a p5.js visualizer sketch that works with it:
arduino sketch with handshaking
p5.js visualizer

@tigoe
Copy link

tigoe commented Aug 25, 2019

Here's an update on the p5.js visualizer. Added some content to explain it.

@tkhabia
Copy link

tkhabia commented Feb 29, 2020

hello,
I am Tanmay khabia from IIIT Hyderabad. I have worked on various sensors and uses them for various IoT projects.
I wish to work on this issue as a GSoC project.
what is meant by six faces?
which direction are we tapping from on the sensor?
thank you

@tigoe
Copy link

tigoe commented Feb 29, 2020

Six faces means six possible orientations of the board. See https://www.arduino.cc/en/Tutorial/Genuino101CurieIMUAccelerometerOrientation for an example of it.

tkhabia added a commit to tkhabia/Arduino_LSM6DS3 that referenced this issue Mar 7, 2020
added AccelerometerTap code.
@tkhabia
Copy link

tkhabia commented Mar 7, 2020

please guide me if you want further improvement in the pull request.

tkhabia added a commit to tkhabia/Arduino_LSM6DS3 that referenced this issue Mar 17, 2020
resolved the requested changes.
tkhabia added a commit to tkhabia/Arduino_LSM6DS3 that referenced this issue Mar 17, 2020
@MisterAwesome23
Copy link

Hey @sandeepmistry :)

For task 3- Gyroscope as a knob, rotating around the Z axis
Do we need something like- https://www.youtube.com/watch?v=vSKEH0FwhUE

Just instead of controlling a servo via the same, do we need to values on Serial Monitor (and keep things simpler) to get orientations as we move our knob (LSM6DS3).

tkhabia added a commit to tkhabia/Arduino_LSM6DS3 that referenced this issue Apr 1, 2020
tried to resolve the requested querry.
tkhabia added a commit to tkhabia/Arduino_LSM6DS3 that referenced this issue Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants