I'm relieved irmamar agreed with me... I was starting to doubt.
@Poli: I'll be a bit stubborn and say it's not the preposition (but maybe rather the intonation and explanation given for each case) which would give the nuance to your sentence.
Debo ir al médico. (I have a lump on the side of my neck
)
Debo
de ir al médico (It's been a year)
Juan debe ir al médico. Ha estado tosiendo.
Juan must go to the doctor. He's been coughing.
You think that's what he ought to do.
-- ¿A dónde va Juan?
Where is Juan going?
-- Debe de ir al médico. Ha estado tosiendo.
He must be going to the doctor. He's been coughing.
You make a supposition about where he's going after you've seen he's ill.