Show Posts
Pages: [1]
1  Using Arduino / Storage / Re: Datalogger and 2 Accelerometers on: November 11, 2012, 08:52:49 am
IT WORKED!!! Thanks a lot smiley-grin
2  Using Arduino / Storage / Re: Datalogger and 2 Accelerometers on: November 11, 2012, 08:31:11 am
I'm using a Duemilanove clone board. Tomorrow my Leonardo should be arriving in the post so maybe if i try it on it, it'll work. But for now i'll try using the F() function. Thanks man
3  Using Arduino / Storage / Datalogger and 2 Accelerometers on: November 11, 2012, 03:04:48 am
So this is my second post in this forum. At first I was asking about being able to use I2C and SPI protocols simultaneously and was told that it was possible. Now the problem is that i got the 2 accelerometers to work together (both I2C) and i am able to initialise the SD card, but when i try to open a file and write, the program just freezes. This is the part of the code having to do with the SD card:

//Initialize Card in void setup()
  if (!SD.begin(CS_pin))
  {
      Serial.println("Card Failure");
      return;
  }
  Serial.println("Card Ready");

//Open file in void loop() after filtering the 6 values for the acc. and then outputting them to serial
    int output1=movingAvarageFilter.process(acc_Front.value.x);
    int output2=movingAvarageFilter1.process(acc_Front.value.y);
    int output3=movingAvarageFilter2.process(acc_Front.value.z);     
    int output4=movingAvarageFilter3.process(acc_Rear.value.x);
    int output5=movingAvarageFilter4.process(acc_Rear.value.y);
    int output6=movingAvarageFilter5.process(acc_Rear.value.z);
   
    Serial.print(output1); Serial.print(",");
    Serial.print(output2); Serial.print(",");
    Serial.print(output3); Serial.print(",");
    Serial.print(output4); Serial.print(",");
    Serial.print(output5); Serial.print(",");
    Serial.println(output6);

   File logFile = SD.open("LOG.csv", FILE_WRITE);
  if (logFile)
  {
    logFile.println("Hello");

    logFile.close();
  }
  else
  {
    Serial.println("Couldn't open log file");
  }


4  Using Arduino / Networking, Protocols, and Devices / Re: Simultaneous SPI and I2C communication on: November 11, 2012, 03:03:00 am
Thanks for your links Nick. I did some further research on the matter of the SPI and I2C sharing data buses, and all the schematics i saw never showed any connection between the two. With regards to the program freezing when i open a file in the SD card, that is still happening. I am using the MPU6050 accelerometers and yesterday was able to get them to work simultaneously without using the MPY6050 library. Now i am still able to initialize the card but still can't open files. This is the code having to do with the SD card:

//Initialize Card in void setup()
  if (!SD.begin(CS_pin))
  {
      Serial.println("Card Failure");
      return;
  }
  Serial.println("Card Ready");

//Open file in void loop() after filtering the 6 values for the acc. and then outputting them to serial
    int output1=movingAvarageFilter.process(acc_Front.value.x);
    int output2=movingAvarageFilter1.process(acc_Front.value.y);
    int output3=movingAvarageFilter2.process(acc_Front.value.z);     
    int output4=movingAvarageFilter3.process(acc_Rear.value.x);
    int output5=movingAvarageFilter4.process(acc_Rear.value.y);
    int output6=movingAvarageFilter5.process(acc_Rear.value.z);
   
    Serial.print(output1); Serial.print(",");
    Serial.print(output2); Serial.print(",");
    Serial.print(output3); Serial.print(",");
    Serial.print(output4); Serial.print(",");
    Serial.print(output5); Serial.print(",");
    Serial.println(output6);

   File logFile = SD.open("LOG.csv", FILE_WRITE);
  if (logFile)
  {
    logFile.println("Hello");

    logFile.close();
  }
  else
  {
    Serial.println("Couldn't open log file");
  }
5  Using Arduino / Networking, Protocols, and Devices / Re: Simultaneous SPI and I2C communication on: November 08, 2012, 07:15:11 am
Thanks for you reply Graynomad. I don't believe everything that is said in a forum, but i always do research about anything that might be an issue concerning my case. In fact, other than that forum, I couldn't find anything about the I2C and SPI sharing the data bus, so that's why I decided to post something here, to get some opinions.

With regards to the code, it could be that I have some errors but I kept the code quite similar to that on the SD library examples but it definitely needs some more work. I am currently not at home so I can't post the code but if I fail in making it work, i will definitely do so. At least now i know that i might have a chance of solving it software wise.

Thanks again.
6  Using Arduino / Networking, Protocols, and Devices / Re: Simultaneous SPI and I2C communication on: November 08, 2012, 02:52:16 am
I was doing some research about it and i found that on a forum. The problem is when i was retrieving data from the I2C bus, the moment i open the file on the SD card, the program halts. I went looking around to see what the problem was and i read that the SDA and SCL are also the DIN and DOUt buses of the SPI protocol =/
7  Using Arduino / Networking, Protocols, and Devices / Simultaneous SPI and I2C communication on: November 07, 2012, 06:29:03 pm
Hi, so basically I am trying to connect 2 accelerometers to the arduino via the I2C protocol and then logging the readings onto an SD card using the Wireless SD shield, which uses the SPI protocol. As some may know, the data buses are shared between I2C and SPI and hence I have a problem when trying to write to the SD card and  read from the accelerometers. Is there any way the 2 protocols can be implemented together or is there maybe one of the arduino boards which has seperate buses for the two protocols?

Thanks
Pages: [1]