0

I'm new to this kind of thing. My code works on my Uno without problem with two separate servos. I've ensured that it's not any faulty leads, having tried a few other circuits with LEDs, buttons and potentiometers as well, simply switching between my Uno (which works fine) and the Nano.

I've chosen the correct port, chipset and board each time and the code uploads fine to the Nano. The Nano simply refuses to do anything I tell it.

  • Digital PIN of servo goes to designated D5 pin.

  • Ground goes to the GND near the Analog pins (shouldn't matter which I imagine).

  • Power goes to 5V.

The code above simply tells the servo to go to a certain degree when uploaded. Could anybody tell me why the servo will not move at all with the Nano? I just bought it and I haven't hooked up any power to it other than the USB, surely it isn't fried. It lights up and flashes as well.

#include <Servo.h>              
Servo my_servo;               

void setup() {
  my_servo.attach(5);
  // Pin definition
}

void loop() {
  my_servo.write(60);
  // No. of degrees
}
10
  • does the servo get enough power? Commented Aug 21, 2017 at 8:32
  • I know that the servo works fine through only the USB using the same schematic with the Uno. Do you think maybe the Nano could be providing less power through the USB to the 5V pin?
    – ardoknow
    Commented Aug 21, 2017 at 8:41
  • 1
    @ratchetfreak I checked the voltage (using a multimeter) going from the GND and 5V to the servo and I got 4.58V for the Nano and 5.06V for the Uno. Could that make that difference? The servos I'm using are rated at 4.8V +
    – ardoknow
    Commented Aug 21, 2017 at 9:39
  • If you're starving the servo of power then the internal controller may not function.
    – Majenko
    Commented Aug 21, 2017 at 9:40
  • 1
    Or power the servo separately from the Nano.
    – Majenko
    Commented Aug 21, 2017 at 10:11

2 Answers 2

1

Connect a multi meter in series with the servo connection from the uno to the servo and see how much current it draws when working (probably less than 20ma, definitely less than 40ma). Then connect it in series with the nano and see what happens. If you get no current then you're activating the wrong pin.

If you see a current draw but the servo doesn't move then you need to use some sort of switch (transistor, FET, relay) to switch the servo. You could also compare the voltage and current read off the nano to the requirement in the datasheet for the servo. Again, this may lead you to needing a switch.

Edit based on comments above... Also try your 5v directly to the servo, then add a forward biased diode in series which should simulate the voltage drop to the level of your nano (0.4-0.6v). If the servo doesn't work with the diode and does without then you can be pretty sure the issue is insufficient volts (which is likely given the rating of 4.8v you mentioned in comments).

2
  • i will try this when I'm home. You also may be right, what if I'm activating the wrong pin...Could it be that the PWM of the Uno (I've used D9/10) are different to the Nano?
    – ardoknow
    Commented Aug 23, 2017 at 4:40
  • Your code says d5. Regardless it's possible and I'd check that it flips from 0 to 5v and that current is drawn by solenoid.
    – Squats
    Commented Aug 23, 2017 at 4:45
0

I has the same problem. Example: With Arduino Uno only conected to 5V from PC, the servos run perfectly, but with Nano no, maybe the servos try to move, but not. I charged the skecth on the arduino Nano and deesconect form pc, and then i supply Arduino Nano with baterry Li-ion 2s. In another words, for servos you must to supply over 6 volts. Be careful because the max voltage of servos,can be 6 volts, you can use the regulator of Arduino, severals servos produce overheating in this regulator. Yes my english is noob.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.