Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
HomeMadeGarbage
Published

3DCG Control Using TouchDesigner & 10 DOF Mems IMU Sensor

I controlled 3DCG object using TouchDesigner. The object moves according to the value of the sensor connected Arduino.

IntermediateFull instructions provided2 hours6,811
3DCG Control Using TouchDesigner & 10 DOF Mems IMU Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
DFRobot 10 DOF Mems IMU Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
TouchDesgner

Story

Read more

Code

Untitled file

Arduino
#include <Wire.h>
#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>
#include <HMC5883L.h>
#include <BMP085.h>
 
float angles[3]; // yaw pitch roll
float heading;
BMP085 dps = BMP085();
long Temperature = 0, Pressure = 0, Altitude = 0;
 
// Set the FreeSixIMU object
FreeSixIMU sixDOF = FreeSixIMU();
 
HMC5883L compass;
// Record any errors that may occur in the compass.
int error = 0;
 
void setup(){
    Serial.begin(9600);
    Wire.begin();
    delay(1000);
    dps.init();
    dps.dumpCalData();
    delay(5000);
 
    delay(5);
    sixDOF.init(); //init the Acc and Gyro
    delay(5);
    compass = HMC5883L(); // init HMC5883
 
    error = compass.SetScale(1.3); // Set the scale of the compass.
    error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous  
    if(error != 0) // If there is an error, print it out.
        Serial.println(compass.GetErrorText(error));
}
 
void loop(){
    sixDOF.getEuler(angles);
    Serial.print(angles[0]); //yaw
    Serial.print('\t'); 
    Serial.print(angles[1]); //pitch
    Serial.print('\t');
    Serial.println(angles[2]); //roll
    delay(10);
}

Credits

HomeMadeGarbage

HomeMadeGarbage

56 projects • 286 followers
We are family. hobby is D.I.Y!!

Comments