DAGU Playful Puppy User manual

WWW.AREXX.COM.CN
Manufacturer:
DAGU Hi-Tech Electronic Co.,LTD
RS032
Copyright 2013 by DAGU Hi-tech Electronic Co., Ltd.
All rights reserved. No portion of this instruction sheet or any artwork contained herein may be reproduced in any
shape or form without the express written consent of DAGU Hi-tech Electronic Co., Ltd.
The manufacturer and distributor cannot be held responsible for any damages occurred by mishandling, mounting
mistakes or misuse due to non-respect of the instructions contained in this manual.
C
Address:NO.4-107/108 HengXing Street, HengHai Rd, South District, ZhongShan City of GuangDong China
TEL:0760-88811951
http://www.arexx.com.cn
E-mail:info@arexx.com.cn
Playful Puppy
Instruction Manual
1

Contents
Product description
Warnings
Required tools
Parts list
Assembly instructions
Wiring Instructions
Installing the Software
Controlling the robot
Understanding the code
Uploading via the ISP socket
Burning the bootloader
Trouble Shooting
Controller specifications
3
3
3
4
5
9
11
13
14
22
24
25
26
2

Product Description
Thank you for selecting the Playful Puppy for your next do-it-your-self project. This kit
allows you to build and program a small quadruped robot that can track moving objects
and respond to your hand movements.
Product Features
1. Arduino compatible robot controller with USB interface.
2. Laser cut, transparent acrylic base plate.
3. 10x 9g miniature servos.
4. 1x pan tilt assembly with magnetic servo clutches.
Build it now! Realize your dream! Create your next masterpiece!
Please read this manual thoroughly before you start assembling the kit. Please follow the
assembling instructions exactly to avoid problems. If you work accurately and follow the
instructions in this manual exactly, you will quickly assemble your Playful Puppy robot.
Before you start you must prepare the following tools:
!
Opened packages can not be returned. Please check package contents before opening.
Read the instructions carefully before assembly.
Use all tools carefully.
Small parts are a choking hazard. Keep this kit away from young children and babies
during construction and operation.
Not for children under 8 years. Not to be used by children except under adult
supervision.
Observe the correct polarity of the battery.
Keep the battery dry at all times.
Do not mix old and new batteries. Do not mix alkaline, standard (carbon-zinc), or
rechargeable (nickel-cadmium) batteries.
Remove the battery if the kit is not used for a long period of time.
4x AAA BATTERY
(not included)
PHILLIPS SCREW DRIVER
(included in kit)
Necessary Tools:
Warnings:
HEX SPANNER
(included in kit)
3

8
145
67
19
Parts List:
Base plate 1pc 9g geared motor 10pcs Round servo horn 4pcs Servo horn-2 4pcs
M2.6*12 self-tapping
screw with flange 4pcs
M2*5 self-tapping
screw 6pcswith flange
M3*6 screw 10pcs
Mini Driver board 1pc Battery holder 1pc
20
23 24 25
23
Leg segment 8pcs EVA feet 4pcs
5x3mm magnet 16pcs
9 10
9g servo clutchplate
2pcs
Servo mounting
bracket 1pc
11 1512 13 14
Pan-tilt bracket-1 1pc M2.2*8 self-tapping
screw 16pcs
M2*6 self-tapping
screw 16pcswith flange
16 17
M2*6 self-tapping
screw 12pcs
M2*8 self-tapping
screw with flange 4pcs
18
M2.3*12 self-tapping
screw 2pcs
M2.6*8 self-tapping
screw 2pcs
21 22
M3*8 screw 2pcs M3 nut 10pcs M3 Nyloc nut 1pc Washer 5pcs
28 29 30
26 27
L30 brass spacer 4pcsL9 brass spacer 4pcs Glassine washer 4pcs
31 32
IR compound eye 1pc
Clutch-drop shape 1pc
Pan-tilt bracket-2 1pc
34
Clutch-elliptical shape 1pc
33 35
36
7 core rainbow cable 1pc
Spiral wrap tail 1pc
L15 spacer 1pc
Velcro adhesive strips
1 pc male, 1 pc female
4

Step 1:
Assembly Instructions:
Step 2:
Step 3:
0mm 10mm 20mm 30mm 40mm 50mm
0 inch 2 inch1 inch
Use the ruler to check the length
of your screws and spacers.
7
4
x2 x2
2
2
2
7
14
17
18
14 14
x4
x4
Please note that servo
mounts differently for
left and right legs.
attach legs so
knee bent at 90°.
5
Before you begin assembly
set all your servos to center
position as shown.
Servo
output
shaft
Servo stop shown
in center position

Step 4:
Step 7:
Step 5:
Step 6:
16 17
20
3
1
2
19
30 x2
5
25
21
15
10
34
23
12
Install 8x Magnets in both clutch
pieces so the
poles alternate
as shown.
34
30 x2
5
Note position
of hip servos
and mount legs
at 90°to body.
Pay careful attention to
which bracket you use.
The hole patterns are
different to suit various
sensors.
Make sure the servo
bracket is mounted
on the correct side.
6

Step 8:
19
Step 9:
Step 10:
0mm 10mm 20mm 30mm 40mm 50mm
0 inch 2 inch1 inch
22
13
23
26
21
25
(2pcs) 24
25(2pcs)
9
31
15
11
2
6
30 x2
5
Install 8x magnets in both clutch
pieces so the poles alternate
as shown.
7

0mm 10mm 20mm 30mm 40mm 50mm
0 inch 2 inch1 inch
Ready for wiring!
21
32
27
23
22
Step 13:
36
29
Step 11:
33
Step 12:
28
8
Remove protective paper
from adhesive strips and
mount battery holder with
velcro.

Wiring the robot:
Start by plugging the rainbow cable into the eye. Pay careful attention to the colours to ensure correct function of the
eye. Thread the cable under the tilt servo an use a cable tie to hold it in place. Leave this cable tie very loose so that
the cable can move a bit if necessary.
The Mini Driver includes a dual motor driver that is not used for this robot. By disconnecting the jumpers we can
access the control pins. Disconnect the Jumper for D8 and connect the violet wire. This wire controls the IR LEDs on
the compound eye. Now connect the blue, green, yellow and orange wires to A2, A3, A4 and A5 as shown. These are
your analog signals from the compound eye.
D8D8
Make sure the servo power selection jumper is toward
the outer edge of the PCB. This will power the leg
servos directly from the battery.
When servos are not being used this jumper can be set
to 5V allowing digital sensors to be powered from the 5V
regulator instead.
Now connect the power wires for the compound eye.
Red is +5V and brown is Gnd. Check carefully that
these wires are connected as shown in the photo with
the brown wire closest to the edge of the PCB.
The power pins on the analog inputs are always
connected to the 5V regulator not matter what position
the servo power jumper is in.
Loose
cable tie
Please note that
the brown wire
has been swapped
to the other side
Servo power selection jumperServo power selection jumper
9
Red wire
connects
to Vcc

In this robot, A0 and A1 are being used as digital outputs instead of analog inputs to drive the pan and tilt servos.
These servos are getting power through the 5V regulator so they cannot be heavily loaded.
Connect the "tilt" servo to A1 as shown in the first photo. Make sure the brown ground wire is closest to the outer
edge of the PCB. Next connect the "pan" servo to A0 as shown in the second photo.
Loosely cable tie the front knee and hip servos as shown. Make sure the knee and hip can both move freely over their
entire range before tightening the cable tie. Repeat the process for the rear legs. Feed these cables through the
holes in the base plate as shown.
Tilt servo
Pan servo
Front Left Hip
Front Left Knee
Front Right Hip
Front Right Knee
Rear Left Hip
Rear Left Knee
Rear Right Hip
Rear Right Knee
D6
D12
D11
D13
D5
D2
D4
D3
Connect the hip and knee servos as shown below.
Try to keep the cables neat as shown.
10
Cable ties
Make sure
the cable is
long enough
Keep
ground wires
to outer edge of PCB.
Keep
ground wires
to outer edge of PCB.

Installing the software:
The CD includes a copy of all third party software required for those without internet access. It is recommended that you check the
internet for the latest versions. To install the sample code you must first have the Arduino IDE version 1.03 or later running on your
computer. The Arduino IDE can be downloaded for free from here: . TheArduino IDE is available
for Windows, Mac and Linux platforms.
http://arduino.cc/en/Main/Software
The Playful Puppy robot uses the Mini Driver robot controller from DAGU. Before we can upload the sample code we must select
the correct board type and serial port. This is done in the Tools menu. Select "Arduino NG or older w/ATmega8" as your board type.
The robot controller uses the CP2102 USB interface IC. Depending on your OS you may need to install drivers. These are included
on the CD or you can download the latest from here:
http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx.
Once you have the Arduino IDE running you can goto the PlayfulPuppy folder and open the "PlayfulPuppy.ino" file on your CD. If
your CD is lost or damaged you can download the software from the DAGU product support site here:
https://sites.google.com/site/daguproducts/
11

Installing the software ( cont.):
Before you plug the robot into the computer make sure you have 4x freshly charged AAA NiMh batteries installed and the power
connector plugged in the correct way. Turn off the robot while uploading the new program to stop the robot from trying to move. The
processor and head servos will be powered from the USB port but the leg servos will not have power.
If you are using a small laptop or your USB ports are heavily loaded then your computer may not be able to power the robot through
the USB. In this case, leave the robot turned on and put it on it's back so it cannot try to run away.
Before you upload the code it is always good practice to verify it first. This will compile the code and check for any errors before
attempting to upload the code. When you click on the upload button a progress bar will appear at the bottom. The message "Done
compiling." and the size of the compiled code will appear when the process is complete.
Once the code has been verified you can upload the code to the robot. The progress bar will appear again and the D13 LED on the
controller will flash a few times. Once the message "Done uploading." appears you can disconnect the robot and turn it on. The
robot will not start immediately. This gives you time to put it on the ground.
12

Controlling the robot:
Using the sample code provided, the puppy responds to movement. When your hand or any object is in range (within
15cm - 20cm) of the puppy's compound eye the puppy will track the movement of your hand with it's head.
When standing the puppy will follow your hand and if necessary, will turn to try and keep your hand in front of it. If
your hand gets too close the robot will back up. If your hand is too far away (but still in range) then the robot will walk
forward.
If you do not play with the puppy it will get bored and sit down. While the robot is sitting, if you slowly move your hand
down and then towards one of the front legs it will lift that leg to "Shake Hands". If you move your hand between the
legs the robot will lie down.
To get the robot back up on it's feet you need to make it look straight up. Making the puppy look straight up will get it
to jump up on it's back legs.
13

setup()
Initialize servos
configure pins
Include
Servo library
Constants
IOpins
define
global variables
and servos
Yes No
Follow()
Play()
Jump()
Walking
Motion()
Sitting
Motion()
Is puppy
bored?
IReye()
IRtrack()
Look
up?
Take
step?
Do
nothing
SitShake
Liedown()
Puppy
sitting?
No
Yes
Shake
Right
Shake
Left
Lie
down
Get
up
loop()
On / Reset
14
Understanding the Code:
Although you can play with the robot using just the sample code provided, the real fun is in teaching it new tricks!
This section explains some of the basic features of the code and how they can be changed. Do not be afraid to
experiment, you can always restore the original code if you make a mistake.
Below is a flowchart of the sample code. A flow chart is not actual code, it is more like a map showing blocks of code
and the different paths the processor can follow within your code. Lines linking the blocks have an arrow head
showing the direction that the processor must follow along the path.
As you can see, once the processor enters the loop(), no matter which path it takes, they all return back to the loop
and the process is repeated. The only way to break out of the loop is to switch the power off or reset the processor.
Depending on the inputs from the sensors and the values of the timers, different paths are taken
as the code repeats the loop over and over again. If you write additional code to teach the puppy
new tricks then additional pathways will be added to the map.

Understanding the code (cont.)
If you are new to Arduino then a guide to all the main commands and functions can be found by going to help and
selecting reference.
The first tab is the main program. In the beginning the <Servo.h> library and definitions are added. Then global
variables and servos are defined.
The setup() function runs only once when the program first runs. This is where the servos are attached to their digital
pins and initialized to their center positions. By default, all digital pins are configured as inputs on startup as a safety
precaution. The pinMode() command is used here to reconfigure the IRleds pin to become a digital output so it can
control the IR LEDs on the compound eye.
The loop() function is the main section of code. As the name suggest, this code is run repeatedly until the processor
is reset or turned off.
15

The speed and stepsize constants can be used to change the gait of the robot. Bigger steps need more time for the
servo to move but cover more ground. Smaller steps can be completed quicker and might offer smoother movement.
Making the speed value smaller will make the robot faster but if it is too small then the servos will not keep up and the
robot will not walk properly.
The constant bestdistance is the average distance the robot tries to maintain between itself and the object it is
tracking. Bigger values = smaller distance. Closer distances make it easier to maintain a lock on the object.
The constant distancemax is the maximum distance an object can be before the robot ignores it. If this value is too
small then the robot will confuse ambient light for an object. The smaller the value, the greater the distance.
LRscalefactor and UDscalefactor are used to adjust how quickly the head moves in response to an object. In most
cases you do not need to adjust these values. If the head moves too quickly it can overshoot and the head will tend to
vibrate or constantly shake. Too slow and the robot will loose it's lock on a moving object. If you make changes to the
code that affect how quickly the main loop repeats then these values may need adjustment to compensate.
IRdelay is the time in microseconds needed for the photo transistors in the compound eye to respond to changes in
the IR light when the IR LEDs turn on or off. Increasing this value may improve the robot's sensitivity a bit but it will
also make the robot slower and less responsive.
Understanding the code (cont.)
The second tab is [Constants.h]. This tab contains definitions for constant values that do not change when the
program is running. In this tab we can set the center position of each servo and experiment with some other values
that affect the way the robot walks and tracks movement.
Normally the servos should be centered at 1500. If they need a big adjustment you should re-seat the servo horn. For
fine adjustment (+/- 200) you can change the center values in this tab.
The Boredom constant determines how long the robot will wait for you to play with it before it gets bored and sits
down. 3000 milliseconds = 3 seconds.
16

Understanding the code (cont.)
The [IOpins.h] tab is your programs wiring diagram. If you want to change which pins are used for a servo or sensor
then that change must be reflected here. If you need to replace a servo or even if you are wiring up the robot for the
first time then this tab is your guide as to what device connects to which pin.
The [IReye] tab is where the data from the eye is generated. This code first takes a reading of all sensors
with the IR LEDs turned ON. This reading is a combination of the ambient IR light plus the IR light from the
LEDs being reflected from any nearby objects.
Then the LEDs are turned OFF and the sensors are read again. This reading is only the ambient IR light.
These values are subtracted from the previous sensor readings to give a value equal to just the IR light
from the IR LEDs being reflected by any nearby objects.
This value depends a lot on the size and colour of the object being tracked. If there is a lot of ambient IR
light such as bright sunlight then the sensor can be blinded. The eye works best indoors or at night.
17

Understanding the code (cont.)
The tab [IRtrack] is where the data from the compound eye is used to control the pan and tilt servos. If there are no
objects nearby then the head will slowly return to center position.
Basically the code adjust the pan servo to keep the left and right IR values equal. The tilt servo is adjusted to keep
the upper and lower IR values equal. This keeps the sensor facing directly at any nearby object.
The variables panscale and tiltscale are used to try and compensate for distance and the speed at which the
program runs. The constants, LRscalefactor and UDscalefactor can be changed in the [Constants.h] tab to
compensate for changes in the code that affect the speed of the code.
The code in the [Follow] tab is where the speed and direction of the legs are controlled. If the head has to
turn too far to track an object, the LShift and RShift walking speeds are adjusted to turn the body towards
the object being tracked. These speeds are then adjusted forward or backward to try and maintain
bestdistance from the object being tracked.
18

Understanding the code (cont.)
This robot uses some timers in the code to control certain functions. This is done using the millis() function which
counts the number of milliseconds since the robot was turned on. We will briefly look at how the unsigned long
variable sit is used to measure boredom in the robot.
In the [Play] tab, sit is set to equal the value reported by the millis() function whenever the robot takes a step. This
resets the boredom timer because the difference between millis() and sit is reset to 0.
In the loop() section of the code, the difference between millis() and sit are compared to the constant Boredom.
The result is that if the robot does not take a step for Boredom milliseconds then the robot will become bored and sit
down. Once this happens, the timer cannot be reset unless you make the robot look up at which point the variable sit
is set to equal the new value of millis() in the [SitShakeLiedown] part of the code and the difference is now 0 again.
In the loop() function, the program constantly reads the sensors in the eye, tracks movement with the head. If the
puppy is not bored then it will follow your hand and walk / jump in play mode. If the puppy becomes bored then it will
sit down. In this mode it will shake hands or lie down.
19

The code for the puppy's walking motion (gait) is in the [WalkingMotion] tab. The gait consist of 10 steps with
nothing happening in steps 2,4,7 & 9 to allow more time for the legs to move forward / backward. Essentially, two
diagonally opposite legs lift simultaneously, move forward or backward by the values LShift, RShift then lower
again. Then the other two legs raise, move and lower.
Negative values of LShift and RShift make the legs go backward instead of forward. The Speed constant
determines the number of milliseconds between steps in the gait. Stepsize set the limit for the size of the steps.
Understanding the software (cont.)
If the robot is not bored then the code in the [Play] tab determines if the puppy walks or jumps. Normally the puppy
will walk unless the size of the steps, determined by the distance is too small. If the head tilts far enough upward to
track the object then the robot will jump.
20
Other manuals for Playful Puppy
1
Table of contents
Other DAGU Robotics manuals