I'm working on a project using an arduino Nano (official) and two peripherals from Atlas Scientific (pH and DO) communicating via i2c. Everthing works fine when i use a usb alimentation connected to the PC or to a 5V adaptater (typically a phone charger).
I want to use a 12V battery and a 12V DC 1.5A adaptater to power up my system, the problem is that it works fine for a moment (30 to 40 seconds) and then the pH start having problem with the communication and the led becomes red and the TX/RX leds from the arduino (which are connected to nothing start going crazy. I use 4.7k pull up resistors and an L7805ACV voltage regulator to go from 12 to 5V.
Attach, a part of the system schematics.
If you have any clue, starting to be new idealess
EDIT : Here is the part of the program concerning the i2c communication :
#include "Wire.h"
/*********************************************************************************************************
* Address
*********************************************************************************************************
*/
int pH_address = 99;
int DO_address = 97;
/*********************************************************************************************************
* i2C CONFIGURATION
*********************************************************************************************************
*/
byte received_from_computer = 0;
char sensor_data[20];
byte in_char_sensor = 0;
byte j = 0;
byte code = 0;
int time_ = 850;
void setup()
{
Wire.begin();
}
void loop()
{
pH = Get_i2C(pH_address);
delay(200);
DO = Get_i2C(DO_address);
delay(200);
}
/**********************************************************************************************************
* i2C
* ********************************************************************************************************
*/
float Get_i2C(int address)
{
char computerdata = 'R';
Wire.beginTransmission(address);
Wire.write(computerdata);
Wire.endTransmission();
delay(time_);
Wire.requestFrom(address, 16, 1);
code = Wire.read();
while (Wire.available())
{
in_char_sensor = Wire.read();
sensor_data[j] = in_char_sensor;
j += 1;
if (in_char_sensor == 0)
{
j = 0;
break;
}
}
return atof(sensor_data);
}