Arduino Uno R3 Does Not Run Serial Sketches on External Power

Hi All,
I've read a number of forum posts concerning similar issues but none appear to address quite the same set of circumstances as those I've found myself troubleshooting with. My current project involves using an arduino uno r3 to send serial commands (via a max3323E) to a Tecan Cavro XLP6000 syringe pump (using this build https://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232). After attempting to switch the Arduino to external power (a necessity for the project's eventual completion), I found that my SoftwareSerial dependent sketch, which worked fine while the arduino was connected to usb, failed to launch on external power (using a variety of appropriate 7-12 volt sources). The problem persists even with a bare board devoid of any wiring and with other serially dependent sketches I've tried. However, other sketches appear to function fine (e.g. servo motors function properly). Evidence supporting launch failure includes lack of tx/rx light activity (when the sketch is running smoothly they both blink per expectation) and lack of serial output in hyperterminal (I have the tx/rx from the max 3323 rigged to both the pump and a jury rigged RS-232/USB connection to my windows 10 computer). My arduino is definitely on while the problem occurs (on light is on...). Is this a fixable issue? Thanks so much in advance for your thoughts, my apologies if I've failed to provide some critical piece of information (happy to do so if requested of course).

A copy of your code in this instance would be of great benefit.

Please make sure you use the CODE TAGS when posting though.

Two serial programs I’ve designed have been non-functional on external power and functional on USB power. The first script represents an actual protocol I’ve been using with the pump, which responds per-expectation when the Uno is connected with USB power (/1ZR is the pump’s initialization command, /1QR is a query command asking the pump to send back status information). The second script represents a simple serial program I wrote to confirm that serially reliant sketches (and not just my pump project) weren’t working on external power.

/*
Serially distributed commands for the Cavro XLP6000 pump
B. Charo
7/22/16
*/
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <stdint.h>


byte rxPin = 0;
byte txPin = 1;
SoftwareSerial mySerial (rxPin, txPin);
void setup(){
  //Start serial session and initialize pump
  delay(5000);
  mySerial.begin(9600);
  mySerial.write('/');
  mySerial.write('1');
  mySerial.write('Z');
  mySerial.write('R');
  mySerial.write('\r');
  mySerial.write('\n');
}

void loop(){
  //Query pump
  mySerial.write('/');
  mySerial.write('1');
  mySerial.write('Q');
  mySerial.write('R');
  mySerial.write('\r');
  mySerial.write('\n');
  delay(1000);
  //Read out response bytes. 
  int bytes = mySerial.available();
  mySerial.println(bytes);
  for(int i = 0; i < bytes; i++){
    int info = mySerial.read();
    mySerial.println(info, BIN);
    delay(1000);
  }
  delay(3000);
}
/*
Basic test of arduino's serial communication capacities
B. Charo
7/18/16
*/

#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>

byte rxPin = 0;
byte txPin = 1;
SoftwareSerial mySerial(rxPin,txPin);

void setup(){
  mySerial.begin(9600);
}

void loop(){
  mySerial.write('u');
}

Exactly why are you using the hardware RX and TX pins with SoftwareSerial? Or is that just an example? Try different pins.

The RX and TX LEDs are for connections to USB. If you have a look at the Uno schematic, you’ll notice the LEDs are run by the USB chip and are not connected to the serial wires. If you are interested in monitoring or troubleshooting serial activity, connect some LEDs with resistors to the RX and TX pins so you can see attempted serial activity.

If you are going to use pins 0 and 1 for serial communication, don’t use software serial, just use regular hardware serial. The ATmega328P has hardware serial built in, so might as well use it.

Serial communication involves 3 wires, not 2 wires as commonly believed. RX, TX, and ground. Don’t forget to connect ground. Most people forget this sometimes (including me).

So I tried different pins and unfortunately the same issue occurs (functional when connected to USB, non-functional on external power). Regardless of tx/rx light activity I believe I have an effective means of assessing serial output/input via the jury-rigged computer connection I alluded to in my first post. Were there any serial activity it ought to travel through the max 3323E and subsequently to my computer where it ought to be picked up by hyperterminal's connection to the proper Com port (this technique works consistently when signal is being properly sent to the pump). Regarding the hardware serial library: a) I've changed the pins to 6/7 per Isaac96's suggestion and that hasn't influenced performance b) which library would that be? I don't see it in any of Arduino's default libraries (hardware serial = SPI?) c) Did you mean to say Uno instead of mentioning the ATmega328P? Or are the two somehow related?

Hardware Serial is built into the core, it's what you're using when you print stuff to Serial.

SoftwareSerial is a software implementation of serial (ie, bitbanged serial), which allows you to get additional serial ports (the '328p only has one hardware serial, on arduino pins 0 and 1). But, because it's a software implemenation, software serial requires the microcontroller's undivided attention to send or receive - so you can't send and receive at the same time - and it gets flaky if you try to use it at high baud rates.

The Uno is based on the ATmega328p, as are several other Arduino boards (uno, pro mini, nano, lilypad, countless third party boards). Since the boards are just breakout boards for a '328p and basic supporting circuitry, they're largely interchangable, so many of us here refer to them by the chip, rather than the specific board.

When you move it to different pins, have you adjusted the wiring accordingly?

Gotcha, makes sense to me. Yes, wires are all adjusted fine. Again, the setup with revised wiring works to control the pump and produces readable serial output thru hyperterminal successfully when the Uno is plugged into USB.

OH!

Do you have the grounds connected? Arduino ground must be connected to the ground of what you're talking to. If ground wasn't connected, it would work on USB if the ground of the device was tied to the computer's ground.

AH! Having triple checked I just noticed my failure to properly ground the pump. Its ground lead was connected to a ground rail on my breadboard that wasn't actually grounded. External power now working just fine. Thanks for the help, guess I've now made the same storied mistake dmjlambert was referring to. Thanks for the help all, it's funny how these things often have such simple solutions...