<p>If I set temperature say 220 °C, printer heats up to it and it only varies +/- 0.5 °C under non operating condition. But if I start a print, there's a shift of +/- 15 °C.</p>
<p>I've already auto tuned PID parameters and when I run <code>M503</code>, the printer shows the updated PID values.</p>
<p><a href="https://i.stack.imgur.com/w8SCE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w8SCE.png" alt="Octoprint temperature graph showing hotend temperature drops" /></a></p>
<p>What could be the reason?</p>
<p>Electronics details:</p>
<ul>
<li>Firmware used:  Marlin</li>
<li>Controller board: Printrboard rev D</li>
</ul>

There could be a number of reasons for that behaviour:
Please check following items:
part blower/fan cools down the nozzle - stop the fan
material is extruded at high speed and takes the heat
loose thermistor (when the move occurs as it moves a bit internally)
the power supply unit voltage varies - so temperature reading varies as well - measure voltage and see if there are significant drops
nozzle heater and thermistor cables can be loose as well (check screw terminals)
bed heater connection cables having not a good connection (check screw terminals)