Everything fine using USB connection, everything fails under 12V power

I have

Arduino Uno
sparkfun SD shield
Garmin LVC 18x GPS
NMEA 0183 intelliducer depth sounder

Powering these I have
2 6V 1.5AH lead batteries
Cheap charge controller
18W solar panel

When I plug in the setup to my computer, everything reads fine, and the SD card records the data marvelously, but when I plug into the actual power I need it to be connected to (ie. the batteries) I get whack numbers, no numbers, whack text files, etc. I have tried plugging everything into the batteries alone and still I get the same problem. I have read other threads concerning this Here and Here but they all think it is the program. My program works flawlessly when plugged into the computer.

Batt Volt = 12.45V
Solar V = 12.5V
Wall V = 12.32V

Do I need to upgrade my batteries, or switch around the loads, or change the program, or ??? Below is code if necessary.

/* 

 *  
 *  Wiring
 *  
 *  GPS     <=>     Arduino
 *  Wht     <=>     D3 
 *  Grn     <=>     D2
 *  Red     <=>     5V
 *  Blk     <=>     G
 *  
 *  Sonar   <=>     Arduino
 *  Wht(+)  <=>     D5
 *  Blu(-)  <=>     D4
 *  Red     <=>     12V
 *  Blk     <=>     G(12V)
 *  
 */


// Libraries to include
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>

// Begin serial ports for the GPS and Sonar
SoftwareSerial gps(3, 2, 1); // RX, TX
SoftwareSerial sonar(5, 4, 1);

// Declare constants, strings, etc.
String Depth = "";              // A string to output Depth
String inputString1 = "";       // a string to hold incoming data
String inputString2 = "";       // a string to hold incoming data
const int chipSelect = 10;      // Required for the SD shield to talk with the Uno
File dataFile;                  // Prepares a file for writing to SD card
boolean stringComplete = false; // whether the string is complete
int a = 0;                      // is a test to see if gps/sonar has been heard
int com1;                       // Finding first comma in sonar output, float values can change, so need to select data between commas
int com2;                       // finding second comma in sonar output


void setup()
{
  Serial.begin(115200); // Terminal window begin rate
  gps.begin(4800);
  sonar.begin(4800);
  inputString1.reserve(200);
  inputString2.reserve(200);


  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(chipSelect, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  Serial.println("card initialized.");

  // Open up the file we're going to log to!
  dataFile = SD.open("datalog.txt", FILE_WRITE);
  if (! dataFile) {
    Serial.println("error opening datalog.txt");
    // Wait forever since we cant write data
    while (1) ;
  }
}

void loop() {
  sonar.listen();
  while (a == 0) {
    while (sonar.available()) {
      char inChar = (char)sonar.read();
      inputString1 += inChar;
      if (inChar == '\n') {
        stringComplete = true;
      }
    }
    if (stringComplete) {
      if (inputString1.startsWith("$SDDBT")) {
        a = 1;
        com1 = inputString1.indexOf(',');  // finds location of first ,
        com2 = inputString1.indexOf(',', com1 + 1 ); //finds location of second ,
        Depth = inputString1.substring(com1 + 1, com2); //captures second data String
        Serial.print("Depth: ");
        Serial.print(Depth);
        Serial.print("m ");
        dataFile.print(Depth);    // Prints depth to the SD card
        dataFile.print(",");
        dataFile.flush();
      }
      inputString1 = "";
      stringComplete = false;
    }
  }
  gps.listen();
  while (a == 1) {
    //Serial.println("while a = 1");
    while (gps.available()) {
      //Serial.println("while gps available");
      char inChar = (char)gps.read();
      inputString2 += inChar;
      if (inChar == '\n') {
        stringComplete = true;
        delay(10);
      }
    }
    if (stringComplete) {
      if (inputString2.startsWith("$GPRMC")) {
        char lat_deg_str[3];    // begin char with length 3 to stor latitude degree
        char lat_min_str[8];
        char lon_deg_str[4];
        char lon_min_str[8];
        inputString2.substring(16, 18).toCharArray(lat_deg_str, sizeof(lat_deg_str)); // appends data from inputstring2 to latitude degree string from locations 16 through 18
        inputString2.substring(18, 25).toCharArray(lat_min_str, sizeof(lat_min_str));
        inputString2.substring(28, 31).toCharArray(lon_deg_str, sizeof(lon_deg_str));
        inputString2.substring(31, 37).toCharArray(lon_min_str, sizeof(lon_min_str));
        int lat_deg = atof(lat_deg_str);      // Turns the degree string into a degree integer/float
        float lat_min = atof(lat_min_str);
        int lon_deg = atof(lon_deg_str);
        float lon_min = atof(lon_min_str);
        float latitude = lat_deg + lat_min / 60;    // converting from DDMM.ffff to decimal degrees lat/long
        float longitude = lon_deg + lon_min / 60;
        Serial.print("Latitude: ");
        Serial.print(latitude, 6);
        Serial.print(" Longitude: -");
        Serial.println(longitude, 6);
        dataFile.print(latitude, 6);
        dataFile.print(",-");
        dataFile.println(longitude, 6);
        dataFile.flush();
        latitude = 0;
        longitude = 0;
        a = 0;
      }
      inputString2 = "";        // Clearing all the strings just in case of relicts
      char lat_min_str = "";
      char lon_min_str = "";
      stringComplete = false;
    }
  }
}

Is the regulator overheating? How much current does the GPS take? 12v is kind of high as an input voltage. Try with 7~9v external (can use one of those cheap buck converters to get that from the 12v)

So, that is weird. I found a 9V battery lying around (7.8V) and plugged it in, and the transducer(12V power) recorded fine, but when the program waits for the GPS (Which is plugged into the arduino 5V source) nothing happens. This makes me think you were right about the 12V being funky as an input to the Uno, and then the 9V battery maybe not having enough juice to power the GPS. Does this seem reasonable? Should I make a voltage divider to bring 12V down to 9ish to power the arduino? Or will this not provide any extra power? Thanks!

SOLUTION:

F me right? I turned this into a cluster with the help of the first person to reply.

In case anybody finds this in the future (Including me because I am kinda forgetful/whiskey) The 12V power source coming from the batteries seemed to be a little strong for the Uno (Even though it says 7-15V input power). It was doing stuff? But not the same stuff as when I plugged it into USB power. So, that is what I did...

Plugged the 12V battery load power into a L7805cv voltage regulator, taking the 12V power down to 5V. Then I cut an old USB micro? Mini? whatever it was and powered it with the 5V from the regulator. Plugged that into the arduino Uno, and Voila! My SD card is now reading proper Transducer and GPS stuff and things.

Now if somebody would please explain to my future self why this is dumb or why the 12V power wouldn't work, I would be greatly appreciative. Thank you!

stevenette:
SOLUTION:

F me right? I turned this into a cluster with the help of the first person to reply.

In case anybody finds this in the future (Including me because I am kinda forgetful/whiskey) The 12V power source coming from the batteries seemed to be a little strong for the Uno (Even though it says 7-15V input power). It was doing stuff? But not the same stuff as when I plugged it into USB power. So, that is what I did...

Plugged the 12V battery load power into a L7805cv voltage regulator, taking the 12V power down to 5V. Then I cut an old USB micro? Mini? whatever it was and powered it with the 5V from the regulator. Plugged that into the arduino Uno, and Voila! My SD card is now reading proper Transducer and GPS stuff and things.

Now if somebody would please explain to my future self why this is dumb or why the 12V power wouldn't work, I would be greatly appreciative. Thank you!

I cannot explain it in full detail because my knowledge about the subject is limited. It has something to do with the more voltage you provice, the less current you can use. It has to do with the heat dispensation from bringing the 12v back to 5v.

It's best to use the USB jacket to power the device. It has a maximum of 500ma but someone explained to me that I should even bother to use the DC jacket if an Arduino needs more then 500ma because of the voltage regulator. It simply cannot provide more.

Bottomline: If you need more current for you project, try to use an adapter with a voltage as close as you can to 7v (because the voltage regulator needs around 2v on it's own. So 7v-2v=5v). It's best to use the usb port if you got a stable 5v.

Comes down volts and amps - some batteries have a high internal resistance to start with which will limit the available current. Regulators can get horribly hot before they shut down. Take care powering the Arduino through the Vin pin.
If you are starting a project with the possibility of overloads, shorts etc., a regulated bench power supply is always safer where you can set the maximum current and work up and you will be short circuit etc. protected.
USB ports are fairly forgiving, but sooner or later something will happen that either destroys your USB or crashes the computer - it doesn't take much to do either.

The issue with using the 12v supply into the arduino was what I suggested initially then - the current demanded by the GPS was more than the on-board regulator could supply comfortably (it might well be overheating and misbehaving as a result of that).

When you put 12v into a 5v linear regulator, 7/12ths of the power is dissipated as heat, and the regulator has to get rid of that heat somehow. It's common with SOT-223 regulators like the '1117-series one used on the Uno to use a large area of copper around the tab of the regulator, so the board helps to act as a heatsink; this was not done on the Uno despite there being acres of board space to work with.

The situation on the pro mini (and most clones - though I've seen a couple of clones that at least use a 1117-series reg instead of that tiny rice-grain sized one on the official one) is even worse, since the regulator is smaller and hence less able to dissipate that heat.

Partly, this is a consequence of cost cutting, and partly a result of the boards being designed before power-hungry GPS and WiFi modules were cheap and ubiquitous, so it wasn't as much of an issue before.