Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

lilcano

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 22 total)
  • Author
    Posts
  • in reply to: inconsistent Results #2191
    lilcano
    Participant

      Hello Hicks,

      Thanks for the reply, the sensors are buried completely in the soil as for the length i did not really measure that. Please see the attached file for the complete sketch running on the Arduino, and let me know what you think.

      Thanks

      in reply to: inconsistent Results #2179
      lilcano
      Participant

        Hello Sara,

        Thanks for the reply, attached is a copy of the actual raw data and the sensor and arduino are actually places in a field(so not a controlled environment). I was expecting the VWC to reduce with time and not the sinusoidal behavior, Equally the Ea will give similar curve because its used to calculate the VWC using the Topps equation. Please can you take a look at the attached raw data and advice?

        Attachments:
        in reply to: inconsistent Results #2177
        lilcano
        Participant

          Hello,

          I just checked again and yes i am plotting the VWC. As for the collection of the data i am actually using an SD card shield on the arduino to store the data. As you can see from the image there are two curves each one for the different sensors placed at the same location. After getting this results i decided to take out the SD card shield and run the attach sketch with the arduino connected to my computer and unfortunately i obtain similar results on the arduino IDE serial monitor. please any ideas?

          in reply to: inconsistent Results #2172
          lilcano
          Participant

            Hello,
            Thanks for the quick response.Bellow is the sketch running on the arduino Uno R3. The devices where actually tested on the field(not in a controlled environment).The results shown on the plot is VMC collected every minute from the sensors. Actually the VWC is expected to reduce with time, these results are collected over a period of 3 days. Surprisingly they show a sinusoidal curve and the sensors are places in a sandy loam soil. I am thinking maybe the sketch has some problem. Please do you have any ideas why such results?

            Attachments:
            in reply to: Arduino datalogger #2081
            lilcano
            Participant

              So i have decided to improve my project by adding a data logger shield from adafruit. can seam to get the data from the attached decagon 5TM sensors. Please can any one help with what i am doing wrong in my sketch.

              #include <SPI.h>
              #include <SD.h>
              #include <Wire.h>
              #include “RTClib.h”
              #include <SDI12.h>

              // A simple data logger for the Arduino digital pins

              // how many milliseconds between grabbing data and logging it. 1000 ms is once a second
              #define LOG_INTERVAL 60000 // mills between entries (reduce to take more/faster data)

              // how many milliseconds before writing the logged data permanently to disk
              // set it to the LOG_INTERVAL to write each time (safest)
              // set it to 10*LOG_INTERVAL to write all data every 10 datareads, you could lose up to
              // the last 10 reads if power is lost but it uses less power and is much faster!
              #define SYNC_INTERVAL 60000 // mills between calls to flush() – to write data to the card
              uint32_t syncTime = 0; // time of last sync()

              #define ECHO_TO_SERIAL 1 // echo data to serial port
              #define WAIT_TO_START 0 // Wait for serial input in setup()

              // the digital pins that connect to the LEDs
              #define redLEDpin 2
              #define greenLEDpin 3

              #define DATAPIN 7 // change to the proper pin for sdi-12 data pin, I prefer D7
              SDI12 mySDI12(DATAPIN);

              // The analog pins that connect to the sensors
              //#define photocellPin 0 // analog 0
              //#define tempPin 1 // analog 1
              //#define BANDGAPREF 14 // special indicator that we want to measure the bandgap

              //#define aref_voltage 3.3 // we tie 3.3V to ARef and measure it with a multimeter!
              //#define bandgap_voltage 1.1 // this is not super guaranteed but its not -too- off

              RTC_PCF8523 RTC; // define the Real Time Clock object

              // for the data logging shield, we use digital pin 10 for the SD cs line
              const int chipSelect = 10;

              // the logging file
              File logfile;
              void tmMeasurement(char c);

              void error(char *str)
              {
              Serial.print(“error: “);
              Serial.println(str);

              // red LED indicates error
              digitalWrite(redLEDpin, HIGH);

              while(1);
              }

              void setup(void)
              {
              Serial.begin(9600);
              Serial.println();

              // use debugging LEDs
              pinMode(redLEDpin, OUTPUT);
              pinMode(greenLEDpin, OUTPUT);

              #if WAIT_TO_START
              Serial.println(“Type any character to start”);
              while (!Serial.available());
              #endif //WAIT_TO_START

              // initialize the SD card
              Serial.print(“Initializing SD card…”);
              // make sure that the default chip select pin is set to
              // output, even if you don’t use it:
              pinMode(10, OUTPUT);

              // see if the card is present and can be initialized:
              if (!SD.begin(chipSelect)) {
              error(“Card failed, or not present”);
              }
              Serial.println(“card initialized.”);

              // create a new file
              char filename[] = “LOGGER00.CSV”;
              for (uint8_t i = 0; i < 100; i++) {
              filename[6] = i/10 + ‘0’;
              filename[7] = i%10 + ‘0’;
              if (! SD.exists(filename)) {
              // only open a new file if it doesn’t exist
              logfile = SD.open(filename, FILE_WRITE);
              break; // leave the loop!
              }
              }

              if (! logfile) {
              error(“couldnt create file”);
              }

              Serial.print(“Logging to: “);
              Serial.println(filename);

              // connect to RTC
              Wire.begin();
              if (!RTC.begin()) {
              logfile.println(“RTC failed”);
              #if ECHO_TO_SERIAL
              Serial.println(“RTC failed”);
              #endif //ECHO_TO_SERIAL
              }

              logfile.println(“millis,stamp,datetime,sensor,ea,vwc,temp “);

              #if ECHO_TO_SERIAL
              Serial.println(“Sketch for sampling multiple SDI12 sensors”);
              Serial.println(“millis,stamp,datetime,sensor,ea,temp”);

              #endif //ECHO_TO_SERIAL

              Serial.println();
              // If you want to set the aref to something other than 5v
              //analogReference(EXTERNAL);
              delay(1000);
              }

              void loop(void)
              {

              //Now lets look at the timestamp
              DateTime now;

              // delay for the amount of time we want between readings
              delay((LOG_INTERVAL -1) – (millis() % LOG_INTERVAL));

              digitalWrite(greenLEDpin, HIGH);

              // log milliseconds since starting
              uint32_t m = millis();
              logfile.print(m); // milliseconds since start
              logfile.print(“, “);
              #if ECHO_TO_SERIAL
              Serial.print(m); // milliseconds since start
              Serial.print(“, “);
              #endif

              // fetch the time
              now = RTC.now();
              // log time
              logfile.print(now.unixtime()); // seconds since 1/1/1970
              logfile.print(“, “);
              logfile.print(‘”‘);
              logfile.print(now.year(), DEC);
              logfile.print(“/”);
              logfile.print(now.month(), DEC);
              logfile.print(“/”);
              logfile.print(now.day(), DEC);
              logfile.print(” “);
              logfile.print(now.hour(), DEC);
              logfile.print(“:”);
              logfile.print(now.minute(), DEC);
              logfile.print(“:”);
              logfile.print(now.second(), DEC);
              logfile.print(‘”‘);
              #if ECHO_TO_SERIAL
              Serial.print(now.unixtime()); // seconds since 1/1/1970
              Serial.print(“, “);
              Serial.print(‘”‘);
              Serial.print(now.year(), DEC);
              Serial.print(“/”);
              Serial.print(now.month(), DEC);
              Serial.print(“/”);
              Serial.print(now.day(), DEC);
              Serial.print(” “);
              Serial.print(now.hour(), DEC);
              Serial.print(“:”);
              Serial.print(now.minute(), DEC);
              Serial.print(“:”);
              Serial.print(now.second(), DEC);
              Serial.print(‘”‘);
              #endif //ECHO_TO_SERIAL
              //for(char j=’1′;j<=’3’;j++){
              tmMeasurement(j);
              //}
              Serial.println();
              }
              //delay(1000);
              // Now lets look at collecting the data from the sensors

              void tmMeasurement(char c){
              String command = “”;
              float Ea = 0.0;
              float temp = 0.0;
              float VWC = 0.0;
              command += c;
              command += “M!”; // SDI-12 measurement command format [address][‘M’][!]
              mySDI12.sendCommand(command);
              delay(500); // wait a sec
              mySDI12.flush();

              command = “”;
              command += c;
              command += “D0!”; // SDI-12 command to get data [address][D][dataOption][!]
              mySDI12.sendCommand(command);
              delay(500);

              if(mySDI12.available() > 0){
              int channel = mySDI12.parseInt();
              Ea = mySDI12.parseFloat();
              temp = mySDI12.parseFloat();

              VWC = (4.3e-6*(Ea*Ea*Ea)) – (5.5e-4*(Ea*Ea)) + (2.92e-2 * Ea) – 5.3e-2 ; //the TOPP equation used to calculate VWC

              logfile.print(“, “);
              logfile.print(channel);
              logfile.print(“, “);
              logfile.print(Ea);
              logfile.print(“, “);
              logfile.print(VWC);
              logfile.print(“, “);
              logfile.print(temp);

              #if ECHO_TO_SERIAL
              Serial.print(“, “);
              Serial.print(channel);
              Serial.print(“, “);
              Serial.print(Ea);
              Serial.print(“, “);
              Serial.print(VWC);
              Serial.print(“, “);
              Serial.print(temp);

              #endif //ECHO_TO_SERIAL
              /*/analogRead(photocellPin);
              //delay(10);
              //int photocellReading = analogRead(photocellPin);

              //analogRead(tempPin);
              //delay(10);
              int tempReading = analogRead(tempPin);

              // converting that reading to voltage, for 3.3v arduino use 3.3, for 5.0, use 5.0
              float voltage = tempReading * aref_voltage / 1024;
              float temperatureC = (voltage – 0.5) * 100 ;
              float temperatureF = (temperatureC * 9 / 5) + 32;

              logfile.print(“, “);
              logfile.print(photocellReading);
              logfile.print(“, “);
              logfile.print(temperatureF);
              #if ECHO_TO_SERIAL
              Serial.print(“, “);
              Serial.print(photocellReading);
              Serial.print(“, “);
              Serial.print(temperatureF);
              #endif //ECHO_TO_SERIAL
              */

              /*
              // Log the estimated ‘VCC’ voltage by measuring the internal 1.1v ref
              analogRead(BANDGAPREF);
              delay(10);
              int refReading = analogRead(BANDGAPREF);
              float supplyvoltage = (bandgap_voltage * 1024) / refReading;

              logfile.print(“, “);
              logfile.print(supplyvoltage);
              #if ECHO_TO_SERIAL
              Serial.print(“, “);
              Serial.print(supplyvoltage);
              #endif // ECHO_TO_SERIAL

              logfile.println();
              #if ECHO_TO_SERIAL
              Serial.println();
              #endif // ECHO_TO_SERIAL
              */
              digitalWrite(greenLEDpin, LOW);

              // Now we write data to disk! Don’t sync too often – requires 2048 bytes of I/O to SD card
              // which uses a bunch of power and takes time
              if ((millis() – syncTime) < SYNC_INTERVAL) return;
              syncTime = millis();

              // blink LED to show we are syncing data to the card & updating FAT!
              digitalWrite(redLEDpin, HIGH);
              digitalWrite(redLEDpin, LOW);
              }
              logfile.flush();

              }

              in reply to: Arduino datalogger #2012
              lilcano
              Participant

                i tied changing the baud rate as you suggested, but unfortunately i see the characters when i print use the arduino software serial monitor. when i use the X-ctu console i don’t have the characters.

                Wondering do you have any specific arduino boards you will recommend for use in outdoor experiments?

                Thanks

                in reply to: Arduino datalogger #2001
                lilcano
                Participant

                  What I mean by “its not working” is, I still have some extra characters on the Arduino serial monitor when the message “goodnight moon” is printed.
                  I am using an FTDI cable 5V VCC-3.3V I/O to program the Arduino Fio.
                  During the programming I make sure the Xbee is not on the Fio board.
                  For the configuration of the Xbee modules I used the XCTU software changing the baud rate of both xbees to 57600.
                  The second xbee is connected to the PC with the help of xbee explorer from sparkfun and its set to coordinator mode.

                  What I really want to try is print a message from the Arduino to the Arduino serial monitor without any extra characters using the Xbee modules installed.

                  Thanks

                  in reply to: Arduino datalogger #1993
                  lilcano
                  Participant

                    Bellow is a sample sketch I am trying to run to make sure I get the software serial going but still it doesn’t work.

                    #include <SoftwareSerial.h>

                    SoftwareSerial mySerial(10, 11); // RX, TX

                    void setup() {
                      // Open serial communications and wait for port to open:
                      Serial.begin(57600);
                      while (!Serial) {
                        ; // wait for serial port to connect. Needed for native USB port only
                      }

                      Serial.println(“Goodnight moon!”);

                      // set the data rate for the SoftwareSerial port
                      mySerial.begin(4800);
                      mySerial.println(“Hello, world?”);
                    }

                    void loop() { // run over and over
                      if (mySerial.available()) {
                        Serial.write(mySerial.read());
                      }
                      if (Serial.available()) {
                        mySerial.write(Serial.read());
                      }
                    }

                    in reply to: Arduino datalogger #1979
                    lilcano
                    Participant

                      I am transmitting the data to another xbee connected to my computer with the help of the xbee explorer and its setup as coordinator. I tried using the softwareSerial library and connecting the Tx and Rx ports to pins 10 and 11, but the results did not get better. Please let me know if you have any other idea.

                      in reply to: Arduino datalogger #1976
                      lilcano
                      Participant

                        I am using the Arduino Fio, because it has Xbee slots already available on the board. As of the board rate when programming the Xbee I set them to 57600. So I think that’s not the problem. I am trying to see how many hardware serial ports Fio has. I will think they should have more than 1 port for the transmission since they already support xbee modules on the board. Do you think I meight have an issue with the programming of the xbee?

                        Thanks

                      Viewing 10 posts - 1 through 10 (of 22 total)