Show Posts
Pages: [1] 2
1  Community / Exhibition / Gallery / Arduino Evolution 5 Years in 2 minuts on: August 26, 2012, 08:59:50 pm


In this animation you could see all works in the arduino ide, in 5 years ago, the data to create this animation comes from github repository del proyecto..

Enjoy.....

Pd. i create this about a year ago, and i forget publish smiley-grin
2  General Category / General Discussion / Re: Scholarships for Ph.D. in electronics in Europe? on: August 07, 2012, 07:38:02 pm
someone??
3  General Category / General Discussion / Scholarships for Ph.D. in electronics in Europe? on: August 01, 2012, 11:59:25 pm
Greetings, my name is Alexis Sanches, I am an electronics engineer in Venezuela and I am currently looking for PhD studies in Electronics in Europe somewhere, preferably on embedded systems or something really dedicated to the design of hardware, but any study could also be Robotics, I have several days looking for but can not get something concrete and thought what better place to find out about PhD in Electornica that Arduino community, maybe someone here knows that, if the university offers scholarships would be far better ... Well I hope someone here can help me, they are grateful.
4  Topics / Robotics / Re: Balancing robot for dummies on: April 23, 2012, 03:57:16 pm
sensors aquisition smoothing and zeroing

First i have a i2c sensor http://www.sparkfun.com/products/10252 ... This sensor is different in the values ​​that can deliver
If i connect and plot they value, I get something like this.

http://twitpic.com/9d84yg (This is All values)


The gyros value... range(-32768,32768); (16 bits resolutions)
The acc range(-512,512); (10bits resolution)

because these values ​​are not in quids using the map function are taken to the range from 0 to 1023

Code:
  temp = buffer[2] << 8 | buffer[3];
   readIMU[0] = map(temp,-32768,32768,0,1023);  //  GYR_Y in Quids
   temp = buffer[7] << 8 | buffer[6];
   readIMU[1] = map(temp,-512,512,0,1023);       //  ACC_X in Quids
   temp = buffer[11] << 8 | buffer[10];
   readIMU[2] = map(temp,-512,512,0,1023);       //  ACC_Z in Quids*/

Values (Aprox)
506 - GYR_Y
500 - ACC_X
751 - ACC_Z
See Quids.png


After Zeroing
I cant stablish for my sensor the Acc_Z zero value... like 102...

My sensor is a 4 mg/LSB scale factor.
the device is in 10-bit mode.
And the g range +-2g
Datasheet (http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf, page 17)


See backward.png and Backward.png....


Code:
#include <math.h>
#include <Wire.h>
#define ON   pinMode(11, OUTPUT);digitalWrite(11, HIGH);

#define GYRO 0x68         // gyro I2C address
#define REG_GYRO_X 0x1D   // IMU-3000 Register address for GYRO_XOUT_H
#define ACCEL 0x53        // Accel I2c Address
#define ADXL345_POWER_CTL 0x2D

int            sensorValue[3]  = {0, 0, 0};
int            sensorZero[3]   = {0, 0, 0};
// Sensors Module  ---------------------------------------------------------------------
byte           buffer[12];     // Array para almacenar los valdores del I2C
int            GYR_Y;
int            ACC_Z;
int            ACC_X;
int            readIMU[3] =  {0,0,0};
unsigned long  samplesIMU[3] = {0,0,0};
int            i;

#define STD_LOOP_TIME 10000
unsigned long  lastLoopTime = STD_LOOP_TIME;
unsigned long  lastLoopUsefulTime = STD_LOOP_TIME;
unsigned long  loopStartTime = 0;
int gyro_x;
int gyro_y;
int gyro_z;
int accel_x;
int accel_y;
int accel_z;

// Sensors Module  ---------------------------------------------------------------------
void writeTo(int device, byte address, byte val) {
  Wire.beginTransmission(device); // Comienza la transmision
  Wire.write(address); // Envia la direccion
  Wire.write(val); // Envia el valor
  Wire.endTransmission(); // Finaliza la transmision
}

void configIMU(){
  Wire.begin();
  // Set Gyro settings
  // Sample Rate 1kHz, Filter Bandwidth 42Hz, Gyro Range 500 d/s
  writeTo(GYRO, 0x16, 0x0B);      
  //set accel register data address
  writeTo(GYRO, 0x18, 0x32);    
  // set accel i2c slave address
  writeTo(GYRO, 0x14, ACCEL);    

  // Set passthrough mode to Accel so we can turn it on
  writeTo(GYRO, 0x3D, 0x08);    
  // set accel power control to 'measure'
  writeTo(ACCEL, ADXL345_POWER_CTL, 8);    
  //cancel pass through to accel, gyro will now read accel for us  
  writeTo(GYRO, 0x3D, 0x28);    
}

void readSensor(){
  long temp;
  // First set the register start address for X on Gyro  
  Wire.beginTransmission(GYRO);
  Wire.write(REG_GYRO_X); //Register Address GYRO_XOUT_H
  Wire.endTransmission();

  // New read the 12 data bytes
  Wire.beginTransmission(GYRO);
  Wire.requestFrom(GYRO,12); // Read 12 bytes
  i = 0;
  while(Wire.available())
  {
    buffer[i] = Wire.read();
    i++;
  }
  Wire.endTransmission();

  temp = buffer[2] << 8 | buffer[3];
  readIMU[0] = map(temp,-32768,32768,0,1023);  //  GYR_Y in Quids
  temp = buffer[7] << 8 | buffer[6];
  readIMU[1] = map(temp,-512,512,0,1023);       //  ACC_X in Quids
  temp = buffer[11] << 8 | buffer[10];
  readIMU[2] = map(temp,-512,512,0,1023);       //  ACC_Z in Quids*/
}

void calibrateSensors() {                                       // Set zero sensor values
  int samples = 50;
  for(int n=0; n<3; n++) {
    samplesIMU[n] = 0;
  }
  for(int i=0; i<samples; i++){
    readSensor();
    samplesIMU[0] += readIMU[0];
    samplesIMU[1] += readIMU[1];
    samplesIMU[2] += readIMU[2];    
  }  

  for(int n=0; n<3; n++) {
    sensorZero[n] = samplesIMU[n]/samples;
  }
}

void updateSensors() {                                         // data acquisition
  int samples = 5;
  for(int n=0; n<3; n++) {
    samplesIMU[n] = 0;
  }
  for(int i=0; i<samples; i++){
    readSensor();
    samplesIMU[0] += readIMU[0];
    samplesIMU[1] += readIMU[1];
    samplesIMU[2] += readIMU[2];    
  }  

  for(int n=0; n<3; n++) {
    sensorValue[n] = samplesIMU[n]/samples - sensorZero[n];
  }
}

/*
Zeros Values
 */
void serialOut_zero() {    
  Serial.print("GIRO_Y");
  Serial.print(sensorZero[0]);
  Serial.print("\t ACC_X:");        
  Serial.print(sensorZero[1]);
  Serial.print("\t ACC_Z:");  
  Serial.println(sensorZero[2]);
}

/*
This Function show values directly form IMU3000
 */
void serialOut_value() {    
  Serial.print(readIMU[0]);
  Serial.print(",");        
  Serial.print(readIMU[1]);
  Serial.print(",");  
  Serial.println(readIMU[2]);
}

/*
The correct value, for use..
 */
void serialOut_read() {    
  Serial.print(sensorValue[0]);
  Serial.print(",");        
  Serial.print(sensorValue[1]);
  Serial.print(",");  
  Serial.println(sensorValue[2]);
}

void serialOut_timing() {
  static int skip=0;
  if(skip++==5) { // display every 500 ms (at 100 Hz)
    skip = 0;
    Serial.print(lastLoopUsefulTime);
    Serial.print(",");
    Serial.println(lastLoopTime);
  }
}

void setup(){
  Serial.begin(9600);
  configIMU();
  calibrateSensors();
  ON;
  delay(1000);
}

void loop(){
  updateSensors();
  serialOut_read();
  // *********************** loop timing control **************************
  lastLoopUsefulTime = micros()-loopStartTime;
  if(lastLoopUsefulTime<STD_LOOP_TIME)         delayMicroseconds(STD_LOOP_TIME-lastLoopUsefulTime);
  lastLoopTime = micros() - loopStartTime;
  loopStartTime = micros();
}

@Lauszus  Why do u use Acc_Y?

5  Topics / Robotics / Re: Balancing robot for dummies on: April 23, 2012, 12:29:30 pm
I decided in the next 2 day i gonna make mi balancing bot (have a little vacations)

This is my part list...
Arduino Duemilanove http://arduino.cc/es/Main/arduinoBoardDuemilanove
Motors: http://www.robotshop.com/world/solutions-cubed-ezr-5.html (They do not have encoder, I think this caused me problems in the PID)
Sensor http://www.sparkfun.com/products/10252 (This is i2c sensor)
Battery: http://www.sparkfun.com/products/10470
Motor Drive: http://www.sparkfun.com/products/9670

Now i test  this.. http://www.x-firm.com/?page_id=187
At the final they say:
Quote
You should read “2,10″

I read:

Quote
0,10
0,9
0,9
0,9
0,10
0,9
0,8
0,9
0,10
0,9
0,9
0,10
0,9
0,8
0,9
0,10
0,9
I read 0 always in the first number...  i wait put more code to see this change...

My code..
Code:
#define ON   pinMode(11, OUTPUT);digitalWrite(11, HIGH);

// Variables de Tiempo
int STD_LOOP_TIME = 9;
int lastLoopTime = STD_LOOP_TIME;
int lastLoopUsefulTime = STD_LOOP_TIME;
unsigned long loopStartTime = 0;

void serialOut_timing() {
  static int skip=0;
  if(skip++==5) { // display every 500 ms (at 100 Hz)
    skip = 0;
    Serial.print(lastLoopUsefulTime);
    Serial.print(",");
    Serial.println(lastLoopTime);
  }
}

void setup(){
  Serial.begin(9600);
  ON;
}

void loop(){
  serialOut_timing();
  // *********************** loop timing control **************************
  lastLoopUsefulTime = millis()-loopStartTime;
  if(lastLoopUsefulTime<STD_LOOP_TIME)         delay(STD_LOOP_TIME-lastLoopUsefulTime);
  lastLoopTime = millis() - loopStartTime;
  loopStartTime = millis();

}
6  Using Arduino / Programming Questions / Re: Read and compare string form serial port on: April 20, 2012, 11:58:50 pm
thanks all...
7  Using Arduino / Programming Questions / Read and compare string form serial port on: April 20, 2012, 11:54:17 am
I need do something like this...

Code:
void setup(){
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    String c = Serial.read();
    if (c == "Ping"){
      Serial.println("Ok");   
    }
  }
}

But cant compile... need help...
8  Topics / Robotics / Re: Balancing robot for dummies on: April 17, 2012, 04:41:29 pm
I'm trying to test the code of how to calculate the arctang that aparcere here  http://dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization and is used in this project, I'm testing with a calculator but I can not give a result not even like ... can someone please show me some input values ​​and assume something that should out ..
9  Topics / Robotics / Re: Balancing robot for dummies on: April 13, 2012, 11:17:47 am
I have this motors:
http://www.robotshop.com/world/solutions-cubed-ezr-5.html

And this Motor board controller:
http://www.sparkfun.com/products/9670

I would like to know if you think this hardware is possible to build a robot of this type?????
10  Using Arduino / Installation & Troubleshooting / Re: Arduino not run un Ubuntu 12.04 on: April 06, 2012, 05:43:33 pm
i fix.. this problem... with this..

Code:
sudo update-alternatives --config java
Existen 3 opcioens para la alternativa java (que provee /usr/bin/java).

  Selección   Ruta                                           Prioridad  Estado
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      modo automático
  1            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      modo manual
* 2            /usr/lib/jvm/java-6-sun/jre/bin/java            63        modo manual
  3            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      modo manual
Pulse <Intro> para mantener el valor por omisión [*] o pulse un número de selección:

Select the option number 2... fix... works fine...
11  Using Arduino / Installation & Troubleshooting / Re: Arduino not run un Ubuntu 12.04 on: April 06, 2012, 11:51:43 am
cant fix
12  Using Arduino / Installation & Troubleshooting / Re: Arduino not run un Ubuntu 12.04 on: April 04, 2012, 05:37:35 pm
same error
Code:
alexis@laptop:~$ sudo apt-get install arduino
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias       
Leyendo la información de estado... Hecho
Se instalarán los siguientes paquetes NUEVOS:
  arduino
0 actualizados, 1 se instalarán, 0 para eliminar y 340 no actualizados.
Necesito descargar 684 kB de archivos.
Se utilizarán 903 kB de espacio de disco adicional después de esta operación.
Des:1 http://archive.ubuntu.com/ubuntu/ precise/universe arduino all 1:1.0+dfsg-9 [684 kB]
Descargados 684 kB en 6seg. (100 kB/s)                                         
Seleccionando paquete arduino previamente no seleccionado
(Leyendo la base de datos ... 459344 ficheros o directorios instalados actualmente.)
Desempaquetando arduino (de .../arduino_1%3a1.0+dfsg-9_all.deb) ...
Procesando disparadores para gnome-menus ...
Procesando disparadores para desktop-file-utils ...
Procesando disparadores para bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Procesando disparadores para hicolor-icon-theme ...
Procesando disparadores para man-db ...
Procesando disparadores para menu ...
Procesando disparadores para shared-mime-info ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
Unknown media type in type 'interface/x-winamp-skin'
Configurando arduino (1:1.0+dfsg-9) ...
Procesando disparadores para menu ...
alexis@laptop:~$ arduino
Exception in thread "main" java.lang.ExceptionInInitializerError
at processing.app.Base.main(Base.java:112)
Caused by: java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
at processing.core.PApplet.<clinit>(Unknown Source)
... 1 more
alexis@laptop:~$
13  Using Arduino / Installation & Troubleshooting / Arduino not run un Ubuntu 12.04 on: April 04, 2012, 03:59:08 pm
I the actual version of Ubuntu 12.04 (in this date is not a rc, just a beta)... and Arduino not run...

Code:
cd alexis@laptop:~$ cd Escritorio/arduino-1.0/
alexis@laptop:~/Escritorio/arduino-1.0$ arduino
Exception in thread "main" java.lang.ExceptionInInitializerError
at processing.app.Base.main(Base.java:112)
Caused by: java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
at processing.core.PApplet.<clinit>(Unknown Source)
... 1 more
alexis@laptop:~/Escritorio/arduino-1.0$
14  Topics / Robotics / Re: Balancing robot for dummies on: February 23, 2012, 12:51:04 pm
Please... i try to copy this project.. but i use a IMU Fusion Board - ADXL345 / IMU3000, , I translate the code in this site, for my sensor...
 http://www.x-firm.com/?page_id=189 and.. i create this..

Code:
#define GYRO 0x68         // Direccion del Giroscopo para I2C
#define REG_GYRO_X 0x1D   // Direccion para GYRO_XOUT_H en el IMU-3000
#define ACCEL 0x53        // Direccion del Acelerometro para I2C
#define ADXL345_POWER_CTL 0x2D

byte buffer[12];          // Array para almacenar los valdores del I2C
int IMU[6];               //Valores del IMU 0:GiroX;1:GiroY;2:GiroX;3:AccelX;4:AccelY;5:Accel:6
int zeroIMU[6];           //Resultado de Calibracion IMU, para puesta a 0; 0:GiroX;1:GiroY;2:GiroX;3:AccelX;4:AccelY;5:Accel:6
long tempIMU[6];           //valores temporales de Calibracion del IMU 0:GiroX;1:GiroY;2:GiroX;3:AccelX;4:AccelY;5:Accel:6

int i;

#include <Wire.h>

void configIMU(){
  // Configuramos el Giroscopo
  // Velocidad de Muestreo 1kHz, Filtro de ancho de banda 42Hz, Rango del Girospoco 500 d/s
  writeTo(GYRO, 0x16, 0x0B);      
  //Establecer la direccion del acelerometro
  writeTo(GYRO, 0x18, 0x32);    
  //Setear el acelerometro como esclavo
  writeTo(GYRO, 0x14, ACCEL);    

  // Ajuste el modo de paso a través de Accelerometro para que podamos encenderlo
  writeTo(GYRO, 0x3D, 0x08);    
  // establecer el control de aceleración poder para 'medir'
  writeTo(ACCEL, ADXL345_POWER_CTL, 8);    
  //cancelar el pasar a través del acelerometro, el Giroscopo ahora leerá aceleración para nosotros
  writeTo(GYRO, 0x3D, 0x28);  
}

// Funcion para escribir un valor en una direccion en un dispositivo especifico
void writeTo(int device, byte address, byte val) {
  Wire.beginTransmission(device);   // Comienza la transmision
  Wire.send(address);               // Envia la direccion
  Wire.send(val);                   // Envia el valor
  Wire.endTransmission();           // Finaliza la transmision
}

void getIMU(){
  for(int n=0;n<=5;n++){
    IMU[n] = 0;                    //Limpiamos el vector
  }
  // Read the Gyro X, Y and Z and Accel X, Y and Z all through the gyro
  // First set the register start address for X on Gyro  
  Wire.beginTransmission(GYRO);
  Wire.send(REG_GYRO_X); //Register Address GYRO_XOUT_H
  Wire.endTransmission();

  // New read the 12 data bytes
  Wire.beginTransmission(GYRO);
  Wire.requestFrom(GYRO,12); // Read 12 bytes
  i = 0;
  while(Wire.available()){
    buffer[i] = Wire.receive();
    i++;
  }
  Wire.endTransmission();

  //Combine bytes into integers
  // Gyro format is MSB first
  IMU[0] = buffer[0] << 8 | buffer[1];
  IMU[1] = buffer[2] << 8 | buffer[3];
  IMU[2] = buffer[4] << 8 | buffer[5];
  // Accel is LSB first. Also because of orientation of chips
  // accel y output is in same orientation as gyro x
  // and accel x is gyro -y
  IMU[3] = buffer[7] << 8 | buffer[6];
  IMU[4] = buffer[9] << 8 | buffer[8];
  IMU[5] = buffer[11] << 8 | buffer[10];
}

void calibrarIMU(){
  //Numero de Muestras para calibracin
  int muestras = 500;
  //Limpiamos el Vector
  for(int n=0;n<=5;n++){
    zeroIMU[n] = 0;
  }
  for(int n=0;n<=5;n++){
    tempIMU[n] = 0;
  }
  //Sumamos para para el Promedio
  for(int n=0;n<muestras;n++){
    getIMU();
    for(int n=0;n<5;n++){
      tempIMU[n] = tempIMU[n] + IMU[n];    
    }
  }
  //Dividimos y obtenemos el promdio
  for(int n=0;n<5;n++){
    zeroIMU[n] = tempIMU[n] / muestras;
  }
  zeroIMU[5] = 0; //Correccion segun datasheet

}

void setup(){
  Serial.begin(9600);
  Wire.begin();
  configIMU();
  calibrarIMU();
}

void leerIMU(){
  //Numero de Muestras para lectura
  int muestras = 10;
  //Limpiamos el Vector
  for(int n=0;n<=5;n++){
    tempIMU[n] = 0;
  }
  //Sumamos para para el Promedio
  for(int n=0;n<muestras;n++){
    getIMU();
    for(int n=0;n<=5;n++){
      tempIMU[n] = tempIMU[n] + IMU[n];    
    }
  }
  //Dividimos y obtenemos el promdio y restamos el valor de Calibracion
  for(int n=0;n<=5;n++){
    IMU[n] = (tempIMU[n] / muestras)-zeroIMU[n];    
  }
}

void printADXL345(){
  Serial.print(IMU[3]);  // echo the number received to screen
  Serial.print(",");
  Serial.print(IMU[4]);  // echo the number received to screen
  Serial.print(",");    
  Serial.println(IMU[5]);  // echo the number received to screen    
}

void printIMU3000(){
  Serial.print(IMU[0]);  // echo the number received to screen
  Serial.print(",");
  Serial.print(IMU[0]);  // echo the number received to screen
  Serial.print(",");    
  Serial.println(IMU[0]);  // echo the number received to screen    
}

void loop(){
  leerIMU();
}

now i have a simple question... Why  STD_LOOP_TIME  =  9?
15  International / Español / Re: Devolver un array de una funcion on: February 21, 2012, 06:19:16 pm
basicamente necesito algo como esto

Code:
void valores(){
    int a() = {14,2,4,5,6,7};
    return a
}

como puedo hacer algo asi... y como acceder a esa funcion... y que me retorne un array...
Pages: [1] 2