Unstable NPN switch circuitry

azelogose:
supply is a 4AA battery-pack?

V-in of a Mega needs at least 6volt for the onboard 5volt regulator to make a stable 5volt.
Four new Alkaline batteries is borderline. Four NiCad batteries is too low.

Why are you using a Mega on batteries.
A Mega is a poor candidate for low power applications.
Many parts on the board can't be turned off (sleep).

Why are you using the main TX/RX pins. They are already used by the USB<>serial chip.
A Mega has three other hardware serial ports that you can use.
Leo..