Arduino Nano clone and Driving Servo

Hi

I am working on the Small project which has 4 continuous rotating Servo
To drive the servos I am using Arduino Nano clone and the ServoLibrary

The PWM pins I am using is D5,D6,D9 and D10

To use the Servo Library the above Pins Map to pin 8,9,12, 13 (from the Diagram shown on http://kiwitricopter.blogspot.com/2012/10/arduino-xbee-receiver-arduino-nano-v30.html)

When I Use Servo.WriteMillisecond function nothing happened to the Servo.
Also when I connect to D9 the servo automatically starts rotating even when I haven’t attached them in the program.

Please can anyone suggest iam I doing something wrong or is the servo Lib not meant for Arduino Nano?

Regards
Saurabh

Please can anyone suggest iam I doing something wrong

Well, for a start, this is the Programming section, but I don't see any code.

Hi Awol

The code is not much. I want to confirm if the pins i am using are correct, or if the servo lib does not work with nano.

If you think this is not the right place for my question then i will move it to other section. Please advice?

#include <Servo.h>

servo myServo

void setup()
{
  myServo.attach(9)
  myServo.writeMiliseconds(1600)
}

void loop
{
}

Regards
Saurabh

Have you got the grounds connected together?
There's no reason the Servo library won't work on a Nano.

The PWM pins I am using is D5,D6,D9 and D10

Servos do not need to be connected to PWM pins. Using the Servo library you can use any Arduino pin to drive a servo as long as it is not being used for something else.

To use the Servo Library the above Pins Map to pin 8,9,12, 13

Are you confusing the numbers of the actual pins on the chip with those on Arduino board ? As you are you using a Nano Arduino clone it would seem logical to use the Arduino pin numbers.

Which Arduino pin do you have the servo attached to ?

Hi Awol,

The power to Servo is from a step Down buck converter, and the power to Arduino is from another step Down buck converter.
But both the buck converter are powered from same Lipo battery so I think that should work, Hope I am write ?

Hi UKHeliBob,

The number on Arduino nano where the servo signal is attached is D5,D6,D9 and D10
And in the program I am using
Servo.attach(8)
Servo.attach(9)
Servo.attach(12)
Servo.attach(13)

Regards
Saurabh

As you are using Arduino pins 5, 6, 9 and 10 can I suggest that your code should attach the servos to those pins and not 8, 9, 12 and 13 ? As I said before

Are you confusing the numbers of the actual pins on the chip with those on Arduino board ? As you are you using a Nano Arduino clone it would seem logical to use the Arduino pin numbers.

I should also point out that you need a different name for each servo object

To really square it out :

In the sketch (program) code you should use those pin numbers exactly printed on the Arduino board.

Its your choise to use ANY of the analog pins (those starting with the letter "A") or the digital pins (those NOT starting with a letter).
In your sketch you can define ANY of these pins as a digital input or a digital ouput. It depends on your code.

Dont worry about the pin numbers on the chip itself, as this has been taken care of in the compiler, when using the onboard printed pin numbers.
Thats one big advantage using the Arduino boards, they always use the same pin numbers printed on the board, being it an Uno, Nano or Micro.

I had exactly the same confusion with my first code, until I understood, that you get the right pin no & type, if simply following the Arduino board pin text.

Hi UKHeliBob/
Anders53

Everything is sorted now , Some of the Diagrams on the internet are misleading.

But as you mentioned directly referencing the Text on the board will Solves this confusion.

Thanks for quickly resolving the issue.

Regards
Saurabh