The salaries figures, 25K and 20K seem extremely low to me. Truth be told, I've been abroad for the last 6 years, but back then, no way we could hire anyone decent for less than 35K (Barcelona).
I would advise that you are going the earn 20K/25K, do not try to go unless you really want to survive like a student :-) Do not see how are you going to pay the rent with that salary, check prices online.
Both cities are very nice and you will enjoy them both.
Last time I lived there, Barcelona was more start-upy than Madrid, and Madrid more corporate than Barcelona. In any case, they both have plenty of tech, I would not worry about that. You will enjoy your time in either city, if you earn enough of course. Make sure of that first.