Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: Where to buy Rotary Encoders on: July 04, 2011, 05:22:19 pm
Hi,
thanks for your replies^^

I found some encoders by clicking on a shop advertiding button on ebay .

http://www.megatron.eu/SMC3/plugin-transformer?trafo=live&plugin=doc&mode=designin&tp_subRulesID=1206567953264&language=de&objType=doc&gclid=COPdyOLV6KkCFZUS3wod-xtWag#ajax0&false&designin&LoadDocument&&de&doc&1234867270725

Don't know why Rotary Encoders are hard to find and Gyros you can find anywhere ????
2  Using Arduino / Sensors / Where to buy Rotary Encoders on: July 04, 2011, 03:32:05 pm
Hi ^^
I wanna build a pendubot for my university.
I decided to use rotary encoders for an absolut angle measurement.
But the problem is, i can't find any contactless rotary encoder, does anyone know where to buy them ?
I can't use a Potentiometer or sth like that, because of the friction.
This is a Pendubot:

Thanks
3  Using Arduino / Sensors / Re: IMU 3000 problem on: June 29, 2011, 10:23:14 am
Hi my Board works now.

After looking for a production mistake i found a soldering mistake at the imu 3000 pins (SMD) .
I disconnected both Pins with a scalpel.
Now it works !

4  Using Arduino / Sensors / Re: IMU 3000 problem on: June 28, 2011, 03:35:56 am
Hi in my Code, I don't use the read_Accelerometer function, because I want to read the Accelerometer Data through my IMU 3000.

But Yes, I can read the ADXL345 directly without problems and good Values.
I just cant read out the IMU 3000.
I tried so many codes ....
In the reference is written, that you can always read out the Measurement Data out of the Registers that doesn't work too,

The Code I posted is a little Bit strange maybe, cause I tested some functions of the IMU:

- Not in this Code: I enabled the FIFO. But the Value of the FIFO count REegister has always been zero.

Thank you ^^
5  Using Arduino / Interfacing w/ Software on the Computer / Re: XBee problems on: June 28, 2011, 03:25:17 am
Thank you very much !
Now I can program my FIO again  smiley-lol
But why did it work before and stopped working after 2 months ?
 smiley smiley smiley smiley smiley smiley smiley smiley
My new configuration:

1. XBee : +++ ATRE,BD6,ID1234,MYF0,DLFFFF,D33,IC8,RR3,RO10,WR (enter)
2. XBee : +++ ATRE,BD6,ID1234,MYFFFF,DLF0,D35,IU0,IAFFFF,RO10,WR (enter)
6  Using Arduino / Sensors / Re: IMU 3000 problem on: June 28, 2011, 02:58:45 am
Code:
/* Lesen vom Gyro /
void getGyroscopeData(int * result)
{
  int regAddress = 0x1B;
  int temp, x, y, z;
  byte buff[G_TO_READ];
  readFrom(GYRO, regAddress, G_TO_READ, buff); //16-bit ADCs
  result[0] = ((buff[2] << 8) | buff[3]) + g_offx;
  result[1] = ((buff[4] << 8) | buff[5]) + g_offy;
  result[2] = ((buff[6] << 8) | buff[7]) + g_offz;
  result[3] = (buff[0] << 8) | buff[1];
}
/************************/
#endif
#ifndef Values
#define Values
#include "WProgram.h"

/**********************************
*  Werte die benötigt werden um
*  die Geräte zu initialisieren
**********************************/

/****** 1. IMU 3000 *****************/
#define X_OFFS_H_VALUE 0 // 16 Bit Offset X High             Seite 30
#define X_OFFS_L_VALUE 0 // 16 Bit Offset X High             Seite 30
#define Y_OFFS_H_VALUE 0 // 16 Bit Offset X High             Seite 30
#define Y_OFFS_L_VALUE 0 // 16 Bit Offset X High             Seite 30
#define Z_OFFS_H_VALUE 0 // 16 Bit Offset X High             Seite 30
#define Z_OFFS_L_VALUE 0 // 16 Bit Offset X High             Seite 30

/***** FIFO wird benutzt *****/
#define FIFO_EN_VALUE 0b11111111 //TEMP_OUT GYRO_XOUT GYRO_YOUT GYRO_ZOUT AUX_XOUT AUX_YOUT AUX_ZOUT FIFO_FOOTER
/**********************************/
/******* Accel I²C level *********/
#define AUX_VDDIO_VALUE 0b00000100 // VDD
/*********************************/

/***** AccelSlaveAddress *****/
#define AUX_SLV_ADDR_VALUE 0xD3 // Addresse des Accelerometers mgl auch : 0x3A write; 0x3B write;
                               // 0xA6 write 0xA7 read 0x53|0b10000000 = CLK EN
/*****************************/

/******** Sample Rate Divider *********/
#define SMPLRT_DIV_VALUE 0x00010101 // Errechnet aus Formel IMU Ref Seite 32
/**************************************/

/******* Messbereich des IMU 3000 bestimmen ***********
*  FS_SEL = 0 : 250°/sec
*  FS_SEL = 1 : 500°/sec
*  FS_SEL = 2 : 1000°/sec
*  FS_SEL = 3 : 2000°/sec
*  IMU Reference Seite  33
******************************************************/
/******* Tiefpassfilter des IMU 3000 bestimmen ********
*  DLPF_CFG: 0 Low Pass Filter Bandwidth: 256Hz Analog Sample Rate: 8kHz
*  DLPF_CFG: 1 Low Pass Filter Bandwidth: 188Hz Analog Sample Rate: 1kHz
*  DLPF_CFG: 2 Low Pass Filter Bandwidth: 98Hz  Analog Sample Rate: 1kHz
*  DLPF_CFG: 3 Low Pass Filter Bandwidth: 42Hz  Analog Sample Rate: 1kHz
*  DLPF_CFG: 4 Low Pass Filter Bandwidth: 20Hz  Analog Sample Rate: 1kHz
*  DLPF_CFG: 5 Low Pass Filter Bandwidth: 10Hz  Analog Sample Rate: 1kHz
*  DLPF_CFG: 6 Low Pass Filter Bandwidth: 5Hz   Analog Sample Rate: 1kHz
*  DLPF_CFG: 7 Reserved Reserved
*  IMU Reference Seite  33
*****************************************************/
#define DLPF_FS_VALUE 0b00011000 // 2000°/s 5Hz 1kHz
/****************************************************/

/******* Interrupt Konfiguration *********************
*  IMU Reference Seite 35
*****************************************************/

/******** Anfangsaddresse des ADXL345 für den IMU ****
*  IMU Reference Seite 35
*****************************************************/
#define AUX_BURST_ADDR_VALUE 0b00110010
/****************************************************/

/******** Konfiguration des IMU 3000 *****************
*  DMP aus                          0
*  FIFO an                          1
*  IMU als Master zum ADXL345 ein   1
*                                   0
*  Kein Reset des ADXL              0
*  kein DMP Reset                   0
*  FIFO nicht an                    0
*  kein Gyro Reset                  0
*****************************************************/
#define USER_CTRL_VALUE 0b01100000
//1. 0b00001010
// USER 0b01101010
// USER_CTRL_VALUE
/****************************************************/

/***** Energieeinstellungen des IMU 3000 *************
*  H_RESET                          0
*  SLEEP    kein standby            0
*  STBY_XG  kein gyro standby       0
*  STBY_YG  kein gyro standby       0
*  STBY_ZG  kein gyro standby       0
*  CLK_SEL  Internal Oscillator     000
*****************************************************/
#define PWR_MGM_VALUE 0b00000000
/****************************************************/

/*********** OFFSETS ********************************/
#define X_OFFS_USERH_VALUE 0
#define X_OFFS_USERL_VALUE 0
#define Y_OFFS_USERH_VALUE 0
#define Y_OFFS_USERL_VALUE 0
#define Z_OFFS_USERH_VALUE 0
#define Z_OFFS_USERL_VALUE 0
/*****************************************************/
/*****************************************************/


/****************** ADXL 345 *************************/

/********** OFFSETS ***************************/
#define OFSX_VALUE 0
#define OFSY_VALUE 0
#define OFSZ_VALUE 0
/**********************************************/

/*************** POWER CONTROL ****************/
/** Muss mehrfach konfiguriert werden
*   Endkonfiguration : 0x08 Measure = '1'     */
#define POWER_CTL_VALUE 0x08
/**********************************************/

/******************* FIFO ausschalten *********/
#define FIFO_CTL_VALUE 0x00
/**********************************************/

/**************** keine Interrupts ************/
#define INT_ENABLE_VALUE 0x00
/**********************************************/
/*****************************************************/
#endif
7  Using Arduino / Sensors / Re: IMU 3000 problem on: June 28, 2011, 02:58:12 am
and heres the rest after fifo footer

Code:
#define AUX_VDDIO 0x13   // 0 0 0 0 0 AUX_VDDIO 0 0
#define AUX_SLV_ADDR 0x14    //CLKOUT_EN AUX_ID
#define SMPLRT_DIV 0x15
#define DLPF_FS 0x16
#define INT_CFG 0x17
#define AUX_BURST_ADDR 0x18
#define INT_STATUS 0x1A
#define TEMP_OUT_H 0x1B
#define TEMP_OUT_L 0x1C
#define GYRO_XOUT_H 0x1D
#define GYRO_XOUT_L 0x1E
#define GYRO_YOUT_H 0x1F
#define GYRO_YOUT_L 0x20
#define GYRO_ZOUT_H 0x21
#define GYRO_ZOUT_L 0x22
#define AUX_XOUT_H 0x23
#define AUX_XOUT_L 0x24
#define AUX_YOUT_H 0x24
#define AUX_YOUT_L 0x26
#define AUX_ZOUT_H 0x27
#define AUX_ZOUT_L 0x28
#define DMP_REG1 0x35
#define DMP_REG2 0x36
#define DMP_REG3 0x37
#define DMP_REG4 0x38
#define DMP_REG5 0x39
#define FIFO_COUNTH 0x3A
#define FIFO_COUNTL 0x3B
#define FIFO_R 0x3C
#define USER_CTRL 0x3D
#define PWR_MGM 0x3E
///////////////////////////
#endif
#ifndef ADXL_345_Register
#define ADXL_345_Register

#include "WProgram.h"

// IMU 3000
// Digital Input auf +-2000°/sec
//   -> FS_SEL = 3
//   -> Scale Factor = 16.4
// Daten 16 Bit groß
// Statup Time bei 50ms
// Temperatur Offset = 35°C

// I2C Adresse des ADXL 345
#define ADXL_ADDR 0x53 // ADXL345 Reference Seite 10 ( alternate I²C address)
///////////////////////////

// Register MAP ADXL 345:
#define DEVID 0x00 //11100101 Device ID.
#define THRESH_TAP 0x1D //R/W 00000000 Tap threshold.
#define OFSX 0x1E //R/W 00000000 X-axis offset.
#define OFSY 0x1F //R/W 00000000 Y-axis offset.
#define OFSZ 0x20 //R/W 00000000 Z-axis offset.
#define DUR 0x21 //R/W 00000000 Tap duration.
#define Latent 0x22 //R/W 00000000 Tap latency.
#define Window 0x23 //R/W 00000000 Tap window.
#define THRESH_ACT 0x24 //R/W 00000000 Activity threshold.
#define THRESH_INACT 0x25 //R/W 00000000 Inactivity threshold.
#define TIME_INACT 0x26 //R/W 00000000 Inactivity time.
#define ACT_INACT_CTL 0x27 //R/W 00000000 Axis enable control for activity and inactivity detection.
#define THRESH_FF 0x28 //R/W 00000000 Free-fall threshold.
#define TIME_FF 0x29 //R/W 00000000 Free-fall time.
#define TAP_AXES 0x2A //R/W 00000000 Axis control for tap/double tap.
#define ACT_TAP_STATUS 0x2B //R 00000000 Source of tap/double tap.
#define BW_RATE 0x2C //R/W 00001010 Data rate and power mode control.
#define POWER_CTL 0x2D //R/W 00000000 Power-saving features control.
#define INT_ENABLE 0x2E //R/W 00000000 Interrupt enable control.
#define INT_MAP 0x2F //R/W 00000000 Interrupt mapping control.
#define INT_SOURCE 0x30 //R 00000010 Source of interrupts.
#define DATA_FORMAT 0x31 //R/W 00000000 Data format control.
#define DATAX0 0x32 //R 00000000 X-Axis Data 0.
#define DATAX1 0x33 //R 00000000 X-Axis Data 1.
#define DATAY0 0x34 //R 00000000 Y-Axis Data 0.
#define DATAY1 0x35 //R 00000000 Y-Axis Data 1.
#define DATAZ0 0x36 //R 00000000 Z-Axis Data 0.
#define DATAZ1 0x37 //R 00000000 Z-Axis Data 1.
#define FIFO_CTL 0x38 //R/W 00000000 FIFO control.
#define FIFO_STATUS 0x39 //R 00000000 FIFO status.
///////////////////////////
#endif
#ifndef I2C
#define I2C
#include "WProgram.h"

/***************************************
*  I²C Funktionen
***************************************/

/* Schreiben an einen I²C Teilnehmer */
void writeTo(int Teilnehmer, byte Adresse, byte WertZuSenden)
{
  Wire.beginTransmission(Teilnehmer); //start transmission to ACC
  Wire.send(Adresse);        // send register address
  Wire.send(WertZuSenden);        // send value to write
  Wire.endTransmission(); //end transmission
}
/************************************/

/* Lesen von einem I²C Teilnehmer */
void readFrom(int Teilnehmer, byte Adresse, int AnzahlZuLesen, byte buff[]) {
  Wire.beginTransmission(Teilnehmer); //start transmission to ACC
  Wire.send(Adresse);        //sends address to read from
  Wire.endTransmission(); //end transmission

  Wire.beginTransmission(Teilnehmer); //start transmission to ACC
  Wire.requestFrom(Teilnehmer, AnzahlZuLesen);    // request 6 bytes from ACC
  int i = 0;
  while(Wire.available())    //ACC may send less than requested (abnormal)
  {
    buff[i] = Wire.receive(); // receive a byte
    i++;
  }
  if(i!= AnzahlZuLesen)
  {
    Serial.print(" FEHLER BEIM LESEN: ");
    Serial.println(Teilnehmer);
  }
  Wire.endTransmission(); //end transmission
}
/**************************/

/* Lesen vom Accelerometer /
void getAccelerometerData(int * result) {
  int regAddress = 0x32;    // Addresse von XL             ADXL345
  byte buff[A_TO_READ];
  readFrom(ACC, regAddress, A_TO_READ, buff); // Beschleunigungsdaten ADXL345
  result[0] = (((int)buff[1]) << 8) | buff[0];
  result[0] = result[0] & 0b0000001111111111;  // 10 Bit
  result[1] = (((int)buff[3])<< 8) | buff[2];
  result[1] = result[1] & 0b0000001111111111;
  result[2] = (((int)buff[5]) << 8) | buff[4];
  result[2] = result[2] & 0b0000001111111111;
}
/****************************/
8  Using Arduino / Sensors / Re: IMU 3000 problem on: June 28, 2011, 02:56:45 am
okay, heres my Code smiley
Code:
#include <Wire.h>
#include "ADXL_345_REGISTER.h"
#include "I2C.h"
#include "IMU_3000_REGISTER.h"
#include "Values.h"
/*****************************
 *       IMU 3000   
 * Digital Input auf +-2000°/sec
 *   -> FS_SEL = 3
 *   -> Scale Factor = 16.4
 * Daten 16 Bit gross
 * Startup Time bei 50ms
 * Temperatur Offset = 35°C
 *****************************/
#define SCALE_FACTOR 16.4
#define ANZAHL_BYTE 14
byte BUFF[14]={
  0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int cleanBUFF[14]={
  0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int ERGEBNISSE[7]={
  0, 0, 0, 0, 0, 0, 0};
float ERGEBNISSE_NACH_UMRECHNUNG[7]={
  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
int ADXL_DIREKT[3] = {
  0,0,0};
int FIFO_ANZAHL = 0;
byte CHECK_TRANSMISSION[1] = {
  0b00000000};
unsigned long time=0;
void INIT_IMU()
{
  writeTo(IMU_ADDR,PWR_MGM,PWR_MGM_VALUE);
  readFrom(IMU_ADDR,PWR_MGM,1,CHECK_TRANSMISSION);
  if(PWR_MGM_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" PWR_MGM OK ");
  }
  else
  {
    Serial.print(" PWR_MGM ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,USER_CTRL,0b00000000); // ADXL direkt auf I2C zum initialisieren
  readFrom(IMU_ADDR,USER_CTRL,1,CHECK_TRANSMISSION);
  if(0b00000000 == CHECK_TRANSMISSION[0])
  {
    Serial.print(" USER_CTRL OK ");
  }
  else
  {
    Serial.print(" USER_CTRL ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  INIT_ADXL();
  writeTo(IMU_ADDR,USER_CTRL,0b00001010);
  writeTo(IMU_ADDR,USER_CTRL,0b01101010); // Set FIFO rst when changing FIFO_EN
  writeTo(IMU_ADDR,FIFO_EN,FIFO_EN_VALUE);
  readFrom(IMU_ADDR,FIFO_EN,1,CHECK_TRANSMISSION);
  if(FIFO_EN_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" FIFO_EN OK ");
  }
  else
  {
    Serial.print(" FIFO_EN ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,USER_CTRL,USER_CTRL_VALUE);
  readFrom(IMU_ADDR,USER_CTRL,1,CHECK_TRANSMISSION);
  if(USER_CTRL_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" USER_CTRL OK ");
  }
  else
  {
    Serial.print(" USER_CTRL ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,X_OFFS_USERH,X_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,X_OFFS_USERL,X_OFFS_USERL_VALUE);
  writeTo(IMU_ADDR,Y_OFFS_USERH,Y_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,Y_OFFS_USERL,Y_OFFS_USERL_VALUE);
  writeTo(IMU_ADDR,Z_OFFS_USERH,Z_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,Z_OFFS_USERL,Z_OFFS_USERL_VALUE);
  writeTo(IMU_ADDR,AUX_VDDIO,AUX_VDDIO_VALUE);
  readFrom(IMU_ADDR,AUX_VDDIO,1,CHECK_TRANSMISSION);
  if(AUX_VDDIO_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_VDDIO OK ");
  }
  else
  {
    Serial.print(" AUX_VDDIO ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,AUX_SLV_ADDR,AUX_SLV_ADDR_VALUE);
  readFrom(IMU_ADDR,AUX_SLV_ADDR,1,CHECK_TRANSMISSION);
  if(AUX_SLV_ADDR_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_SLV_ADDR OK ");
  }
  else
  {
    Serial.print(" AUX_SLV_ADDR ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,SMPLRT_DIV,SMPLRT_DIV_VALUE);
  readFrom(IMU_ADDR,SMPLRT_DIV,1,CHECK_TRANSMISSION);
  if(SMPLRT_DIV_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" SMPLRT_DIV OK ");
  }
  else
  {
    Serial.print(" SMPLRT_DIV ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,AUX_BURST_ADDR,AUX_BURST_ADDR_VALUE);
  readFrom(IMU_ADDR,AUX_BURST_ADDR,1,CHECK_TRANSMISSION);
  if(AUX_BURST_ADDR_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_BURST_ADDR OK ");
  }
  else
  {
    Serial.println(" AUX_BURST_ADDR ERROR ");
  }

  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,DLPF_FS,DLPF_FS_VALUE);
  readFrom(IMU_ADDR,DLPF_FS,1,CHECK_TRANSMISSION); 
  if(DLPF_FS_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" DLPF_FS OK ");
  }
  else
  {
    Serial.print(" DLPF_FS ERROR ");
    Serial.print(CHECK_TRANSMISSION[0],DEC);
  }

}
void INIT_ADXL()
{
  writeTo(ADXL_ADDR,POWER_CTL,0x00);     
  writeTo(ADXL_ADDR,POWER_CTL,0x16);
  writeTo(ADXL_ADDR,POWER_CTL,POWER_CTL_VALUE);
  writeTo(ADXL_ADDR,FIFO_CTL,FIFO_CTL_VALUE);
  writeTo(ADXL_ADDR,INT_ENABLE,INT_ENABLE_VALUE);
}

void READ_IMU()
{
  readFrom(IMU_ADDR,TEMP_OUT_H,ANZAHL_BYTE,BUFF);

  cleanBUFF[0] = ((int)BUFF[0]<<8) & 0b1111111100000000;
  cleanBUFF[2] = ((int)BUFF[2]<<8) & 0b1111111100000000;
  cleanBUFF[4] = ((int)BUFF[4]<<8) & 0b1111111100000000;
  cleanBUFF[6] = ((int)BUFF[6]<<8) & 0b1111111100000000;
  cleanBUFF[8] = ((int)BUFF[8]<<8) & 0b1111111100000000;
  cleanBUFF[10] = ((int)BUFF[10]<<8) & 0b1111111100000000;
  cleanBUFF[12] = ((int)BUFF[12]<<8) & 0b1111111100000000;

  cleanBUFF[1] = ((int)BUFF[1]) & 0b0000000011111111;
  cleanBUFF[3] = ((int)BUFF[3]) & 0b0000000011111111;
  cleanBUFF[5] = ((int)BUFF[5]) & 0b0000000011111111;
  cleanBUFF[7] = ((int)BUFF[7]) & 0b0000000011111111;
  cleanBUFF[9] = ((int)BUFF[9]) & 0b0000000011111111;
  cleanBUFF[11] = ((int)BUFF[11]) & 0b0000000011111111;
  cleanBUFF[13] = ((int)BUFF[13]) & 0b0000000011111111;

  for(int i = 0; i<13;i++)
  {
    ERGEBNISSE[i] = cleanBUFF[i] | cleanBUFF[i+1];
  }   

  for(int i = 1;i<4;i++)
  {
    ERGEBNISSE_NACH_UMRECHNUNG[i] = (float)ERGEBNISSE[i]/16.4;
  }
  for(int i = 4;i<7;i++)
  {
    ERGEBNISSE_NACH_UMRECHNUNG[i] = (float)ERGEBNISSE[i]/256.0;
  }
}
void GET_FIFO_COUNT()
{
  byte BUFF[2] = {
    0x0,0x0        };
  int cleanBUFF[2] = {
    0x00,0x00        };
  readFrom(IMU_ADDR,FIFO_COUNTH,2,BUFF);
  cleanBUFF[0] = ((int)BUFF[0]<<8) & 0b0000001100000000;
  cleanBUFF[1] = ((int)BUFF[1]) &    0b0000000011111111;
  FIFO_ANZAHL = cleanBUFF[0] | cleanBUFF[1];
  Serial.print(" FIFO COUNT : ");
  Serial.println(FIFO_ANZAHL); 
}
void PRINT_VALUES(float VALUES[])
{
  Serial.print("TEMPERATUR: ");
  Serial.print(VALUES[0]);
  Serial.print(" GYRO X: ");
  Serial.print(VALUES[1]);
  Serial.print(" GYRO Y: ");
  Serial.print(VALUES[2]);
  Serial.print(" GYRO Z: ");
  Serial.print(VALUES[3]);
  Serial.print(" ACC X: ");
  Serial.print(VALUES[4]);
  Serial.print(" ACC Y: ");
  Serial.print(VALUES[5]);
  Serial.print(" ACC Z: ");
  Serial.print(VALUES[6]);
  Serial.print(" Bisherige Zeit ");
  Serial.println(time);
}
void READ_ADXL()
{
  byte wert[6]={
    0,0,0,0,0,0        };
  readFrom(ADXL_ADDR,DATAX0,6,wert);
  ADXL_DIREKT[0] = ((int)wert[1]<<8)|(int)wert[0];
  ADXL_DIREKT[1] = ((int)wert[3]<<8)|(int)wert[2];
  ADXL_DIREKT[2] = ((int)wert[5]<<8)|(int)wert[4];
  Serial.print("ADXL_DIREKT[0]: ");
  Serial.print(ADXL_DIREKT[0]);
  Serial.print(" ADXL_DIREKT[1]: ");
  Serial.print(ADXL_DIREKT[1]);
  Serial.print(" ADXL_DIREKT[2]: ");
  Serial.print(ADXL_DIREKT[2]);


}
void IMU_TEST()
{
  byte IDENTITAET[1] = {
    0        };
  readFrom(IMU_ADDR,WHO_AM_I,1,IDENTITAET);
  Serial.print(" Adresse des Geraets: ");
  Serial.println(IDENTITAET[0],DEC);
}
void setup()
{
  Serial.begin(57600);
  Wire.begin();
  INIT_ADXL(); // Erst den ADXL initialisieren, da IMU danach die Daten ausliest
  INIT_IMU();
  IMU_TEST();
  delay(50);
}
void loop()
{
  time = millis();
  if(time%40 <=2) // -> 25HZ
  {
    PRINT_VALUES(ERGEBNISSE_NACH_UMRECHNUNG);
    READ_IMU();
    GET_FIFO_COUNT();
    //READ_ADXL(); //ADXL Direkt funktioniert   
  }
}
#ifndef IMU_3000_REGISTER
#define IMU_3000_REGISTER
#include "WProgram.h"

// IMU 3000
// Digital Input auf +-2000°/sec
//   -> FS_SEL = 3
//   -> Scale Factor = 16.4
// Daten 16 Bit groß
// Statup Time bei 50ms
// Temperatur Offset = 35°C

// IMU 3000 I²C Adresse
#define IMU_ADDR 0x68 // IMU_Reference S.30 = POWER-ON Value 
///////////////////////

// Register MAP IMU 3000:
#define WHO_AM_I 0x00
#define X_OFFS_USERH 0x0C
#define X_OFFS_USERL 0x0D
#define Y_OFFS_USERH 0x0E
#define Y_OFFS_USERL 0x0F
#define Z_OFFS_USERH 0x10
#define Z_OFFS_USERL 0x11
#define FIFO_EN 0x12     // TEMP_OUT GYRO_XOUT GYRO_YOUT GYRO_ZOUT AUX_XOUT AUX_YOUT AUX_ZOUT FIFO_FOOTER
Hope this helps a little bit....
The Datasheets are available at : http://www.sparkfun.com/products/10252
9  Using Arduino / Interfacing w/ Software on the Computer / XBee problems on: June 24, 2011, 05:40:15 am
Hi ^^

I got an Arduino FIO and I program it with 2 XBee.
But after 2 Months of perfect function, i got a problem...
The Communication of the XBees is now only one-way.
I configured both XBee several times with the factory settings and after that with my settings again, but that didn't change anything.

Cofiguration :
1. XBee : +++ ATRE,BD6,ID1234,MY0,DLFFFF,D33,IC8,RR3,RO10,WR (enter)
2. XBee : +++ ATRE,BD6,ID1234,MY1,DLF0   ,D35,IU0,IAFFFF,RO10,WR (enter)

Thanks for your replies!
10  Using Arduino / Sensors / IMU 3000 problem on: June 24, 2011, 05:33:11 am
HI ^^
After reading all IMU 3000 posts, there was noch solution for my Problem.
Problem: My Programm initializes the IMU 3000 quite good, but I cant read any GYRO data or Acceleration Data through the IMU ( Only directly from the ADXL 345 ) .
I tried every Code I found and after that I programmed every Register as described in the Reference.
Pin 20 and Pin 21 at the IMU 3000 Fusion Board are connected. Pin 21 must not be connected to anything ( as described in reference) .
Could this be the problem ?

Thank you
11  Using Arduino / Networking, Protocols, and Devices / Re: i2c imu fusion board ardupilot mega not working on: June 20, 2011, 12:08:04 pm
Hi,
i tried every sample code (hobbytronics, varesano ...). But no success.
I watched the registers after i set them to a value.
Theres only one Register which gives a constant value of zero.
It's DLPF_FS (Register 22), even if i set it to another value.....
Heres my Code if someone can find a mistake smiley

#include <Wire.h>
#include "ADXL_345_REGISTER.h"
#include "I2C.h"
#include "IMU_3000_REGISTER.h"
#include "Values.h"
/*****************************
 *       IMU 3000   
 * Digital Input auf +-2000°/sec
 *   -> FS_SEL = 3
 *   -> Scale Factor = 16.4
 * Daten 16 Bit gross
 * Statup Time bei 50ms
 * Temperatur Offset = 35°C
 *****************************/
#define SCALE_FACTOR 16.4
#define ANZAHL_BYTE 14
byte BUFF[14]={
  0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int cleanBUFF[14]={
  0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int ERGEBNISSE[7]={
  0, 0, 0, 0, 0, 0, 0};
float ERGEBNISSE_NACH_UMRECHNUNG[7]={
  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
int ADXL_DIREKT[3] = {
  0,0,0};
int FIFO_ANZAHL = 0;
byte CHECK_TRANSMISSION[1] = {
  0b00000000};
void INIT_IMU()
{
  writeTo(IMU_ADDR,PWR_MGM,PWR_MGM_VALUE);
  readFrom(IMU_ADDR,PWR_MGM,1,CHECK_TRANSMISSION);
  if(PWR_MGM_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" PWR_MGM OK ");
  }
  else
  {
    Serial.print(" PWR_MGM ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,USER_CTRL,0b00100000);
  readFrom(IMU_ADDR,PWR_MGM,1,CHECK_TRANSMISSION);
  if(PWR_MGM_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" PWR_MGM OK ");
  }
  else
  {
    Serial.print(" PWR_MGM ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  INIT_ADXL();
  writeTo(IMU_ADDR,USER_CTRL,USER_CTRL_VALUE);
  readFrom(IMU_ADDR,USER_CTRL,1,CHECK_TRANSMISSION);
  if(USER_CTRL_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" USER_CTRL OK ");
  }
  else
  {
    Serial.print(" USER_CTRL ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,X_OFFS_USERH,X_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,X_OFFS_USERL,X_OFFS_USERL_VALUE);
  writeTo(IMU_ADDR,Y_OFFS_USERH,Y_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,Y_OFFS_USERL,Y_OFFS_USERL_VALUE);
  writeTo(IMU_ADDR,Z_OFFS_USERH,Z_OFFS_USERH_VALUE);
  writeTo(IMU_ADDR,Z_OFFS_USERL,Z_OFFS_USERL_VALUE);

  writeTo(IMU_ADDR,FIFO_EN,FIFO_EN_VALUE);
  readFrom(IMU_ADDR,FIFO_EN,1,CHECK_TRANSMISSION);
  if(FIFO_EN_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" FIFO_EN OK ");
  }
  else
  {
    Serial.print(" FIFO_EN ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,AUX_VDDIO,AUX_VDDIO_VALUE);
  readFrom(IMU_ADDR,AUX_VDDIO,1,CHECK_TRANSMISSION);
  if(AUX_VDDIO_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_VDDIO OK ");
  }
  else
  {
    Serial.print(" AUX_VDDIO ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,AUX_SLV_ADDR,AUX_SLV_ADDR_VALUE);
  readFrom(IMU_ADDR,AUX_SLV_ADDR,1,CHECK_TRANSMISSION);
  if(AUX_SLV_ADDR_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_SLV_ADDR OK ");
  }
  else
  {
    Serial.print(" AUX_SLV_ADDR ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,SMPLRT_DIV,SMPLRT_DIV_VALUE);
  readFrom(IMU_ADDR,SMPLRT_DIV,1,CHECK_TRANSMISSION);
  if(SMPLRT_DIV_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" SMPLRT_DIV OK ");
  }
  else
  {
    Serial.print(" SMPLRT_DIV ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;


  writeTo(IMU_ADDR,AUX_BURST_ADDR,AUX_BURST_ADDR_VALUE);
  readFrom(IMU_ADDR,AUX_BURST_ADDR,1,CHECK_TRANSMISSION);
  if(AUX_BURST_ADDR_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" AUX_BURST_ADDR OK ");
  }
  else
  {
    Serial.println(" AUX_BURST_ADDR ERROR ");
  }
  CHECK_TRANSMISSION[0] = 0b00000000;
  writeTo(IMU_ADDR,DLPF_FS,DLPF_FS_VALUE);
  readFrom(IMU_ADDR,DLPF_FS,1,CHECK_TRANSMISSION); 
  if(DLPF_FS_VALUE == CHECK_TRANSMISSION[0])
  {
    Serial.print(" DLPF_FS OK ");
  }
  else
  {
    Serial.print(" DLPF_FS ERROR ");
    Serial.print(CHECK_TRANSMISSION[0],DEC);
  }

}
void INIT_ADXL()
{
  writeTo(ADXL_ADDR,POWER_CTL,0x00);     
  writeTo(ADXL_ADDR,POWER_CTL,0x16);
  writeTo(ADXL_ADDR,POWER_CTL,POWER_CTL_VALUE);
  writeTo(ADXL_ADDR,FIFO_CTL,FIFO_CTL_VALUE);
  writeTo(ADXL_ADDR,INT_ENABLE,INT_ENABLE_VALUE);
}

void READ_IMU()
{
  readFrom(IMU_ADDR,TEMP_OUT_H,ANZAHL_BYTE,BUFF);

  cleanBUFF[0] = ((int)BUFF[0]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[2] = ((int)BUFF[2]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[4] = ((int)BUFF[4]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[6] = ((int)BUFF[6]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[8] = ((int)BUFF[8]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[10] = ((int)BUFF[10]<<smiley-cool & 0b1111111100000000;
  cleanBUFF[12] = ((int)BUFF[12]<<smiley-cool & 0b1111111100000000;

  cleanBUFF[1] = ((int)BUFF[1]) & 0b0000000011111111;
  cleanBUFF[3] = ((int)BUFF[3]) & 0b0000000011111111;
  cleanBUFF[5] = ((int)BUFF[5]) & 0b0000000011111111;
  cleanBUFF[7] = ((int)BUFF[7]) & 0b0000000011111111;
  cleanBUFF[9] = ((int)BUFF[9]) & 0b0000000011111111;
  cleanBUFF[11] = ((int)BUFF[11]) & 0b0000000011111111;
  cleanBUFF[13] = ((int)BUFF[13]) & 0b0000000011111111;

  for(int i = 0; i<13;i++)
  {
    ERGEBNISSE = cleanBUFF | cleanBUFF[i+1];
  }   

  for(int i = 1;i<4;i++)
  {
    ERGEBNISSE_NACH_UMRECHNUNG = (float)ERGEBNISSE/16.4;
  }
  for(int i = 4;i<7;i++)
  {
    ERGEBNISSE_NACH_UMRECHNUNG = (float)ERGEBNISSE/256.0;
  }
}
/*void GET_FIFO_COUNT()
{
  byte BUFF[2] = {
    0x0,0x0    };
  int cleanBUFF[2] = {
    0x00,0x00    };
  readFrom(IMU_ADDR,FIFO_COUNTH,2,BUFF);
  cleanBUFF[0] = ((int)BUFF[0]<<smiley-cool & 0b0000001100000000;
  cleanBUFF[1] = ((int)BUFF[1]) &    0b0000000011111111;
  FIFO_ANZAHL = cleanBUFF[0] | cleanBUFF[1];
  Serial.print(" FIFO COUNT : ");
  Serial.println(FIFO_ANZAHL); 
}*/
void PRINT_VALUES(float VALUES[])
{
  Serial.print("TEMPERATUR: ");
  Serial.print(VALUES[0]);
  Serial.print(" GYRO X: ");
  Serial.print(VALUES[1]);
  Serial.print(" GYRO Y: ");
  Serial.print(VALUES[2]);
  Serial.print(" GYRO Z: ");
  Serial.print(VALUES[3]);
  Serial.print(" ACC X: ");
  Serial.print(VALUES[4]);
  Serial.print(" ACC Y: ");
  Serial.print(VALUES[5]);
  Serial.print(" ACC Z: ");
  Serial.println(VALUES[6]);
}
void READ_ADXL()
{
  byte wert[6]={
    0,0,0,0,0,0    };
  readFrom(ADXL_ADDR,DATAX0,6,wert);
  ADXL_DIREKT[0] = ((int)wert[1]<<smiley-cool|(int)wert[0];
  ADXL_DIREKT[1] = ((int)wert[3]<<smiley-cool|(int)wert[2];
  ADXL_DIREKT[2] = ((int)wert[5]<<smiley-cool|(int)wert[4];
  Serial.print("ADXL_DIREKT[0]: ");
  Serial.print(ADXL_DIREKT[0]);
  Serial.print(" ADXL_DIREKT[1]: ");
  Serial.print(ADXL_DIREKT[1]);
  Serial.print(" ADXL_DIREKT[2]: ");
  Serial.println(ADXL_DIREKT[2]);

}
void IMU_TEST()
{
  byte IDENTITAET[1] = {
    0    };
  readFrom(IMU_ADDR,WHO_AM_I,1,IDENTITAET);
  Serial.print(" Adresse des Geraets: ");
  Serial.println(IDENTITAET[0],DEC);
}
void setup()
{
  Serial.begin(57600);
  Wire.begin();
  INIT_ADXL(); // Erst den ADXL initialisieren, da IMU danach die Daten ausliest
  INIT_IMU();
  IMU_TEST();
  delay(50);
}
void loop()
{
  READ_IMU();
  //GET_FIFO_COUNT();
  READ_ADXL(); //ADXL Direkt funktioniert
  PRINT_VALUES(ERGEBNISSE_NACH_UMRECHNUNG);
  delay(50);
}




12  Using Arduino / Networking, Protocols, and Devices / Re: i2c imu fusion board ardupilot mega not working on: May 16, 2011, 02:59:34 am
Yes, I use the "Logic Level Converter". But same problem with Arduino FIO and that got 3.3V.
13  Using Arduino / Networking, Protocols, and Devices / Re: i2c imu fusion board ardupilot mega not working on: May 14, 2011, 05:45:47 pm
I got the same Problem ( Arduino Mega - IMU3000 FUSION).
I uploaded the hobbytronics code, but nothing happens.
I can read out the accelerometer data directly ( Address 0x53 .....) but the IMU 3000 gives no response.
Even if i set an register just for fun and then read it our theres no answer.
And I tried the Code with an Arduino FIO too, but nothing happens.
Cause you say it works fine maybe my IMU Fusion is broken ????

Pages: [1]