Arduino Randomly Freezing During Long Jobs

aibonewt:
Out of sheer desperation I hard-coded all my serial commands into the Arduino sketch itself and removed all references to the serial bus. Still had the laptop connected, but only as a power source. The commands are quite repetitive for the first job I want to do, so it just took a couple of nested loops to replicate them exactly. Started it off yesterday lunchtime with exerything connected as normal, and a few minutes ago it finished, parked-up and powered-down.

Try re-adding the printing of "OK" to the serial port after each command. That will tell you whether is it the serial receive or transmit that is causing the problem (or it could be an interaction between the two).