0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
CZ0248D

CZ0248D

  • 厂商:

    SUNFOUNDER

  • 封装:

  • 描述:

    Arduino 机器人元器件 机器人套件

  • 数据手册
  • 价格&库存
CZ0248D 数据手册
SunFounder DIY 4-DOF Robot Kit Release 1.0 sunfounder Sep 06, 2022 CONTENTS: 1 Components 3 2 Download the Code 7 3 Install Arduino IDE and Add Libraries 9 4 Test Servos and the Ultrasonic Module 4.1 Test the Servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Test the Ultrasonic Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 17 5 Assembly 21 6 Example 6.1 Simple Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Dancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 39 40 7 Q&A 43 8 Summary 47 9 Copyright Notice 49 i ii SunFounder DIY 4-DOF Robot Kit, Release 1.0 This cute learning kit focuses on the popular open source platform Arduino. You can learn the knowledge of the Arduino servo and ultrasonic ranging module by applying this kit. It is a new mobile robot called Sloth developed by SunFounder. Each leg has 2 joints driven by servo. One 9V chargeable lithium batteries are to supply the bot when the SunFounder Nano is used as the control board, compatible with the Arduino Nano. A servo control board connects with the batteries, servos, SunFounder Nano, and the HCCONTENTS: 1 SunFounder DIY 4-DOF Robot Kit, Release 1.0 SR04 ultrasonic ranging module. Sloth can move forward and detect the range to make a turn when encountering an obstacle. In addition, when learning to program, you can also have the fun to build a pretty cool bio-robot by yourself. 2 CONTENTS: CHAPTER ONE COMPONENTS Structural Plate Note: Please check the structural plate and component list, if there misses any components, please take pictures of all the components you have received and inform us of the missing partsand send E-mail to service@sunfounder.com. Mechanical Fasteners 3 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Electrical Components 4 Chapter 1. Components SunFounder DIY 4-DOF Robot Kit, Release 1.0 5 SunFounder DIY 4-DOF Robot Kit, Release 1.0 BatteryNot Included 6 Chapter 1. Components CHAPTER TWO DOWNLOAD THE CODE We have uploaded the relevant code material to github, you can download it through the link below. • Sloth Then, you can see 2 folders. • DIY_4-DOF_Robot_Kit_-_Sloth: It is recommended to download this package first, including the Arduino code, drivers, library, schematic and user manual. • How_to_use_Sloth_with_Mixly: This is an extended use of Sloth via graphical programming software - Mixly to program. The manual contains only a basic introduction to Mixly and how to program in Mixly, but does not include hardware assembly part, you need to check Assembly first, and after Sloth is completely assembled, you can use Mixly for programming. 7 SunFounder DIY 4-DOF Robot Kit, Release 1.0 8 Chapter 2. Download the Code CHAPTER THREE INSTALL ARDUINO IDE AND ADD LIBRARIES Arduino Arduino is an open source platform that applies simple software and hardware. You can get it in a short even when you know little of it. It provides an integrated development environment (IDE) for code editing and compiling, compatible with multiple control boards. So you can just download the Arduino IDE, upload the sketches (i.e. the code files) to the board, and then you can see experimental phenomena. For more information, refer to https://www.arduino.cc/. Install Arduino IDE The code in this kit is written based on Arduino, so you need to install the IDE first. Skip it if you have done this. Now go to the Arduino website: https://www.arduino.cc/, find the one that suits your operation system and click to download. There are two versions of Arduino for Windows: Installer or ZIP file. You’re recommended to download the former. Just download the package, and run the executable file to start installation. It will download the driver needed to run Arduino IDE. After downloading, follow the prompts to install. After installing, you will see Arduino icon on your desk and double click to open it. 9 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Add Libraries You will get the following error when trying to run the code that contains the ultrasonic module: NewPing.h: no such file or directory Therefore, it needs to be manually added. Here are the steps. Open Arduino IDE, select Sketch -> Included Library -> Add .ZIP Library. Enter the path DIY_4-DOF_Robot_Kit_-_SlothLibrary and select to open NewPing. 10 Chapter 3. Install Arduino IDE and Add Libraries SunFounder DIY 4-DOF Robot Kit, Release 1.0 Then you will see “Library added to your libraries”, indicating the library has been included successfully. 11 SunFounder DIY 4-DOF Robot Kit, Release 1.0 12 Chapter 3. Install Arduino IDE and Add Libraries CHAPTER FOUR TEST SERVOS AND THE ULTRASONIC MODULE Before assembling, you need to test the servos and the ultrasonic module according to the following steps. 4.1 Test the Servo Step 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. Step 2: Insert the battery to the battery cable. 13 SunFounder DIY 4-DOF Robot Kit, Release 1.0 And connect the battery cable to the expansion board. Step 3: 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. 14 Chapter 4. Test Servos and the Ultrasonic Module SunFounder DIY 4-DOF Robot Kit, Release 1.0 Step 4: 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); the comment the line: //#define ULTRASONIC. Note: It is not recommended to uncomment both lines at the same time. Step 5: Select the corresponding Board, Processor and Port. • Board: Arduino Nano. • Processor: ATmega328P. If the code cannot be uploaded successfully for a long time, it needs to be changed to ATmega328P (Old Bootloader). • Port: Random allocation. The corresponding option can be determined by pulling out the USB cable and reconnecting the nano. Usually a combination of “COM + Numbers”. 4.1. Test the Servo 15 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Step 6: Upload codes to SunFounder Nano board. After waiting for a few seconds, the download process is successful. The following window will prompt “Done uploading”. Note: If the code cannot be uploaded successfully for a long time, Processor needs to be changed to ATmega328P (Old Bootloader). Step 7: Slide the power switch to ON. You will see the rocker arm rotates within 0-180 degrees, indicating the servo 16 Chapter 4. Test Servos and the Ultrasonic Module SunFounder DIY 4-DOF Robot Kit, Release 1.0 can work. 4.2 Test the Ultrasonic Module 1. Connect Ultrasonic module to Servo Control Board via 4-Pin Anti-reverse Cable. 4.2. Test the Ultrasonic Module 17 SunFounder DIY 4-DOF Robot Kit, Release 1.0 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. 18 Chapter 4. Test Servos and the Ultrasonic Module SunFounder DIY 4-DOF Robot Kit, Release 1.0 5. Set the baud rate to 115200 (started by line 25 serial.begin(115200)). 6. 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. 4.2. Test the Ultrasonic Module 19 SunFounder DIY 4-DOF Robot Kit, Release 1.0 20 Chapter 4. Test Servos and the Ultrasonic Module CHAPTER FIVE ASSEMBLY Head Assembly Insert the ultrasonic module into No. 1 board and secure it with M1.4*8 screws and M1.4 nuts. Use a M3*5 screw to secure the M3*8 Bi-pass Copper Standoff post on No. 1 board. 21 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Electrical Module Assembly Use a M3*5mm screw to mount the previously installed circuit board on No. 1 board. Use M3*5 screws to fix M3*25 Bi-pass Copper Standoff under the No. 1 board. 22 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Servo Assembly Use M2*8 screws and M2 nuts to mount the servo on the corresponding position on the No. 2 board. (Note the direction of the servo installation) 23 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Secure the No. 1 and No. 2 boards with M3*5 screws. Note that the side of the servo shaft should be mounted on the side of the USB port. Use two M1.5*5 self-tapping screws to fix the 2-arm rocker arm to the No. 4 board and use the same method to install another No. 4 board. 24 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Secure one of the round holes on the 4th and 5th boards with M3*8 Countersunk screws and M3 self-locking nuts. Use the same method to secure the other round hole on the 4th and 5th boards, as shown in the following figure: 25 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Use two M1.5*5 self-tapping screws to secure the 1-arm rocker arm on the No.4 board. Install another No.4 board in the same way. Turn the No. 6 board with the countersunk side down and secure the No. 6 board to the right leg described above with the M3*8 countersunk screw and the M3 self-locking nut. 26 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 The same method can be used to secure the No.7 and the left leg. Observe the picture carefully. The left and right feet you have installed need to be exactly the same as that in the picture. Otherwise, the robot won’t walk properly. 27 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Servo INSTALL Test Connect the 4 servos to pin 9, 10, 11 and 12 respectively again. This is designed to keep the servo angle of the upload code at 90°(internal angle) before the servo shaft is installed, in order to let the Sloth remain upright after assembly. 28 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Open the program simple_robot.ino under the path of DIY_4-DOF_Robot_Kit_-_Sloth\Code\ simple_robot. After opening, you can see the other 2 files: VarSpeedServo.cpp and VarSpeedServo.h are opened at the same time. This two files are set to adjust the angle of the servo. There are three #define statements in line 39-41. Removing the respective comment signs // enables you to start their functions as shown. 29 SunFounder DIY 4-DOF Robot Kit, Release 1.0 • #define INSTALL: Start the INSTALL mode, in which 4 servos will be fixed at 90°for assembly. • #define CALIBRATION: Start the calibration mode, in which the angles of 4 servos can be adjusted. • #define RUN: Start the RUN mode, in which the robot can go ahead and get round if it meets obstacles. Note: Only one function can be used at the same time. Starting multiple functions might break down the robot. In the current step, use INSTALL mode. Then select the corresponding Board, Processor and Port. The code is then uploaded into the SunFounder Nano board. Don’t forget to toggle the power switch to ON. When the servo control board is powered on, the servo will rotate to the position specified by the program. Foot Assembly Note: Keep on the power until the whole step. Assemble the left leg with the smallest screws in the packaged with servo, a gasket plate is needed between the servo and left leg. Try to keep the edges of the 4th board and the servo parallel to each other. If deviation are found at installation, it is normal and we will adjust them later when calibrating. 30 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Insert a servo (in working condition) into the servo shaft of the left foot. Besides 2 M2*8 screws and 2 M2 nuts, a gasket plate is needed between the servo and left leg. 31 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Assemble the right leg in the same way. 32 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Secure the 2 legs with the smallest screws in the packaged with servo. 33 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Battery Assembly Attach one side of velcro tape to the bottom of the No. 1 board and the other side to the battery. Insert the battery into the battery cable and plug the other end into the expansion board. 34 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 Lastly, paste the battery on the No. 1 board. Servo CALIBRATION Test Check the assembly of the 4 servos according to the picture as shown. 35 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Open the program simple_robot.ino and go to Line 39. Set #define CALIBRATION as able and disable the other two. Then select the correct board and port, and upload the sketch. 36 Chapter 5. Assembly SunFounder DIY 4-DOF Robot Kit, Release 1.0 If the robot is not fully upright, the angle can be manually calibrated. Go to Line 15 to rectify it. The basic principle of calibration: increased values can rotate the servo shaft clockwise and vice versa. For example, if the right leg is toe out, you need to decrease the upper-right servo’s angle; if it is toe in, you need to increase the angle. Tips for calibration: #. The calibration method for the left leg works the opposite way for right leg. #. If the right foot’s sole faces outward, you need to decrease the lower-right servo’s angle; if its sole faces inward, you need to increase the angle. #. The calibration method for the left foot works the opposite way for right foot. Ultrasonic Connecting Connect pin TRIG of the ultrasonic to pin 4 of the board, ECHO to pin 3, VCC to VCC and GND to GND. 37 SunFounder DIY 4-DOF Robot Kit, Release 1.0 Wire Arrangement Twine the servo wire and 4-Pin anti-reverse cable on the No. 1 board. So far the robot has been assembled successfully, it’s easy if you follow our steps closely. Hope you enjoy the fun of the bot, thanks for watching. 38 Chapter 5. Assembly CHAPTER SIX EXAMPLE Here, we provide you with two sample programs to play Sloth: 6.1 Simple Robot In this code we write mobile obstacle avoidance for the robot. After the program is burned, sloth will go straight ahead. If it senses an obstacle ahead, it will step back and turn to find a new direction. Open the program simple_robot.ino under the path of DIY_4-DOF_Robot_Kit_-_Sloth\Code\ simple_robot. (This is also the program what we use to install and calibrate the servo.) Go to Line 39 again, set #define RUN as able and disable the other two, then upload the code to the SunFounder Nano board. After burning successfully, unplug the USB cable and slide the power switch to ON. 39 SunFounder DIY 4-DOF Robot Kit, Release 1.0 You will see the robot moving forward. When encountering an obstacle, it will make a turn and then go forward again. 6.2 Dancing In this code, we write the basic actions of sloth and compose them into a dance. Open the program Dancing. ino under the path of DIY_4-DOF_Robot_Kit_-_Sloth\Code\Dancing. Go to Line 196, select the RUN function by rectifying #define. After burning successfully, unplug the USB cable and press the power button on the servo control board. You will see the robot dancing. 40 Chapter 6. Example SunFounder DIY 4-DOF Robot Kit, Release 1.0 Note: The program also needs to be calibrated in the same way as Servo CALIBRATION Test in Assembly. If there has been a precise calibration, you can modify the parameters in line 22 directly. 6.2. Dancing 41 SunFounder DIY 4-DOF Robot Kit, Release 1.0 42 Chapter 6. Example CHAPTER SEVEN Q&A Q1: How can we know the servo is damaged? A1: In Servo Test step, if the servo rocker arm shake, get stuck or can not rotate smoothly, with an abnormal sound, we can judge it as a damaged one. Q2: Why the Sloth reboots in running? A2-1: If the Sloth is in lower power, rebooting will happen, please charge the battery in time. A2-2: It could be the servos are lacking for power. Open the program and go to Line 12, 13. “vel” is the servos rotating speed in “initialization or moving forward”; “vel_Back” is the servos rotating speed in “moving backward”; “delay_Forward”, “delay_Back” are the delays between two moving forward loops and moving backward loops. (a) If rebooting happens in moving forward actions, you can decrease the value of “vel“ or/ and increase the value of “delay_Forward”. For example, decrease “vel” value to 10, and increase “delay_Forward” to 1500. (b) If rebooting happens in moving backward actions, you can decrease “vel_Back” or/ and increase “delay_Backward”. For instance, decrease “vel_Back” to 8, and increase “delay_Backward” to 1500. You can adjust to a proper value as you want. Then click Upload. Q3: Sloth walks too slowly when it moves forward. How to solve this? A3: Sloth’s default speed is middle speed, the related sketch is “vel(mid), delay_Forward(mid) = (20, 750)”. You can change the speed value as shown below to adjust the walking speed. 43 SunFounder DIY 4-DOF Robot Kit, Release 1.0 change the value of vel and delay_Forward in line12 and 13 to as shown: vel = 50, delay_Forward = 500 Then click Upload. Note: If you adjust the robot to a high walking speed, it may fall down and break. Thus it’s better to do some protection for the Sloth. Q4: Sloth walks too slowly when it moves backward. How to solve this? A4: Considering the structure of Sloth, it’s better do adjust a slow speed for backward walking. If you want to adjust the walking speed, refer to Q3 to adjust the value. DO NOT adjust a high speed for walking backward to avoid possible falling down. Q5: How to make the sloth more stable in walking? A5: Cut to get two paper cushion for the robot feet, and stick them on the Sloth soles to maintain enough friction for a stable walking. Q6What is macro definition (#define)? A6: The #define creates a macro, which is the association of an identifier or parameterized identifier with a token string. After the macro is defined, the compiler can substitute the token string for each occurrence of the identifier in the source file. You can use the #ifdef directives anywhere #if can be used. The #ifdef identifier statement is equivalent to #if 1 when identifier has been defined. It’s equivalent to #if 0 when identifier hasn’t been defined, or has been undefined by the #undef directive. These directives check only for the presence or absence of identifiers defined with #define, not for identifiers declared in the C or C++ source code. 44 Chapter 7. Q&A SunFounder DIY 4-DOF Robot Kit, Release 1.0 In sloth code, we use #define and #ifdef to start corresponding functions. 45 SunFounder DIY 4-DOF Robot Kit, Release 1.0 46 Chapter 7. Q&A CHAPTER EIGHT SUMMARY In this manual, having learned the related components for building the robot kit, you’ve gone through the assembly of the mechanical parts and electrical modules with the knowledge of Arduino as well as a brief introduction of the key parts like servo, ultrasonic, etc. Also you’ve got a lot of software and coding, which lays a solid foundation for your futrue journey of exloring open-source field. The SunFounder DIY 4-DOF Robot Kit is not only a toy, but more a meaningful development kit for Arduino. After all the study and hands-on practice of the kit, you should have a better understanding of Aduino. Now, get started to make better work! 47 SunFounder DIY 4-DOF Robot Kit, Release 1.0 48 Chapter 8. Summary CHAPTER NINE COPYRIGHT NOTICE All contents including but not limited to texts, images, and code in this manual are owned by the SunFounder Company. You should only use it for personal study, investigation, enjoyment, or other non-commercial or nonprofit purposes, under the related regulations and copyrights laws, without infringing the legal rights of the author and relevant right holders. For any individual or organization that uses these for commercial profit without permission, the Company reserves the right to take legal action. 49
CZ0248D 价格&库存

很抱歉,暂时无法提供与“CZ0248D”相匹配的价格&库存,您可以联系我们找货

免费人工找货