I have a arduino uno r3 connected to a microsd writer + ds1307 RTC (wemos d1 mini datalogger), as well as a INA219 current/voltage sensor. They were working flawlessly until my INA219 died.
When I removed the INA219 lines from the code, the DS1307 stopped working properly (if I put those lines back, DS1307 works. Here is my code:
#include <Wire.h>
#include <RTClib.h> //INCLUSÃO DA BIBLIOTECA
#include <SD.h>
#include <SPI.h>
#include <Adafruit_INA219.h>
RTC_DS1307 rtc; //OBJETO DO TIPO RTC_DS1307
Adafruit_INA219 ina219;
const int OnHour = 5; //SET TIME TO ON RELAY (24 HOUR FORMAT)
const int OnMin = 30;
const int OffHour = 18; //SET TIME TO OFF RELAY
const int OffMin = 45;
File sdcard_file;
int CS_pin = 10; // Pin 10 on Arduino
int Relay = 4;
long interval = 600; // Intervalo do LOG em segundos
long antes = 0;
long agora = 0;
float Vout = 0.0;
int voltageSensor = A3;
int value = 0;
void setup () {
Serial.begin(9600); //INICIALIZA A SERIAL
pinMode(Relay, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(Relay, LOW);
ina219.begin();
if (SD.begin())
{
Serial.println("SD card is ready to use.");
} else
{
Serial.println("SD card initialization failed");
return;
}
}
In the above code, I am referring to lines "#include <Adafruit_INA219.h>", "Adafruit_INA219 ina219;" and "ina219.begin();".
When I remove, arduino simply cannot get the time from DS1307, but the sd reader keeps working.
As my wemos d1 minidatalogger does not have pull up resistors onboard, my guess is that that part of the code somehow solve the pull up problem.
I would like to remove that part of the code and have everything working. Any help?