Need Help With An Arduino Nano PCB I Made

Hi all,

This is my first time posting on this forum, so please excuse any mishaps in this! :slight_smile:

A couple of days ago I received some PCBs that I had designed prior. Simple stuff, just a Arduino that rotates a servo every couple of minutes when a switch is in the 'on' position. After soldering all the components on and powering it with my DC power supply (9V), it doesn't work!

I've attached a photo of the schematic and PCB diagram as well... all were designed on EasyEDA. As for the code, I'm using the servo sweep example, just with the modified pin number.

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(3);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

Schematic Key:

  • U1 is the SPST switch. The Arduino reads it's value using the 'Switch' pin (D2)
  • U2 is the power. It takes 9v
  • R1 is the pull-down resistor for the switch
  • M1 is the Arduino Nano. It uses the ATmega 328
  • M2 is the servo. It is an SG90 servo, 9 grams
  • R2 and R3 are resistors. They split the 9V into 4.5V, suitable for the servos

All resistors are 10k ohms.

When I power the board with 9v, the Arduino turns on, a signal is generated at pin 3 (I tested it w/ an oscilloscope), but the servo just won't turn! Is it something wrong with the servo, the PCB, the Arduino, or something else?!

Any help or insight is appreciated!

-Ben

Oh, now I see what you're trying to do. That won't work.
http://www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/stores/sg90_datasheet.pdf
If you wanted to use R2/R3 as a voltage divider (bad idea by the way), you would do it on the power side not the ground side. The way you have it, the control signal is not between 0 and 5V, it might even damage the Nano pins.

Did you prototype this prior to PCB production?

Servo requires pulse voltages from GND to V+.

Your servo running on a 4.5V(GND) to 9V(V+).
(This is not a good way to do it... but I don't care about it now.)

Arduino generates pulses from 0V to 5V.
Seen from your servo, it receives pulses from -4.5V to 0.5V.
The servo doesn't work and can even destroy the servo or board, maybe.

OK, total disaster here!

Clearly you did not prototype this before designing a PCB. That is what prototyping is all about!

Various misunderstandings, the most major of which is the correct voltage on which to operate an Arduino. Unfortunately the "tutorials" on the Arduino site and others suggest that 9 V is suitable, It is not.

The Arduino requires 5 V to operate and so does your servo. Putting resistors in series with the servo as you have prevents it from drawing sufficient current to operate. You need 5 V also to operate the servo, so you simply need an actual 5 V power supply to directly connect to both.

A practical power supply for the Nano (or UNO, Pro Mini, Leonardo etc.) is a "phone charger" with a USB output connector for 5 V, generally up to a couple of Amps though you can not feed more than 500 mA through the USB connection. In fact, the proper way is to connect the 5 V directly to the "5V" pin.

If you wish to operate on batteries, then three AA alkaline cells or 4 NiMH rechargeables would be the appropriate ones.

R1 is redundant; you can connect switch between pin and GND and use the internal pull-up resistor. That's the most common way to do switches as it saves a component...

For power supply easiest is to use a 5V USB charger. Connect the 5V to the Vcc/5V pin of the Nano. Make sure it can deliver at least 1A for the servo.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.