Servo motor acting weird when retrieving HTTP data using ethernet shield

Hello everybody,

I’ve been struggling with this problem this last days

I am doing a project that consist in retrieving weather information from different cities ( wind speed, and wind direction) from a website, and converting this data into fan velocity and servo-motor position.

So far, I have managed successfully to read data from website inside arduino and even control the PWM of a fan using the wind speed values :). However when I connect the servo, the chaos starts.

I am using a common servo motor POWER HD-1160A (Pololu - Power HD Mini Servo HD-1160A).
It is powered with a 5V (5.2A) external power supply with the GND connected with arduino.

I have tried the “sweep” example from the arduino and it works perfect. So that is why I don’t understand why it isn’t acting as it should.

When the servo is connected with my code, it does a “high annoying sound” all the time and, when arduino retrieve data from website it starts to turn. Then once arduino has finished to retrieve data, it stops turning but that annoying sound remains.

I’ll attach the file because it is a little longer to just paste it here.

Any help will be appreciated. Thank you very much!

_05_ethernet_fan_eng.ino (8 KB)

What Arduino are you using?

On an Uno pins 11, 12 and 13 are used by SPI so you should not use any of them for your servo.

...R

Robin2:
What Arduino are you using?

On an Uno pins 11, 12 and 13 are used by SPI so you should not use any of them for your servo.

…R

Damn yes!!! You were right! Thank you very much Robin2. I am using arduino uno and I didn’t thought about spi conections. I changed to pin 5 and solved.