Test Servos and the Ultrasonic Module

Before assembling, you need to test the servos and the ultrasonic module according to the following.

Test the Servo


Due to an unfortunate manufacturing error, the polarity of some battery connectors has been reversed, which may cause overheating when using 9V battery.

To prevent any safety risks or damage to the product, please carefully check the polarity of the battery connectors before inserting a 9V battery.


If you find that the battery connector is reversed, please do not attempt to complete the installation. Instead, please contact our customer support team. We will replace it for you as soon as possible.

Email: cs@sunfounder.com

  1. Insert SunFounder Nano board into the Servo Control Board.


    The USB port should be at the same side with blue power supply terminal.

  2. Insert the battery to the battery cable.

  3. And connect the battery cable to the expansion board.

  4. Connect four servos to pin 9 to pin 12 of the expansion board.


    The yellow, red, and brown wires connect to Signal, VCC, and GND on the expansion board, respectively.

  5. Open the Test_robot.ino under this path of DIY_4-DOF_Robot_Kit_-_Sloth\Code\Test_robot. Uncomment the line 16 (delete sign // to start the corresponding servo test code); then comment the line: //#define ULTRASONIC.


    It is not recommended to uncomment both lines at the same time.

  6. The Arduino IDE may not recognize your board if you see Unknown COMXX when selecting a board here.

  7. After clicking on Unknown COMXX, the Select Other Board and Port pop-up will appear. Type nano in the search box, then select Arduino Nano and click OK to confirm.


    It doesn’t matter if your Arduino Nano is greyed out, it means you don’t have the Arduino AVR Boards core installed, just select it here and click OK to install it automatically.

  8. Now you will be able to see the Arduino Nano board being recognized.

  9. Upload codes to the Nano board. After a few seconds, the “Done uploading” message will appear.

  10. Slide the power switch to ON. You will see the rocker arm rotates within 0-180 degrees, indicating the servo can work.


Test the Ultrasonic Module

  1. Connect Ultrasonic module to Servo Control Board via 4-Pin Anti-reverse Cable.

  2. Open the Test_robot.ino and select Board, Processor and Port.

  3. Comment out line 16 by prefixing #define SERVO with //; then uncomment #define ULTRASONIC.

  4. Open the serial monitor after uploading the code. Set the baud rate to 115200 (started by line 25 serial.begin(115200)).

  5. Turn the power switch to ON you can see the detected distance.


    The detection distance of ultrasonic module is 2-400cm, if the data is 0 or a few thousand, it means that it is invalid data need to be ignored.