Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / MPP Tracker on: October 29, 2012, 01:06:07 pm
Refering to http://en.wikipedia.org/wiki/Maximum_power_point_tracking

The MPPT regulates the voltage to the value required (U*I=maximum).

But how to regulate a Solar Module?
For Example my own small 6V, 400mA Module?
How can i regulate it like the MPP Tracker do? And set it so 5.7V e.g.?
2  International / Deutsch / Re: Datenlogger auf SD Karte on: October 09, 2012, 01:12:14 pm
Die gemessene Eingangsspannung von 0 bis 5 Volt wird ja in int Werten von 0 bis 1023 gemessen. Das sind 1024 steps.
Muss es dann nicht in Code Zeile 63 bis 66 " ... /1024.0"  heißen? Oder denke ich gerade einfach falsch?
3  Using Arduino / Displays / Re: How many displays on one device? on: August 12, 2012, 01:35:23 am
it depends on your display(s) (exactly type?)! for my 1602A LCD (16 columns, 2 rows) i'll need 3PWM and 3 DigitilOuts. So i could connect two of them to my uno.
4  International / Deutsch / Re: Rechnen on: August 11, 2012, 02:26:49 pm
Die AnalogenInputs messen die 5V in 1024 Schritten. Von 0 bis 1023.

Code:
value = analogRead(analogInput);
vout = (value * 5.0) / 1024; // Der Wert den wir messen
vin = vout / (R2/(R1+R2)); // Spannungsteiler-Umrechnung

So mache ich das immer, die Werte stimmen auch mit einer Abweichung von maximal +/- ~ 0.05V mit meinem GoOn!  smiley-cool Multimeter überein.
Zusätzlich hab ich den Eingang dann noch mit einer Z-Diode abgesichert, falls mal mehr als 5V dran schwappen.

Nur keine Ahnung ob dir das jetzt hilft oder voll vorbei ist.
5  Using Arduino / Storage / Re: Where are my datas? on: May 26, 2012, 02:05:19 pm
Close() followed by open() is the wrong way to go.  It take a long time to open a file and position to the end.
I don't want to open the same file i was closing. close firstfile.txt open secondfile.txt


You can call flush() or sync() as often as you like but it will cost 2048 bytes of I/O to the SD.  A 512 byte block will be written to update the data on the SD, a 512 byte block containing the directory entry  will be read, updated and written back, then the 512 byte data block will be read back into the block buffer.

I'm recording a measuring value every 0.025 sec ~6 hours long in csv format. 
So this would be ~864000 lines.
What would you advise me? Periodically sync?

I am the author of SdFat which is the base library for the official SD.h library.
I know   smiley-wink
6  Using Arduino / Storage / Re: Where are my datas? on: May 26, 2012, 09:09:56 am
Quote
So it would be best to collect data until RAM is nearly full, then close the file, and open a new file instead of reopening and relocating...
Depends on whether speed or no-loss-of-data is more important.
Speed....AND no-loss-of-data too  smiley-cool
7  Using Arduino / Storage / Re: Where are my datas? on: May 26, 2012, 08:57:25 am
The only way to ensure that data is committed to the file is to close it. The tradeoff is that closing, reopening, and relocating the insertion point is slow. Doing so will reduce the rate at which you can write to the file.

hmm :-/
So it would be best to collect data until RAM is nearly full, then close the file, and open a new file instead of reopening and relocating...
8  Topics / Science and Measurement / Re: Data Logging High frequency / long time...enormous file! Modify sketch on: May 26, 2012, 05:58:29 am

This sketch works fine for my requests. Unfortunately I collect data for long time, close to week and with high frequency up to 10 sample/min 10HZ, causing really big file after one week, and some problem when try to open with excel.



Excel is not made for handling such big files smiley further more, it is no scientific programm. I guess you're using csv format?
Try to import it with Octave or Matlab. Works fine for me while importing tons of data.
9  Using Arduino / Storage / Where are my datas? on: May 26, 2012, 05:49:01 am
Quote
When you use file.write(), it doesn't write to the card until you flush() or close(). Whenever you open a file, be sure to close it to save your data.

I guess they are in Arduino RAM until i flush or close? So i'm limited with keeping data open (i have from time to time close/flush if i don't want to loss my datas?)? Or am i completly wrong?
10  Using Arduino / Storage / Re: Writing limitations to SD card after ~250 writings? on: May 23, 2012, 02:52:11 pm
I'd do something like this:

Ah okey, this works fine. Thank you!
11  Using Arduino / Storage / Re: Writing limitations to SD card after ~250 writings? on: May 23, 2012, 02:33:30 pm
Code:
if(ch == 0)
How are you sending data to the Arduino? Sending a binary 0 seems like a strange thing to do.
With ch=Serial.read();
and now with char ch = '0';
don't?

startlogging() is incorrectly named, since it does not start the logging.
O_o but it starts. that works fine. stopping don't work.

The else clause is misplaced, now, since the file is not created in startlogging().
i've created the file when checking for ch (serial.read).
and startlogging will just execute when ch get's something else, but not 0. and if ch is not 0, i've opened the file.
12  Using Arduino / Storage / Re: SD card initialization failed. on: May 23, 2012, 02:23:42 pm
Like described in the subject my Arduino tells me that it couldn't open the SD card. My SD card is formatet with Fat16 and it has only 256 MB.
The Code I'm trying to run is the example "CardInfo" from the Arduino IDE 1.0 compiled with the IDE 1.0.

I connected the Arduino and the SD card like here:http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/8
Works fine for me. But just with SD Card, MMC failed. Mini/Micro SD never tested.

I changed the cs pin in the exaple to pin 10 because of the wiring above.

So you've edit the example code like that?:  const int chipSelect = 10;   
And CS Pin SD is realy connected to arduino Pin 10 ?


The whole thing is just for a simple data logger running with 3 3v batteries connected to the VIN. Because of this I have to power the SD card (it uses 3.3V for its logic level) over two more 3,3k and 1,8k resistors for dropping the supply voltage to something arround 3.3V.
Can't follow...
why don't you just use 3.3V output from your arduino? more specifically, you don't need external power supply for using sd card with arduino. just arduino is still enough.
13  Using Arduino / Storage / Re: Writing limitations to SD card after ~250 writings? on: May 23, 2012, 02:08:08 pm

Quote
so i have to open the file one time in void.setup when start logging and close it in void.setup when stop logging. (not try yet, will do it soon)
You could do it that way. I wouldn't. I'd open the file when the request came to start logging. I'd close it when the request came to stop logging.

yay, i was wrong with my explanation (bad english skills and interchanged void.setup and void.loop). i've meant just opening one time for logging and closing when stopping. however, like that way it seems to work now. but now i can't stop it anymore with 0 input on serial monitor.

the code looks now like this http://paste.osuv.de/index.php/tIyOO/
but there is a lot of unused waste in it now.
14  Using Arduino / Storage / Re: Writing limitations to SD card after ~250 writings? on: May 23, 2012, 01:47:55 pm

Quote
This fails now after ~40 writings.
Please describe how you detect a failure.

Code:
if (myFile) {
   
    myFile.print(startTime);
    myFile.print(", ");
    myFile.print(vout);
    myFile.println();
// close the file:
    //myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

i get "done" feedback in serial monitor for every print/write until it failed.

i'm guessing the library gets in trouble when to many files are opened !?

so i have to open the file one time in void.setup when start logging and close it in void.setup when stop logging. (not try yet, will do it soon)
but that would not explain why it fails in my first code version, where the file was opened and closed in every measure step.
15  Using Arduino / Storage / Re: Writing limitations to SD card after ~250 writings? on: May 23, 2012, 01:24:40 pm


Code:

  if (Serial.available()) //wenn daten am usb port ankommen
  {
  ch=Serial.read();
if(ch == 0)
{
halt();
}
else
{
startlogging();
}
}
}


Even if i use this code instead of the while loop, it fails writing after 23 times.

http://paste.osuv.de/index.php/0lM0/

Code:
/*
  Voltage-Logger
 
 SD Card Pins
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 10
 
Voltage-Input
analogInput = 1
 
 */
#include <SD.h>

File myFile;
  int analogInput = 1;
  int refresh = 200;
  float vout = 0.0;
  float vin = 0.0;
  float R1 = 46300.0;    // !! resistance of R1 !!
  float R2 = 4630.0;     // !! resistance of R2 !!
  int value = 0;
  long startTime;    // to keep track of when the last action was
  int duration = 100; // 0,1 sekunden
  char ch = '0'; //alles nur nicht 1, damit der loop nicht direkt am anfang ohne eingabe startet
 
   
   
   
    void setup(){

  // declaration of pin modes
  pinMode(analogInput, INPUT);
  // begin sending over serial port
  Serial.begin(9600);
 
   Serial.print("Initializing SD card...");
  pinMode(10, OUTPUT);
 
  if (!SD.begin(10)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

}


void loop()
{
 
 

  if (Serial.available()) //wenn daten am usb port ankommen
  {
  ch=Serial.read();
if(ch == 0)
{
halt();
}
else
{
startlogging();
}
}
}

// while (1) //while(true) = endlosschleife
// {
// if (Serial.available() >0) //wenn Serial Eingabe groesser als 0 ist
// {
// ch = Serial.read(); //lies am seriel inputt
// if (ch == '0') //wenn input == null ist
// halt(); //anhalten
// }
// if (ch == '1') // wenn input == 1 ist
// startlogging(); //start logging
//}
 
//}


void startlogging()
{
  startTime = millis(); 
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
 
 // if (millis() >= startTime + duration)     // delay

    // {
  myFile = SD.open("logging3.txt", FILE_WRITE);
 
  // if the file opened okay, write to it:
  if (myFile) {
   
    myFile.print(startTime);
    myFile.print(", ");
    myFile.print(vout);
    myFile.println();
// close the file:
    //myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
 
 delay(25);
 
}
//}

void halt()
{
  Serial.println("Nothing to do here...");
   myFile.close();
}
Pages: [1] 2