spotting on and off.

Sara-lee
Hey guys I'm 6 weeks and 5 days preggo and have been spotting on and off for the past three weeks. At first it was accompanied with pelvic pain so I went to my doc and he recommended an ultrasound which I did because he was worried it was ectopic l. Ultrasound said baby was fine and in the right place but I don't know why I still get the spotting occasionally. Can anyone help?