SunFounder PiSloth User manual

SunFounder pisloth
www.sunfounder.com
Oct 19, 2021


CONTENTS
1 Component List and Assembly Instructions 3
2 About Robot HAT 5
3 Play with Ezblock 7
3.1 Quick Guide on Ezblock ......................................... 7
3.2 Move ................................................... 9
3.3 Don’t Touch Me ............................................. 12
3.4 Obstacle Avoidance ........................................... 15
3.5 Emotional PiSloth ............................................ 17
3.6 Dance ................................................... 21
3.7 Let’s Fight! Warrior! ........................................... 25
3.8 Remote Control ............................................. 29
3.9 Custom Step ............................................... 32
3.10 Custom Action .............................................. 38
4 Play with Python 41
4.1 Quick Guide on Python ......................................... 41
4.2 Move ................................................... 60
4.3 Dance ................................................... 62
4.4 Obstacle Avoidance ........................................... 65
4.5 Don’t Touch Me ............................................. 67
4.6 Let’s Fight! Warrior! ........................................... 69
4.7 Emotional PiSloth ............................................ 71
4.8 Remote Control ............................................. 74
4.9 Custom Step ............................................... 76
4.10 Custom Action .............................................. 79
5 Appendix 83
5.1 Filezilla Software ............................................. 83
5.2 I2C Configuration ............................................ 85
5.3 Remote Desktop ............................................. 87
5.4 About the Battery ............................................ 96
6 Thank You 99
7 Copyright Notice 101
i

ii

SunFounder pisloth
Thanks for choosing our PiSloth.
PiSloth is a Raspberry Pi Bionic robot with an aluminum alloy structure. It can talk, dance, and even express emotions,
such as happiness and excitement.
It has 22 different actions, such as: Stomp, Swing and MoonWalk, and you can customize the actions according to
your needs. PiSloth’s eyes consist of an ultrasonic sensor module that can be used to detect distance for obstacle
avoidance and following functions.
In this tutorial, a list and assembly pdf, introduction to Robot HAT, and programming of PiSloth are included.
The programming part is divided into two chapters: Play with Ezblock &Play with Python, and each of them can get
you stated on making PiSloth work in way you want.
Ezblock Studio is a development platform developed by SunFounder designed for beginners to lower the barriers to
getting started with Raspberry Pi. It has two programming languages: Graphical and Python, and available on almost
all different types of devices. With Bluetooth and Wi-Fi support, you can download code, remote control a Raspberry
Pi, on Ezblock Studio.
More experienced makers can use the popular programming language - Python.
Content
CONTENTS 1

SunFounder pisloth
2 CONTENTS

CHAPTER
ONE
COMPONENT LIST AND ASSEMBLY INSTRUCTIONS
You need to check whether there are missing or damaged components according to the list first. If there are any
problems, please contact us and we will solve them as soon as possible.
Please follow the steps on the PDF to assemble.
Note:
1. Before assembling, you need to buy 2 18650 batteries and fully charge them, refer to About the Battery.
2. Robot HAT cannot charge the battery, so you need to buy a battery charger at the same time.
•Component List and Assembly Instructions.
3

SunFounder pisloth
4 Chapter 1. Component List and Assembly Instructions

CHAPTER
TWO
ABOUT ROBOT HAT
Robot HAT is a multifunctional expansion board that allows Raspberry Pi to be quickly turned into a robot. An MCU
is on board to extend the PWM output and ADC input for the Raspberry Pi, as well as a motor driver chip, Bluetooth
module, I2S audio module and mono speaker. As well as the GPIOs that lead out of the Raspberry Pi itself.
It also comes with a Speaker, which can be used to play background music, sound effects and implement TTS functions
to make your project more interesting.
5

CHAPTER
THREE
PLAY WITH EZBLOCK
Ezblock is a development platform developed by SunFounder designed for beginners to lower the barriers to getting
started with Raspberry Pi. It has two programming languages: Graphical and Python, and available on almost all
different types of devices. With Bluetooth and Wi-Fi support, you can download code, remote control a Raspberry Pi,
on Ezblock Studio.
Ezblock has been upgraded to the third version. Compared with the Bluetooth communication of Ezblock 2, Ezblock
3 uses Websocket to communicate, which is much faster.
So Ezblock 3 is used here.
3.1 Quick Guide on Ezblock
There are 2 parts here:
•Before Assembling PiSloth allows you to keep all the servos at 0 degrees to complete a proper and safe assembly
(otherwise you will probably damage the servos).
•Before Programming With Ezblock will guide you to download Ezblock Studio to play with PiSloth.
3.1.1 Before Assembling PiSloth
Before assembling the PiSloth, follow the instructions on how to install the Ezblock OS on an Micro SD card here:
Download and Install Ezblock OS.
After burning the Ezblock system on the SD-card, the P11 port on the Robot HAT is set to calibrate the servo angle to
a 0° angle. To make sure the servo has been correctly set to 0°, first gently insert a rocker arm in the servo shaft, then
slightly rotate the rocker arm to a different angle.
7

SunFounder pisloth
Next, insert the servo cable into the P11 port as shown below:
Turn on the Power Switch to the Robot HAT, and the servo arm should return to the 0° position. If the servo arm does
not return to 0°, press the RST button to restart the Robot HAT.
Note: Before attaching each servo, plug the servo cable into P11 and turn the power on to set the servo to 0°.
This function will become invalid after writing any programs to the Micro SD card.
8 Chapter 3. Play with Ezblock

SunFounder pisloth
3.1.2 Before Programming With Ezblock
First download Ezblock Studio 2, and then manually upgrade to Ezblock Studio 3 to begin programming.
For a detailed installation tutorial, please refer to: Install Ezblock Studio.
Note: After you connect the PiSloth, there will be a calibration step. This is because of possible deviations in
the installation process or limitations of the servos themselves, making some servo angles slightly tilted, so you can
calibrate them in this step.
But if you think the assembly is perfect and no calibration is needed, you can also skip this step.
Projects
Here, we show you the projects of playing PiSloth on Ezblock Studio. If you are new to these, you can refer to the
code images inside each project to program, and can learn the use of blocks according to TIPS.
If you don’t want to write these projects one by one, we have uploaded them to Ezblock Studio’s Examples page and
you can run them directly or edit them and run them later.
3.2 Move
This is the first project. PiSloth has woken up, and it moves freely.
Before programming, you need to learn the basic usage of Ezblock Studio from here.
•Quick User Guide for Ezblock 3
•How to Create a New Project?
3.2. Move 9

SunFounder pisloth
TIPS
This is the basic structure of the program, the Start block is used to do some initialization (even if no block is placed,
it cannot be deleted) and the Forever block is, as the name suggests, a continuous loop that allows your program to
change and respond.
This block is used to make PiSloth do a specific action several steps at a speed (%), for example, let PiSloth go forward
1 step at 50% speed.
Different actions can be selected from the drop down options, there are 22 in total.
10 Chapter 3. Play with Ezblock

SunFounder pisloth
This is a block that sets the duration of the previous block, unit: ms.
EXAMPLE
After writing the code according to the following figure, click the download icon in the bottom right corner, you will
see PiSloth move forward 3 steps, backward 4 steps, left 3 steps, right 5 steps, and finally stop. Since the whole code
is placed inside the Forever block, PiSloth will repeat the above actions after stopping for a while.
You can try putting the code from the Forever block into the Start block and see what happens.
3.2. Move 11

SunFounder pisloth
3.3 Don’t Touch Me
If you don’t meet PiSloth’s needs, it will get angry and stay away from your touch.
TIPS
You can directly use this block to read the distance to the obstacle right ahead.
Note: When assembling, Trig and Echo are connected to D2 and D3 respectively, you also need to change them
simultaneously when programming.
12 Chapter 3. Play with Ezblock

SunFounder pisloth
To achieve conditional judgment of “if” type, you need to use an if do block.
When you need to implement multiple conditional judgments, you will have to change if do into if else do. This can
be achieved by clicking on the setting icon.
You need to use a conditional statements block in conjunction with if do. Judging conditions can be “=”, “>”, “<”, “”,
“”, “”.
A number block.
This block can emit some preset sound effects, such as siren sound, gun sound and so on. The range of volume is
1~100.
3.3. Don’t Touch Me 13

SunFounder pisloth
EXAMPLE
14 Chapter 3. Play with Ezblock

SunFounder pisloth
3.4 Obstacle Avoidance
In this project, when PiSloth detects an obstacle, it will send a signal and look for another direction to move forward.
TIPS
This is based on the previous project Don’t Touch Me, which adds autonomous judgment, so that PiSloth can actively
avoid obstacles in front of it.
EXAMPLE
After the code runs, PiSloth will walk forward. If it detects that the distance of the obstacle ahead is less than 10cm, it
will stop and sound a warning, then turn left for 7 steps and stop. If there is no obstacle in the direction after turning
left or the obstacle distance is greater than 10, it will continue to move forward.
Since the effective detection distance of the ultrasonic sensor module is 2-400cm, when the detection distance is less
than it will do nothing.
3.4. Obstacle Avoidance 15

SunFounder pisloth
16 Chapter 3. Play with Ezblock
Other manuals for PiSloth
1
Table of contents
Other SunFounder Robotics manuals

SunFounder
SunFounder PiDog User manual

SunFounder
SunFounder Pico-4wd car User manual

SunFounder
SunFounder Sloth:bit User manual

SunFounder
SunFounder Sloth Learning Kit User manual

SunFounder
SunFounder PiSloth User manual

SunFounder
SunFounder picar-x User manual

SunFounder
SunFounder RollbotMicro User manual

SunFounder
SunFounder Bionic Robot Lizard User manual

SunFounder
SunFounder 3in1 Kit User manual

SunFounder
SunFounder Rollarm User manual