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

Warning

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.

_images/wire_warning.png

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.

    Note

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

    _images/test_servo_1.png
  2. Insert the battery to the battery cable.

    _images/test_servo_2.png
  3. And connect the battery cable to the expansion board.

    _images/test_servo_2-2.png
  4. Connect four servos to pin 9 to pin 12 of the expansion board.

    Note

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

    _images/test_servo_3.png
  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.

    Note

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

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

    _images/test_servo_5.png
  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.

    Note

    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.

    _images/test_servo_6.png
  8. Now you will be able to see the Arduino Nano board being recognized.

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

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

    _images/test_servo_9.png

Test the Ultrasonic Module

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

    _images/test_ultrasonic_1.png
  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.

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

    _images/test_ultrasonic_4.png
  5. Turn the power switch to ON you can see the detected distance.

    Note

    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.