Problem <Wire.lib> and <OneWire.lib> and <RTClib.h>

Hi Folks,

i am using a DHT11 sensor and a DS1820 Sensor to read some data and write them to a connetced sd-card and to the usb-port, so i can catch the datas with pc-software - this works well.
Since now i pushed the pc datetime into the stream that was written to get a timestamp for the read datas.

i am using actual the follwoing libs:
#include <OneWire.h>
#include <SoftwareSerial.h>
#include <dht11.h>
#include <SPI.h>
#include <SD.h>
//#include <Wire.h>
//#include <RTClib.h>

Now i got a RTC DS1307 and connected it to the I2C-Pins on an UNO - this works well also, but only “stand alone”, means the demo sketch is working fine.

when i then want to read the datas from within my sketch there a problem occurs- the chip resets after some seconds each time.
when i disable the <RTClib.h> and the <Wire.h> then all works fine (after REMming the parts which needs the libs)

Does anyone know what is going wrong ?

This is the demo code i am using and which works well:

// Date and time functions using just software, based on millis() & timer

#include <Wire.h>
#include "RTClib.h"

RTC_Millis RTC;

void setup () {
    Serial.begin(57600);
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.begin(DateTime(__DATE__, __TIME__));
}

void loop () {
    DateTime now = RTC.now();
    
    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.println();
    
    Serial.print(" seconds since 1970: ");
    Serial.println(now.unixtime());
    
    // calculate a date which is 7 days and 30 seconds into the future
    DateTime future (now.unixtime() + 7 * 86400L + 30);
    
    Serial.print(" now + 7d + 30s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
    
    Serial.println();
    delay(3000);
}

As you see, not really complicated code, even i the part at the buttom is not needed, only date and time.
As written, works fine - but not after implementing in my code.

With so many libraries, you might run out of RAM on the Arduino Uno.
You could take a look here, http://playground.arduino.cc/Code/AvailableMemory
Perhaps you can add a function that displays the free RAM in setup().

Or some libraries use the same timer. But I don’t know which library uses which timer.

I implemented this code for checking the ram:

int freeRam () {
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

Output this way:

  Serial.println(freeRam());

Right after start 321 war written, after loading all and making the 1st measuring turn the output is 317 (without the named 2 libs)

Hi, Take a look at: http://arduino-info.wikispaces.com/CombiningArduinoSketches

Which has some guidance on combining stuff...