Uno Midi serial problem with external power

Hi all,

I've been working on a Midi controller based on a Arduino Uno (see code below). The arduino is outputting Midi notes via the tx pin. I'm using an oldschool midi port (5 pin din connector) with the + tied to 5v with a 220 ohm resistor between it, and obviously ground to ground. The code works perfectly fine when the arduino is connected to my laptop via usb, but when I switch over to external power (tried many different sources) the arduino seems to be only outputting a shit load of garbage over the tx pin. I googled a lot, tried many ideas with resistors and capacitors between the tx, rx or reset pins, but it doesnt help at all. Now i'm not an electrical wonder at all so i'm running out of options. Does anyone know what causes this problem and how to solve it?

Kind regards,
Daan Buitenhuis (Holland, sorry for my bad english)

Controller.cpp (3.84 KB)

Controller.h (1.64 KB)

Test_Code_arduino2.0.ino (10.7 KB)

I'd use a 2200 Ohm pullup instead of 220. And double check the Gnd connections!