Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: I2c sensor programming help needed. on: August 23, 2013, 04:19:12 pm
Arduino uno has a 3.3v output so no level shifter is necessary. SCL/SDA ports are wired properly. The fact is, I've tested it with a different code and I'm getting the correct reading.But for some reason I need to specifically use this code.
2  Using Arduino / Programming Questions / Re: I2c sensor programming help needed. on: August 23, 2013, 04:01:20 pm
as far as I know, all I2c devices should be able to work with the same code. only the address needs to be changed to specify which device we want to communicate with. Correct me if I'm wrong.
3  Using Arduino / Programming Questions / I2c sensor programming help needed. on: August 23, 2013, 03:38:58 pm
I have a small problem I hope someone having experience with sensors can resolve. I'm using a digital compass sensor hmc5883l. The code to read the compass heading is for a different compass model hmc6352. For some reason I need to use this code for my sensor. So I changed the slave read/write address in the code but it still doesn't work. What else do I need to change. I have very little knowledge about i2c devices.

slave read address for hmc5883l= 0x3D
slave write address for hmc5883l= 0x3C

Code for hmc6352 is posted below

Code:
#include <Wire.h>

int HMC6352Address = 0x42;
int slaveAddress;
byte headingData[2];
int i, headingValue;
int headingcompass;

void setup(){
slaveAddress = HMC6352Address >> 1;  
Wire.begin();
Serial.begin(115200);

}

void loop(){

Wire.beginTransmission(slaveAddress);        //the wire stuff is for the compass module

  Wire.send("A");              

  Wire.endTransmission();

  delay(10);                  

  Wire.requestFrom(slaveAddress, 2);      

  i = 0;

  while(Wire.available() && i < 2)

  {

    headingData[i] = Wire.receive();

    i++;

  }

  headingValue = headingData[0]*256 + headingData[1];

 int pracheading = headingValue / 10;      // this is the heading of the compass

 if(pracheading>0){

   headingcompass=pracheading;

 }

Serial.println("current heading:");

Serial.println(headingcompass);
}
4  Using Arduino / Sensors / Re: Problem with my GPS on: March 20, 2013, 08:32:39 am
I took it outside but still didn't work.. smiley-sad
5  Using Arduino / Sensors / Problem with my GPS on: March 20, 2013, 04:52:37 am
I recently bought a GPS module (vpn1513) in order to start working on my project which is building an autonomous guided vehicle. I can't wrap my head around this GPS module.
I tried to setup and program my GPS as mentioned in the following site

http://playground.arduino.cc/Tutorials/GPS

and the code I'm using :

Code:
*/

 #include <string.h>
 #include <ctype.h>

 int ledPin = 13;                  // LED test pin
 int rxPin = 0;                    // RX PIN
 int txPin = 1;                    // TX TX
 int byteGPS=-1;
 char linea[300] = "";
 char comandoGPR[7] = "$GPRMC";
 int cont=0;
 int bien=0;
 int conta=0;
 int indices[13];

 void setup() {
   pinMode(ledPin, OUTPUT);       // Initialize LED pin
   pinMode(rxPin, INPUT);
   pinMode(txPin, OUTPUT);
   Serial.begin(4800);
   for (int i=0;i<300;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }   
 }

 void loop() {
   digitalWrite(ledPin, HIGH);
   byteGPS=Serial.read();         // Read a byte of the serial port
   if (byteGPS == -1) {           // See if the port is empty yet
     delay(100);
   } else {
     linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
     conta++;                     
     Serial.print(byteGPS, BYTE);
     if (byteGPS==13){            // If the received byte is = to 13, end of transmission
       digitalWrite(ledPin, LOW);
       cont=0;
       bien=0;
       for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
         if (linea[i]==comandoGPR[i-1]){
           bien++;
         }
       }
       if(bien==6){               // If yes, continue and process the data
         for (int i=0;i<300;i++){
           if (linea[i]==','){    // check for the position of the  "," separator
             indices[cont]=i;
             cont++;
           }
           if (linea[i]=='*'){    // ... and the "*"
             indices[12]=i;
             cont++;
           }
         }
         Serial.println("");      // ... and write to the serial port
         Serial.println("");
         Serial.println("---------------");
         for (int i=0;i<12;i++){
           switch(i){
             case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
             case 1 :Serial.print("Status (A=OK,V=KO): ");break;
             case 2 :Serial.print("Latitude: ");break;
             case 3 :Serial.print("Direction (N/S): ");break;
             case 4 :Serial.print("Longitude: ");break;
             case 5 :Serial.print("Direction (E/W): ");break;
             case 6 :Serial.print("Velocity in knots: ");break;
             case 7 :Serial.print("Heading in degrees: ");break;
             case 8 :Serial.print("Date UTC (DdMmAa): ");break;
             case 9 :Serial.print("Magnetic degrees: ");break;
             case 10 :Serial.print("(E/W): ");break;
             case 11 :Serial.print("Mode: ");break;
             case 12 :Serial.print("Checksum: ");break;
           }
           for (int j=indices[i];j<(indices[i+1]-1);j++){
             Serial.print(linea[j+1]);
           }
           Serial.println("");
         }
         Serial.println("---------------");
       }
       conta=0;                    // Reset the buffer
       for (int i=0;i<300;i++){    // 
         linea[i]=' ';             
       }                 
     }
   }
 }

The GPS light keeps blinking and all I see is nothing on the serial monitor. I tried changing the baud rate and different codes but I get the same problem, either I get a rubbish value or nothing at all.

Can somebody please tell me what I might be doing wrong?

here's how I have setup my GPS with arduino.



6  International / India / Re: ML-1400 PLC and arduino on: March 20, 2013, 04:38:00 am
How do u start a new post on arduino forum?
7  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: March 16, 2013, 03:57:55 pm
Thanks for clearing it up. Will definitely have to get a converter circuit then..
8  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: March 16, 2013, 03:53:35 pm
I don't think there is a need for any logic level converter device since the arduino I'm using already gives a 3.3V signal.

Thanks for the quick responses. Really hope I learn something from this tutorial.
9  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: March 16, 2013, 03:44:20 pm
Tell me if I have configured it correctly

Acc_Gyro          Arduino
3.3V       <—>   3.3V   
GND       <—>   GND
X           <—>   AN0
Y           <—>   AN1
Z           <—>   AN2
SDA        <—>   AN4
SCL        <—>    AN5 
10  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: March 16, 2013, 03:31:59 pm
Thanks! this really helps but aren't A4 and A5 analog input pins?
11  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: March 16, 2013, 03:10:17 pm
Hey Lauszus!

I was hoping to learn something about using IMU effectively with the help of Kalman filtering as I came across this wonderful tutorial. The only problem I have is I have 2 separate gyro and accelerometer modules (L3G4200D and ADXL 335). How do I combine and use them according to your pin config.

gyro has pins GND, VIN, SCL, SDA, SDD, INT1, INT2 and accelerometer pins are VCC, GND,X,Y,Z,ST. Where do these pins go?



Thanks!
Pages: [1]