I'm a violinist, not a pianist, but it's very common for beginning violin players to have severe pain because they are too tense, especially when they are self taught. I'm going to suggest a few generic techniques to start minimizing tension.
- When you sit down at the piano, think about how you are sitting.
Look for any tension, especially in your neck and shoulders. Close
your eyes, and take a few deep, slow breaths to help you relax.
- Play a note. Not a piece, or even a scale, just a single note.
Think about how relaxed you feel playing that note. Think about
tension in your back and shoulders. If you find any, slow down again
and relax. Now try two notes, or maybe even three or four. But still
think about relaxing, not about music. This is what your body should
feel like all the time when you play.
Now you've got a baseline for how you should feel while playing.
So play something simple. Either a short tune you know well, or a
scale, or whatever you find easy. Halfway through, stop and think
about tension. Did you tense up again? If you did, sit back, relax,
and start over, slower. Slowing down makes it easier to play, and
easier to think about not getting tense.
Another exercise is to practice breathing while playing. A lot of
beginners tend to hold their breathe, which just adds stress and
tension. So play a scale. Depending on your speed, you may want to
breathe in going up, and out going down, or breathe in for 4 notes,
out for 4 notes. Just practice breathing in rhythm, and being aware
of your breathe. When you are playing music, start thinking about
when you breathe in general. Breathing exercises aren't just for
singers.
In summary: Consciously relax before playing, and check for tension as you play. If you get tense, back off, relax, and slow down. Make sure you breathe.
If the tension is caused more by your posture, you may need to find a teacher to help you out, since we can't see how you hold yourself over the net. A teacher could also help with the sort of tension issues I'm talking about here, so if lessons are an option, it would probably be worthwhile, even if only for a short time.