background image

 

Make you ideal fun

 

 

34 

Code 

 

// Servo Library  

#include <Servo.h> 

// Servo name 

Servo frontServo

;

 

Servo rearServo

;

 

// time delay between steps 

int

 walkSpeed 

=

 

500

;

 

// center servos 

int

 centerPos 

=

 

90

;

 

// servo angles for walking pattern 

int

 frontRightUp 

=

 

70

;

 

int

 frontLeftUp 

=

 

110

;

 

int

 backRightForward 

=

 

70

;

 

int

 backLeftForward 

=

 

110

;

 

// another center position  

int

 centerTurnPos 

=

 

81

;

 

// servo angles for walking pattern 

int

 frontTurnRightUp 

=

 

70

;

 

int

 frontTurnLeftUp 

=

 

110

;

 

int

 backTurnRightForward 

=

 

70

;

 

int

 backTurnLeftForward 

=

 

110

;

 

// variable for distance value 

int

 distance 

=

 

0

;

 

// average distance value 

int

 distanceCheck 

=

 

0

;

 

// Array for distance values 

int

 collectDistance

[

5

];

 

// Variables for counters 

int

 i

;

 

int

 f

;

 

int

 r

;

 

// assign analog pin A1 

Содержание Insect-Robot

Страница 1: ...Make you ideal fun 1 Insect Robot Instruction Manual...

Страница 2: ...legs so the insect can crawl forward We will also strap battery on the body so our insect can move autonomously Once you ve learned the techniques in this chapter you can easily extend your Insect Rob...

Страница 3: ...icture 2 Device list and physical connection To start program a Mini USB data line and a computer are needed After the assembly is completed you need to use the Arduino IDE to burn the code Please ref...

Страница 4: ...usually used in R C toys Servo motors have a servo controller that directs the position of the motor wherever we want The red wire is power the gray is GND and the orange is the data wire The motor it...

Страница 5: ...frared emitting diode and signal processing circuit The variety of the reflectivity of the object the environmental temperature and the operating duration are not influenced easily to the distance det...

Страница 6: ...y Through the above steps we have learned about the devices functions parameters and schematic diagrams of insect robots Now let s start to assemble 3 1 Fixed two SG90 Figure 6 Gluing the two servo mo...

Страница 7: ...n 7 Tying the servo motor tightly with cable tie and cut out the excess Figure 8 Put a foam on the top of the servo at A of Figure 9 which is used to support the NANO main control board as shown in Fi...

Страница 8: ...Make you ideal fun 8 Figure 10 3 2 Making infrared sensor fixed frame Cut the paper to the shape and size as figure 11 shown...

Страница 9: ...Make you ideal fun 9 Figure 11 Bend the cutted paper into the shape as figure 12 Figure 12...

Страница 10: ...Make you ideal fun 10 Install the paper on the servo as figure 13 Figure 13 Fix the paper with cable tie as figure 14 Figire 14...

Страница 11: ...Make you ideal fun 11 Install the Nano board on the servo as figure 15 but don t fix Figure 15...

Страница 12: ...Make you ideal fun 12 3 3 Install infrared sensor Use the blue cable tie to tie as figure 16 figure17 Figure 16 Figure 17...

Страница 13: ...al fun 13 3 4 Making mechanical feet Step 1 Bend the iron wire to V shape as figure 18 then use plier to bend 90 degrees at the position about 1cm from the previous bend as figure 19 figure 20 Figure...

Страница 14: ...feet of the wire through the two holes of the steering wheel Figure 21 Step3 Use the pliers to bend the two legs of the wire to the other end of the sharp corner as figure 22 Note Sharp nose pliers is...

Страница 15: ...Make you ideal fun 15 Figure 22 bending The front leg is completed as Figure 23 and behind legs as Figure 24 Figure 23...

Страница 16: ...e figure on the wire Figure 25 Put shoes on the four legs of the robot and insert the wire into the slip resistant particles to prevent slipping during walking Note The insertion process will be more...

Страница 17: ...Make you ideal fun 17 Figure 26 Finally install the robot feet on the steering gear if you correctly installed and completed the above steps the worm robot can stand up as shown in Figure 27 Figure 27...

Страница 18: ...ou ideal fun 18 3 5 Making Wire 3 5 1 Making Power Cords Figure 28 Firstly cut the Gong Dupont line in Figure 28 from the middle and remove the end of the Mother DuPont line as shown in Figure 29 Figu...

Страница 19: ...u ideal fun 19 Connect the wires together as shown in Figure 30 and weld the wires with electrical iron Figrure 30 Use the heat shrinkable tube to bind the conductor interface as shown in Figure31 Fig...

Страница 20: ...you ideal fun 20 3 5 2 Rectifing the servo wire Figure 32 First remove the 3P black connector terminal that comes with the servo cable as shown in Figure 32 After removal as shown in Figure 33 Figure...

Страница 21: ...Make you ideal fun 21 Then install the matching single black terminals as shown in Figure 34 after the installation is complete as shown in Figure 35 Figure 34 Figure 35...

Страница 22: ...facilitate the installation you can remove the installed Nano main control board from the servo Firstly put two pieces of foam paper on the Nano board as show in Figure 36 Figure 36 Then put the batt...

Страница 23: ...Make you ideal fun 23 Tie the battery and the NANO board together with a cable tie as shown in Figure38 Servo 38 When finished reinstall the Nano board onto the servo as shown in Figure 39 Figure 39...

Страница 24: ...l fun 24 3 7 Wiring of Circuit Funduino Nano Front Servo GND 5v 13 data Funduino Nano c GND 5v 12 data Funduino Nano Infrared Sensor GND 5v A1 data Funduino Nano Battery GND 5v Figure 40 Circuit conne...

Страница 25: ...est ServoTest and download the program to the NANO board ensuring that the initial status of both servos is 90 Open the program as shown in Figure 41 Figure 41 When finished downloading open the IDE s...

Страница 26: ...nical foot is installed correctly when the servo is rotated to 90 the mechanical foot should be in the horizontal state as shown in Figure 43 If it is not in the horizontal state please rotate the ser...

Страница 27: ...Make you ideal fun 27 Figure 43...

Страница 28: ...Make you ideal fun 28 After adjusting the angle you can completely fix the forefoot Figure 44...

Страница 29: ...bot was born download the program to the NANO board connect to power and start a new trip Note If the robot walks slowly or the posture is very unstable the wire bending angle and height direction and...

Страница 30: ...Arduino IDE a programming software is required to be installed into your computer If already installed please skip this step The software can be obtained from https www arduino cc en Main Software St...

Страница 31: ...Make you ideal fun 31 Step3 In the device manager of the Windows control panel locate the port corresponding to Arduino Nano such as COM15...

Страница 32: ...Make you ideal fun 32 In the following Arduino programming software Tools Port selecting the port number you have found such as COM8...

Страница 33: ...controller blinks for about 2 seconds and the lower end of the window shows Done Uploading indicating that the program has been uploaded successfully Step5 Now the robot has been already completed and...

Страница 34: ...LeftUp 110 int backRightForward 70 int backLeftForward 110 another center position int centerTurnPos 81 servo angles for walking pattern int frontTurnRightUp 70 int frontTurnLeftUp 110 int backTurnRig...

Страница 35: ...frontServo write centerPos rearServo write centerPos wait 3 seconds for start walking delay 3000 Serial begin 9600 serial data setup distance check function void scan read 5 distance values for i 0 i...

Страница 36: ...ightUp backLeftForward frontServo write frontRightUp rearServo write backLeftForward delay 10 loop for the servo angels to smoothen the steps for r 0 r 39 r frontRightUp backLeftForward frontServo wri...

Страница 37: ...ntServo write centerTurnPos rearServo write centerTurnPos delay 80 frontServo write frontTurnLeftUp rearServo write backTurnRightForward delay 110 frontServo write centerTurnPos rearServo write center...

Страница 38: ...istance if distance 1 filters out the zero readings an obstacle is being detected if distance dangerDistance LED at Pin 13 standard blinks 5x led 4 steps backward left for int i 0 i 3 i moveBackRight...

Отзывы: