SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly...

56
Preface About SunFounder SunFounder is a technology company focused on Raspberry Pi and Arduino open source community development. Committed to the promotion of open source culture, we strive to bring the fun of electronics making to people all around the world and enable everyone to be a maker. Our products include learning kits, development boards, robots, sensor modules and development tools. In addition to high quality products, SunFounder also offers video tutorials to help you build your own project. If you have interest in open source or making something cool, welcome to join us! Visit www.sunfounder.com for more! About This RollFlash Robot Kit The Rollflash is a four-foot quadruped robot, with a super cute tortoise appearance design. It applies an open source Arduino Nano control board, a Servo Control Board, and a Bluetooth Module. With an ultrasonic sensor and an infrared sensor, it can realize obstacle avoiding and line following functions. What’s more, you can control it with an App on Android, which makes it easy and interesting to play. Through this kit, you can feel the charm of assembling the robot from scratch and how to realize the control by programming. Besides this user manual, you can obtain guidance on our website - download the code needed under LEARN -> Get tutorials and watch the video under VIDEO. Free Support If you have any TECHNICAL questions, add a topic under FORUM section on our website and we'll reply as soon as possible. For NON-TECH questions like order and shipment issues, please send an email to [email protected]. You're also welcomed to share your projects on FORUM. SunFounder

Transcript of SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly...

Page 1: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

Preface

About SunFounder

SunFounder is a technology company focused on Raspberry Pi and Arduino open source

community development. Committed to the promotion of open source culture, we strive to

bring the fun of electronics making to people all around the world and enable everyone to

be a maker. Our products include learning kits, development boards, robots, sensor

modules and development tools. In addition to high quality products, SunFounder also offers

video tutorials to help you build your own project. If you have interest in open source or

making something cool, welcome to join us! Visit www.sunfounder.com for more!

About This RollFlash Robot Kit

The Rollflash is a four-foot quadruped robot, with a super cute tortoise appearance design.

It applies an open source Arduino Nano control board, a Servo Control Board, and a

Bluetooth Module. With an ultrasonic sensor and an infrared sensor, it can realize obstacle

avoiding and line following functions. What’s more, you can control it with an App on

Android, which makes it easy and interesting to play. Through this kit, you can feel the charm

of assembling the robot from scratch and how to realize the control by programming.

Besides this user manual, you can obtain guidance on our website - download the code

needed under LEARN -> Get tutorials and watch the video under VIDEO.

Free Support

If you have any TECHNICAL questions, add a topic under FORUM section on our

website and we'll reply as soon as possible.

For NON-TECH questions like order and shipment issues, please send an email to

[email protected]. You're also welcomed to share your projects on FORUM.

SunFounder

Page 2: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

Contents

Introduction...................................................................................................................... 1

1.1 Overview ....................................................................................................... 1

Components List ............................................................................................................. 2

2.1. Acrylic Plates ................................................................................................ 2

2.2. Mechanical Fasteners ................................................................................. 3

2.3. Electronic Components .............................................................................. 4

2.4. Tools................................................................................................................ 7

2.5. Self-Provided Components ........................................................................ 7

Get Started with Software ............................................................................................. 8

3.1 Download the code .................................................................................... 8

3.2 About Arduino .............................................................................................. 8

Assembly ....................................................................................................................... 13

4.1 Upper Plate + Riband ............................................................................... 13

4.2 Upper Plate + Battery Holder .................................................................. 13

4.3 Upper Plate + Servo .................................................................................. 14

4.4 Upper Plate + PCB .................................................................................... 15

4.5 U Joint-A/U joint-B ..................................................................................... 17

4.6 U Joint Unit-1/U Joint Unit-2 ...................................................................... 20

4.7 Crus + Servo ............................................................................................... 22

4.8 Uploading Assembly Program ................................................................ 24

4.9 U Joint Unit + Crus ..................................................................................... 26

4.10 Upper Plate + Leg ..................................................................................... 28

4.11 Bottom Plate + Sensor .............................................................................. 30

4.12 Upper Plate + Bottom Plate ..................................................................... 33

4.13 Wiring .......................................................................................................... 35

4.14 Shell ............................................................................................................. 36

Experiments .................................................................................................................. 37

5.1 App Control ............................................................................................... 37

5.2 Obstacle Avoidance ............................................................................... 39

5.3 Line Following when Avoiding Obstacle ............................................... 39

5.4 Dance ......................................................................................................... 40

Code Explanation ....................................................................................................... 41

6.1 ServoWrite.ino ............................................................................................ 41

6.2 APP.ino........................................................................................................ 44

6.3 Avoidance.ino ........................................................................................... 48

6.4 Following.ino .............................................................................................. 51

Afterword ...................................................................................................................... 53

SunFounder

Page 3: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

1

Introduction

1.1 Overview

RollFlash is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just

like Flash in Zootopia, it is named RollFlash - moves really like a "flash".

With an open source Arduino Nano board for control, a Servo Control Board, and a

Bluetooth Module, it walks slowly with eight SF servos (9g) driving four legs. Equipped with an

ultrasonic module on the front, it can avoid obstacle easily; with an infrared module at the

bottom of the front, it follows lines. In addition, you can control the movement of the

RollFlash on your Android phone.

SunFounder

Page 4: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

2

Components List

2.1. Acrylic Plates

1. Bottom Plate x 1

2. Ultrasonic Fixing Plate x 1

3. Support Plate x 2

4. Joint Connector x 8

5. U3 Plate x 4

6. Upper Plate x 1

7. U2 Plate x 4

8. Crus x 4

9. U1 Plate x 8

10. Acrylic Washer x 6

SunFounder

Page 5: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

3

Prior to assembling the RollFlash, you need to remove the residues in the holes of the plates

and the stickers on the plates. Here we take the U1 plate for example.

1. Check whether there are some

residues in the holes of the acrylic

plate.

2. Use a tool with a pointed end to remove

the residue.

3. Make sure that all the residues are

cleared.

4. Use the pointed tool to scratch off the

sticker on the plate.

2.2. Mechanical Fasteners

Name Accessory Qty.

M1.2*4

Self-tapping Screw

16

M1.6*10 Screw

4

M1.6 Nut

4

SunFounder

Page 6: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

4

M2*8 Screw

16

M2 Nut

16

M3*8 Flat-Head Screw

2

M3*10 Screw

36

M3 Nut

38

M3*6 Corn Rivet

4

φ3*φ8*4 Flange

Bearing

8

2.3. Electronic Components

SunFounder

Servo (9g)

8

18650*2

Battery Holder

1

SunFounder

Page 7: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

5

SunFounder Nano

V4.0

1

SunFounder Servo

Control Board

1

SunFounder Bluetooth

Module

1

SunFounder

Ultrasonic Module

1

SunFounder

Page 8: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

6

SunFounder Infrared

Module

1

4-Pin Jumper Wire

1

6-Pin Jumper Wire

1

Mini USB Cable

1

Riband

1

Heat Shrink Tubing 6

Wire Clip

2

SunFounder

Page 9: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

7

Sponge Bag

4

Transparent Tape

1

Shell

1

2.4. Tools

Philips Screw Driver

1

2.5. Self-Provided Components

18650 Battery

2

SunFounder

Page 10: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

8

Get Started with Software

3.1 Download the code

1. Prior to the project, you need to go to our website www.sunfounder.com on LEARN->Get

tutorials->Robot Kit->Rollflash Bionic Robot Turtle for Arduino and download the

package:

2. In the package you can see:

Included are the code for the kit, schematic diagrams of the modules, the app installer

for Android phones, driver for Nano board, and the 3D printer file Rollflash.stl for the shell.

3. For related introduction and assembly videos of the Rollflash Bionic Robot Turtle for

Arduino, please click VIDEO -> Robot Kit -> Rollflash Bionic Robot Turtle for Arduino.

3.2 About Arduino

3.2.1 Description

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

http://www.arduino.cc.

3.2.2 Arduino Board – SunFounder Compatible

Arduino senses the environment by receiving inputs from many sensors, and affects its

surroundings by controlling lights, motors, and other actuators.

SunFounder

Page 11: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

9

In this kit, SunFounder Nano board is used.

3.2.3 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.

Step1: Go to the arduino.cc website and click Download. On the page, check the software

list on the right side under Download the Arduino Software.

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.

Step 2: Double click the exe. file and the following window will show up. Click I Agree. The

following interface will show up.

SunFounder

Page 12: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

10

Choose Next.

Click Browse to choose the installation path or enter a directory at the Destination Folder.

Click Install.

SunFounder

Page 13: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

11

The following interface will show up. Note: After the installing progress bar goes to the end,

the Close button may be enabled for some PC. Just click it to complete the installation.

Then a prompt appears. Select Always trust software for "Adafruit Industries" and click Install.

Select Always trust software for "Arduino srl" and click Install.

SunFounder

Page 14: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

12

After the installation is done, click Close. Then an Arduino icon will appear on the desktop:

3.2.4 Install the Driver

If the driver is not installed, the Nano board will not be able to be recognized by your

computer. Therefore, before using it, please install appropriate driver.

For Windows users, run PL2303_Prolific_DriverInstaller_v1.10.0.exe in the folder Rollflash Bionic

Robot Turtle for Arduino.

For Mac users, refer to the folder PL2303_MacOSX_1_6_1_20160309 in the folder Rollflash

Bionic Robot Turtle for Arduino.

SunFounder

Page 15: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

13

Assembly

4.1 Upper Plate + Riband

4.2 Upper Plate + Battery Holder

1. Place the battery holder on the upper

plate. Note: Leave the holder’s wires in

the tail direction.

2. Fasten the battery holder with two M3*8

screws and two M3 nuts. It should be

shown as below after it's done.

1. Cut the 30cm ribbon into halves. Thread the ribbon through the acrylic plate. Leave

the riband with one end longer on one side of the plate (onto which to fix the battery

holder). Thread the other half through the upper plate in the similar way.

SunFounder

Page 16: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

14

3. Fold the ribbons in the battery box.

4. Install the batteries. Pay attention to the

anode and cathode in case of inserting

inversely.

5. It should be like this after the installation:

4.3 Upper Plate + Servo

1. Align a servo with a servo slot on the

upper plate. Pay attention to the

direction of servo wires (shaft toward

the head).

2. Assemble the servo into the plate.

SunFounder

Page 17: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

15

3. Align two M2 nuts with the servo

mounting holes, and fasten them with

two M2*8 screws.

4. It should look like this:

5. Mount the other three servos in the same way. Pay attention to the direction of servos’

shaft (as shown below).

4.4 Upper Plate + PCB

1. Align the four acrylic washers with the

holes of the upper plate.

2. Place the washers on the plate.

SunFounder

Page 18: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

16

3. Put Servo Control Board onto the upper

plate. Make sure the power port of the

board is at the rear part, and that the

four mounting holes are well aligned with

those on the plate.

4. Insert four M3*10 screws through holes on

the Servo Control Board, 4 acrylic

washers, and into 4 M3 nuts, and tighten

them. The assembly should be like this:

5. Plug the SunFounder Nano onto the

Servo Control Board. Pay attention to

place its USB port close to the

aforementioned power port. Align the

pins with female headers as shown

below.

6. Insert the pin into headers.

SunFounder

Page 19: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

17

7. Align the pins on the Bluetooth Module

with the female headers on the Servo

Control Board as shown below.

8. Insert the Bluetooth Module into the

board.

4.5 U Joint-A/U joint-B

1. Align the rocker arm with the mounting

holes on U1 plate.

2. Assemble the arm to the plate with two

M1.2*4 self-tapping screws in the first and

last small holes of the rocker.

3. Align the bulges of the assembled U1

plate with concaves of the Joint

Connector.

4. Insert the bulges into the concaves.

SunFounder

Page 20: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

18

5. Place an M3 nut in the groove of the

rocker fixing plate, and insert an M3*10

screw from below into the nut.

6. Tighten the screw.

7. Insert the U2 plate into the connector

plate. Note: The size of the end hole near

its arc is different from U1.

8. Place an M3 nut in the groove of U2,

plate and insert an M3*10 screw from

below into the nut.

9. Tighten the screw. Now such a U joint

(type-A) is assembled.(U1+U2)

10. Assemble the other kind of U joint (type-

B) in the same way. (U1+U3)

SunFounder

Page 21: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

19

11. So four type-A U joints are assembled as shown below:

12. Four type-B U joints assembled:

Small hole on the

side without rocker

arm - Tyep A

Large hole on the

side without rocker

arm - Type B

SunFounder

Page 22: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

20

4.6 U Joint Unit-1/U Joint Unit-2

1. Assemble a type-A U joint with a type-B U

joint perpendicularly as shown below.

Align all the 4 mounting holes in the

middle of the two connector plates.

2. Place them close.

3. Insert two M3*10 screws from the type-A

U joint's side through the middle two

holes in row, and fix them with two M3

nuts on the other side.

4. Tighten the screws. Now a U joint unit

(type-1) is done.

SunFounder

Page 23: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

21

5. Connect another unit of type-A + type-B U joint in the same way. Now we have two

type-1 units.

6. Connect the rest U joint units in the similar way, but remember to rotate the type-B U

joints 180 degrees when connecting. Now, we have two type-2 units as shown below.

Large hole on

the right

Large hole

on the left

SunFounder

Page 24: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

22

4.7 Crus + Servo

1. Align the hole of the crus plate with the

servo. Pay attention to the direction of

the crus and the crus (foot) as shown

below.

2. Assemble the crus to the servo.

3. Connect the two components with two

M2 nuts and M2*8 screws.

4. Tighten the screw.

SunFounder

Page 25: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

23

5. Now, we have two assembled crura of this type.

6. Assemble the other two symmetric crura in the same way. Pay attention to the

direction of the feet when inserting the servo into the hole.

SunFounder

Page 26: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

24

4.8 Uploading Assembly Program

Note: Before installing the rocker arm for each servo, you need to adjust the servo. Connect

the servo wires to the port D2 of the Servo Control Board and configure the initial position of

the servo.

Step 1: Hook the servo wires to D2, connect the Servo Control Board to PC via a USB cable,

and the PC will automatically install the driver. The COM port connected will appear.

Step 2: Go to the folder Rollflash Bionic Robot Turtle for Arduino\Code\Basic\1.Servo and

open the file Servo.ino.

Step 3: Select the Board.

SunFounder

Page 27: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

25

And Port.

Step 4: Click Upload.

After the upload is completed successfully, unplug the USB cable and press the switch on

the board. You may hear the sound of gear moving (or may not, if the servo shaft happens

to be at 90 degrees at the beginning; but you GENTLY spin the rocker arm and you'll find it's

unmovable). So now the servo is adjusted to 90 degrees.

SunFounder

Page 28: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

26

4.9 U Joint Unit + Crus

1. Align the φ3*φ8*4 flange bearing with

the hole in the type-2 U joint unit.

2. Insert the flange bearing into the hole.

3. Make sure the crus is perpendicular to

the U1 plate as shown below. If not,

gently pull out the servo and insert it

again in case of damage caused by

spinning the shaft. Slightly open the U1

joint to insert the servo shaft on the crus

into the hole on the joint. But don’t open

too wide, or the plate will break up.

4. Insert an M2*4 self-tapping screw into the

servo shaft and tighten them.

90° SunFounder

Page 29: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

27

5. It should be like this. After one leg is

done, unplug the servo wires connected

to D2 for connection of the next servo.

6. Assemble the other similar leg. DO adjust

all servos by connecting to D2 before

assembling each leg.

7. Assemble the crus to the other Type-2 U joint unit.

SunFounder

Page 30: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

28

8. Assemble two crura to the type-1 U joint units in the same way.

4.10 Upper Plate + Leg

1. Align the M3*6 Corn Rivet with the hole

on U2 plate from the inside of the Type-A

U joint.

2. The assembly should be like this:

SunFounder

Page 31: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

29

3. Connect the servo to Port D2 on the

Servo Control Board for calibration.

Keep the leg and the servo in 45

degrees. Open the U1 plate a little to

insert in the servo connected to the

upper plate. Also DO NOT open too

much in case of plate breaking.

4. Note: Remember to unplug the servo

wires connected to D2 for connection

of the next servo.

Align an M2*4 self-tapping screw with

the hole of the servo rocker arm on the

upper plate.

5. Tighten the screw.

6. Assemble the other three legs in the

same way. Pay attention to the direction

of foot since there are two types.

45°

SunFounder

Page 32: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

30

4.11 Bottom Plate + Sensor

1. Align the ultrasonic module with the

mounting holes on the ultrasonic fixing

plate.

2. Mount the module on the plate.

3. Align four M1.6*10 screws and four M1.6

nuts with the mounting holes as shown

below.

4. Tighten the screws. There will have a

small gap between them because of

the pins on the ultrasonic module.

5. Align the module with the slot on the

bottom plate as shown below. Make

sure the module’s port is upwards.

6. Mount the module on the plate.

SunFounder

Page 33: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

31

7. Place an M3 nut in the groove of the

module, and insert an M3*10 screw from

underneath as shown below.

8. Tighten the screw.

9. Insert two M3*10 screws into the infrared

module from underneath.

10. Insert the screws through two acrylic

washers.

11. Insert these two M3*10 screws through

the bottom plate and two M3 nuts as

shown below.

12. Tighten the screws.

SunFounder

Page 34: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

32

13. Align the bulges of the support plate

with the holes on the bottom.

14. Insert the support plate.

15. Place an M3 nut in the slot of the support

plate. Align an M3*10 screw from below.

16. Tighten the screw.

17. Fix the other support plate on the bottom

plate in the same way.

18. Align four φ3*φ8*4 flange bearings with

the holes on the bottom plate.

SunFounder

Page 35: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

33

19. Insert them into the bottom plate.

20. Insert the 6-pin anti-reverse cable into

the port of the infrared module as shown

below.

4.12 Upper Plate + Bottom Plate

1. Thread the 6-pin anti-reverse cable through the wire slot on the upper plate. Align the

bulges of the support plate and the ultrasonic plate with the mounting holes on the upper

plate.

SunFounder

Page 36: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

34

2. Connect the support plate to the upper plate. Before that, you need to insert the four

rivets on the U joints into the flange bearings on the bottom plate.

3. Insert three M3*10 screws from the upper bottom plate through the bottom plate into M3

nuts.

SunFounder

Page 37: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

35

4. Fasten then screws.

4.13 Wiring

1. The servos and pin headers on the Servo Control Board are marked number 1-8 as shown

below. Connect the servos to the corresponding ports. Pay attention that the yellow wire

should be toward the tail direction. Then insert the 6-pin cable into the 6-pin port.

Connect the ultrasonic module to the Servo Control Board with a 4-pin cable. (Here we

provide six heat shrink tubing to wrap the servo wires, 4-pin cable and 6-pin cable. Then

you can organize the shrink tubing for servo wires with two wire clips, and fix them close

to two sides of the servo control board with the 3M tape.)

SunFounder

Page 38: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

36

4.14 Shell

The shell provided in the kit is a paper-made one for decoration. You can assemble it if you

want. Here we will show you how to assemble the shell.

1. The unfolded shell is shown as below.

2. Fold the shell along the white lines, and

use the transparent tape to stick two

adjacent plates together on the inside.

3. Remove the sticker on the bulging edge

of the shell as shown below.

4. Fit the shell with the upper plate. Press the

shell gently to stick to the plate.

5. Put on the sponge bag for the legs for the anti-slip purpose.

SunFounder

Page 39: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

37

Experiments

As we all know, tortoise is a reptile with four feet, so does this quadruped RollFlash. On each

leg there are two servos, thus it can complete actions including moving forward and

backward, turning left and right, etc. with these eight servos. What’s more, equipped with

a Bluetooth module, ultrasonic module, and infrared module, it can be controlled on an

Android phone by app, avoid obstacles, and follow lines. Let’s go further into the basic

programs and game programs.

5.1 App Control

With the application provided, you can control the RollFlash remotely. The cell phone sends

out signals which will be received by the robot via the Bluetooth module onside. Then the

quadruped makes movements accordingly.

1) Upload APP.ino under path Rollflash Bionic Robot Turtle for Arduino/Code/ 2. APP to the

RollFlash via the USB cable. Turn on the power switch of the Rollflash, and power indicator

LED will blink.

2) Install RollmanAPP.apk under the path Rollflash Bionic Robot Turtle for Arduino/APK/ in a

mobile phone (for Android only)

3) After installing,you will see the icon on the phone desktop. Tap to open it and the

Bluetooth interface of the mobile will pop up, as shown below. Then click searching for

the Bluetooth device to find ELET_SPP_ XXXXXX (your number may be different from

what's shown below) to pair. Note: If the matching fails, you cannot use the APP.

SunFounder

Page 40: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

38

4) Back to RollmanAPP, tap Select Device -> ELET_SPP_ XXXXXX, and then hit Connect.

5) If the Bluetooth has been connected to the Bluetooth of the mobile successfully. The icon

Connect in the App will become connected. The Status LED in the Bluetooth will keep

constantly lighting instead of blinking.

Now you can control the RollFlash to go forward, backward, turn left and right just on your

phone. Have fun!

SunFounder

Page 41: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

39

5.2 Obstacle Avoidance

An ultrasonic module is installed on the robot, so it can detect obstacles ahead and

measure the distance, at last avoiding the obstacles in front.

1. Open the code file Avoidance.ino under the path Rollflash Bionic Robot Turtle for

Arduino/Code/ 3. Avoidance and upload to the RollFlash.

2. Construct a building for the robot to play. You can see it can avoid obstacles

independently. Or just put some barriers for it and observe whether it can bypass. It really

does you'll find. Interesting, isn’t it?

5.3 Line Following when Avoiding Obstacle

Under the RollFlash there is a 5-channel line following module, which enables the robot to

go following a black line. In addition, in the sketch 4. Following, the part for obstacle

avoiding is also included. Therefore, after the sketch is run, the RollFlash can smartly avoid

the obstacle ahead when following a line. Let's check how to make it!

1. Open Following.ino under Rollflash Bionic Robot Turtle for Arduino/Code/ 4. Following

and upload it to the robot.

2. DIY a map. Prepare a white board (or a flat light-color surface) and some black tape

or a black Marker (not permanent). Then draw some straight-line or curved shapes with

the pen or sticking the tape. Or, you can also do on a black surface like blackboard

with a white chalk. But, DO pay attention to the following TIPS:

a) The lines should be at least 16mm wide.

b) The semi-diameter of the curve should be no less than 100mm.

c) Within 40mm on both sides of the line, there should NOT be anything almost black

(especially dark purple); otherwise, the IR sensor will be influenced when detecting.

d) The edge of the STOP block should be perpendicular to the trunk; the block should be

50mm wide and 60mm long at least.

SunFounder

Page 42: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

40

3. You can place some obstacles on the line to see the RollFlash bypass them when

following the line.

It's quite fun to draw the lines and figures aside. Just keep the tips in mind when playing.

5.4 Dance

The code file Dance.ino under Rollflash\Rollflash Bionic Robot Turtle for Arduino\Code\5.

Dance\Dance, as the name suggests, is to make the RollFlash dance. Upload the code to

the board and the robot will just dance. That's quite cute and lovely, just like a baby!

Note: To learn more about the code in these experiments, you can find details in the

following chapter, Code Explanation.

SunFounder

Page 43: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

41

Code Explanation

6.1 ServoWrite.ino

Looking at the code folders, you may find that on matter for the app, the obstacle

avoidance function or the line following, there is always a sketch ServoWrite.ino. Actually it's

for servo control, so no wonder. You can check the description below for the code.

Control the servo on pin 2

The program above is for control of a single servo. By setting three parameters including c2,

the starting angle, s2, the end angle, and ms0, the rotation speed, we can control the

rotating angle and speed of the servo.

Control the servos on pin 4 and pin 7

The program below is for controlling two servos simultaneously. By setting five parameters

including the starting angles c4 and c7, the end angles s4 and s7, and the rotation speed

ms0, we can control the rotating angle and speed of two servos at the same time.

SunFounder

Page 44: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

42

Control the servos on pin 5, pin 6 and pin 8

SunFounder

Page 45: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

43

Then control three servos simultaneously. By setting seven parameters including the starting

angles c5, c6, and c8, end angles s5, s6, and s8, and the rotation speed ms0, we can control

the rotating angle and speed of three servos at the same time.

Control the servos on pin 7, pin 2, pin 4 and pin 8

SunFounder

Page 46: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

44

Next, control four servos simultaneously. Similarly, by setting nine parameters including c7,

c2, c4, c8 (starting angles), s7, s2, s4, s8 (end angles), and ms0 (rotation speed), we can

control the rotating angle and speed of four servos at the same time. Movements of the

RollFlash robot can be well controlled by calling those programs above. Here we just take

some examples about different controlling.

6.2 APP.ino

The servo control base program in last chapter lays a foundation for controlling the RollFlash

to move forward and backward, and turn left and right. Next let's talk about the specific

control program for some movements.

SunFounder

Page 47: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

45

In the program above, the number 30, the value in the function ServoWrite() represents the

pace of RollFlash. Due to its structure design (the servo installation), the moving pace is fixed.

How can it move forward? It moves its feet diagonally in opposite directions: raise the right

front foot and move forward -> raise the left front foot and right hind foot at the same time

to move the body –> the right front foot gets on the ground –> raise the left hind foot to

move forward –> the left hind foot gets on the ground. It walks a step forward after all these

actions.

Then it continues from the other side: raise the left front foot and move forward –> raise the

right front foot and left hind foot at the same time to move the body –> the left front foot

gets on the ground –> raise the right hind foot to move forward –> the right hind foot gets

on the ground. It walks another step forward then.

Therefore, it will keep walking forward by continuing these two loops.

The program above is to control it move backward, which is similar to moving forward. The

only difference is the walking direction: raise the right hind foot and move backward -> raise

the right front foot and left hind foot at the same time to move the body -> the right hind

SunFounder

Page 48: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

46

foot gets on the ground -> raise the left front foot to move backward -> the left front foot

gets on the ground. It walks a step backward after all these actions.

Then it continues from the other side: raise left hind foot and move backwards -> raise the

left front foot and right hind foot at the same time to move the body -> the left hind foot

gets on the ground -> raise the right front foot to move backward -> the right front foot gets

on the ground. It walks another step backward then.

Therefore, it will keep walking backward by continuing these two loops.

The program above is for turning right. RollFlash can realize turning right by keeping the left

feet moving forward, while to do the right feet moving backward.

SunFounder

Page 49: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

47

Program above is for turning left. RollFlash can realize turning left by keeping the left feet

moving backwards, while the right feet moving forwards.

The above code is for the RollFlash’s basic movements. It will follow the commands received

from the Bluetooth module via the serial port and take the corresponding actions.

With the code above, we can read the data from the Bluetooth module, and save it with

a variable.

SunFounder

Page 50: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

48

If the command "c" is received, it means to let RollFlash move forward; if the command "d",

it moves backwards; if "a", it turns left; if "b", it turns right; if "s", it stops. Thus, we can remotely

control the RollFlash to move forward and backward, turning left and right, etc.

6.3 Avoidance.ino

We have learnt a lot on servo and basic control for the RollFlash and how it moves. Thus, it

would be quite easy to control it for obstacle avoiding. The program can judge whether

there is an obstacle in front of the RollFlash by reading data from ultrasonic module on it,

and further control the robot to avoid the obstacle by corresponding programs.

SunFounder

Page 51: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

49

The program above is to read data from the ultrasonic. By calling this program to read the

data, we can know how far the obstacle is ahead. Then write the code that if there is an

obstacle 10cm away in the front, control the RollFlash to move back to 15cm from the

obstacle, then turn left or right to avoid it, and continue to move. Thus, the RollFlash can

realize obstacle avoiding function.

SunFounder

Page 52: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

50

SunFounder

Page 53: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

51

6.4 Following.ino

The infrared line following module enables the RollFlash to detect a black line through the

collected data, so that it can adjust the direction and follow the line. Meanwhile, the

RollFlash will walk away from the obstacle on a black line it's following, bypass the obstacle

and come back to follow the line.

The program above is to read the black line’s position. By comparing the AD value and the

setting reference, it can tell whether the black line is at the centre-left or centre-right position.

SunFounder

Page 54: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

52

When the sensor detects the black line is at the centre-left, the RollFlash will turn left slightly;

when it is at the centre-right, the robot should turn right a bit; when the line is in the middle,

the RollFlash would move forward. That’s how it works for line following. Besides, it needs to

detect whether there're obstacles and avoid them if yes.

The program above is about detecting whether there's an obstacle 6cm in front of the

RollFlash by the ultrasonic module. If it detects an obstacle, it will walk away from the

obstacle, and then walk back to follow the line. Thus, we can realize the line following &

obstacle avoiding.

SunFounder

Page 55: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

53

Afterword

So that's this cute tortoise robot RollFlash! With the assembly of the RollFlash robot, you will

better learn how it works and feel the sense of satisfaction. You can start your journey now

and have lots of fun with the bot. Show it to your friends and have fun!

You may have encountered with assembly or code issues during the course. Though we

have improved this manual and avoided some mistakes, it still can be unsatisfactory. We're

sorry for the bothering and welcome to provide your feedbacks!

If you have any suggestions or ideas, post forums on our website www.sunfounder.com!

SunFounder

Page 56: SunFounder€¦ · is a good learning kit for Arduino and robot hobbyists. Since it moves slowly just . like Flash in Zootopia, it is named . RollFlash - moves really like a "flash".

54

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.

SunFounder