Servo-Problems with an AtMega328p

I am having problems with controlling a servo with an AtMega328p, first it behaves weird then it stops working completely(until i disconnect it and then reconnect it to the power source). I am powering it with a 16 mhz crystal and 2 22pf caps and i am using the standard Servo.h library. It works like it should if i use a full-size-arduino but it is to big for this project.
Any help or tips would be appreciated!

Hi,

POWER problem: You must supply the servo with 5 or 6 V at (probably more than 1 amp - WHAT servo do,you have??)

Best to have separate 5V supply to servo, grounds connected together...

Thanks for the awnser but don't think that the amperage is a problem!
Reason 1:It does work with a complete arduino uno powered through usb
Reason 2:I tried using a power supply that can deliver up to 4 amps at 5 volts DC but it still didnt work
I rather think it has something to do with a missing component i need to control a servo correctly.

btw i am using a 'reely s-0403'.

Hi,
How have you built your arduino version? Where is "Ground"?? Where is servo "ground" connected? (Best would be - terminal of your power supply.

Sounds like electromagnetic interference, ground bounce etc..

xDS_:
I am having problems with controlling a servo with an AtMega328p, first it behaves weird then it stops working completely(until i disconnect it and then reconnect it to the power source). I am powering it with a 16 mhz crystal and 2 22pf caps and i am using the standard Servo.h library. It works like it should if i use a full-size-arduino but it is to big for this project.
Any help or tips would be appreciated!

Can you define "behaves weird"? It's not very diagnostic if you just call it weird.

Can you give us a schematic of what you've built?

It switches between random positions as soon as you apply any force ( and it should correct it's self).
then it just stops working completely until i repower it!

Circuit:

Wow, that is a difficult image to try to decipher. I see why so many here hate fritzing.

A pencil and paper will let you identify which pins are being used.

I found out that it most definitely does not have anything to do with interfeirance because i tried a using just a powering circuit for the 328p (and of course attaching the servo like usual) but it still didn't work!