Karel User's Manual

Embed Size (px)

Citation preview

  • 8/18/2019 Karel User's Manual

    1/70

     

    KAREL 

    User’s Manual 

    Karel project has been funded with support from the

    European Commission.

    This publication reflects the views only of the author, and the

    Commission cannot be held responsible for any use which

    may be made of the information contained therein. 

  • 8/18/2019 Karel User's Manual

    2/70

     

  • 8/18/2019 Karel User's Manual

    3/70

    KAREL 

    User’s Manual 

    Mihai Agape

    Cristina-Maria AgapeMaciej Aleksandrowicz

    Maria-Genoveva Agape

    Karel utonomous Robot for Enhancing Learning

  • 8/18/2019 Karel User's Manual

    4/70

    Karel User’s Manual

    Copyright © 2015 by Karel project. Each author owns the copyright of their

    work, according to the Author’s Contributions.

    This work is licensed under the Creative Commons Attribution-ShareAlike4.0 International License. To view a copy of this license, visit

    http://creativecommons.org/licenses/by-sa/4.0/.

    You are free to:

    -  Share — copy and redistribute the material in any medium or format

    -  Adapt — remix, transform, and build upon the material for any

    purpose, even commercially.

    All trademarks in this manual are trademarks of their respective owners.

    Rather than use a trademark symbol after every occurrence of a

    trademarked name, we use names in an editorial fashion only, and to the

    benefit of the trademark owner, with no intention of infringement of the

    trademark.

    Authors’ Contributions:

    -  Mihai Agape: 1, 2.1.2, 2.2, 2.3, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.3, 4.2, 5, 6

    -  Cristina-Maria Agape; 3.1.1, 4.2

    -  Maciej Aleksandrowicz: 4.2.3

    -  Maria-Genoveva Agape: 2.1.1, 3.2, 4.1

    Coordinator: Mihai Agape

    The information in this manual is distributed on an “as is” basis, without

    warranty. Although every precaution has been taken in the preparation of

    this work, the authors shall have any liability to any person or entity with

    respect to any loss or damage caused or alleged to be caused directly or

    indirectly by the information contained in this manual.

  • 8/18/2019 Karel User's Manual

    5/70

    Karel User’s Manual

    Page 1 of 66

    Contents

    1  Introduction .................................................................................................................................................. 3 

    1.1  Important Information! ............................................................................................................................... 3 

    1.2  What About This Manual Is? ....................................................................................................................... 3 

    1.3  Who Wrote This Manual? .............................................................. .............................................................. 3 

    1.4  What Is Karel?.............................................................................................................................................. 3 

    1.4.1  Karel – Autonomous Robot for Enhancing Learning ............................................................................... 3 

    1.4.2  Karel, the Robot ...................................................................................................................................... 4 

    2  Karel’s Specifications .................................................................................................................................... 6 

    2.1  Hardware Specifications .............................................................................................................................. 6 

    2.1.1  Mechanical Specifications ....................................................................................................................... 6 

    2.1.2  Electrical Specifications ...................................................................................................... ..................... 6 

    2.2  Software, Financial, and Environmental Specifications ............................................................................... 7  

    2.3  Challenges.................................................................................................................................................... 7  

    2.3.1  Compulsory ............................................................................................................................................. 7 

    2.3.2  Optional ................................................................ .............................................................. ..................... 7 

    3  Karel’s Design Evolution ............................................................................................................................... 8 

    3.1  Karel’s Electronic Modules ............................................................. .............................................................. 8 

    3.1.1  Electronic Switch ..................................................................................................................................... 8 

    3.1.2  Lithium Polymer (LiPo) Charger............................................................................................................. 11 

    3.1.3  Motor Driver ......................................................................................................................................... 12 

    3.1.4  +7 V Voltage Regulator .............................................................. ............................................................ 16 

    3.1.5  12 Reflectance Sensor Array ................................................................................................................. 17 

    3.2  Karel’s Mechanical Design ............................................................. ............................................................ 20 

    3.2.1  Chassis ................................................................................................................................................... 20 

    3.2.2  Wheels................................................................................................................................................... 21 

    3.2.3  Brackets ................................................................ .............................................................. ................... 22 

    3.2.4  Motors ....................................................... .............................................................. .............................. 22 

    3.3  Karel’s Prototypes ............................................................... ............................................................... ........ 23 

    3.3.1  First Karel Prototype, Karelino .............................................................................................................. 23 

    3.3.2  Second Karel Prototype ............................................................. ............................................................ 30 

    3.3.3  Third Karel Prototype ............................................................................................................................ 33 

    4  Hardware .....................................................................................................................................................34 

    4.1  Mechanical Components ........................................................................................................................... 34 

    4.1.1  Chassis ................................................................................................................................................... 34 

    4.1.2  Wheels................................................................................................................................................... 34 

    4.1.3  Brackets ................................................................ .............................................................. ................... 35 

    4.1.4  Motors ....................................................... .............................................................. .............................. 35 

    4.2  Electronics ................................................................ ............................................................... ................... 35 

    4.2.1  Lower Board .......................................................................................................................................... 36 

    4.2.2  Upper Board .......................................................................................................................................... 41 

    4.2.3  Input / Output Peripherals ........................................................................... ......................................... 52 

    5  Manufacturing .............................................................................................................................................55 

  • 8/18/2019 Karel User's Manual

    6/70

    Karel User’s Manual 

    Page 2 of 66

    6  Programming .............................................................................................................................................. 56 

    6.1  Karel Code Writing .................................................................................................................................... 56 

    6.2  SPI Programming ....................................................................................................................................... 58 

    6.3  Debugging ................................................................................................................................................. 60 

    6.4  Fuses Programming ........................................................ .............................................................. ............. 61 

    6.5  USB Programming ..................................................................................................................................... 62 

    7  Bibliography ................................................................................................................................................ 64 

  • 8/18/2019 Karel User's Manual

    7/70

    Karel User’s Manual

    Page 3 of 66

    Introduction

    1.1 

    Important Information!

    Before you start using, or manufacturing Karel robotic platform, you must read this manual completely!

    The documentation contains information related to manufacturing, and operating the robot properly.

    In order to avoid dangerous situations all the activities related to the Karel platform have to be madeunder the supervision of a fully qualified teacher!

    The authors of this manual cannot be made responsible for any damages caused by neglecting this

    manual’ instructions, and safety instructions related to the fields involved. 

    1.2 

    What About This Manual Is?

    During the implementation of the Karel project we designed, manufactured, and tested the Karel

    robotic platform. The files necessary for manufacturing robotic platform Karel are freely available for all

    people who want to build their own Karel robots. For some people –who are experienced in field of

    electronics, and programming – is quite easy to use these files, but is not so easy for the beginners.

    That’s why we wrote this manual: to make it easier for a beginner to understand how to make, and usethe robotic platform Karel.

    This manual details both, the hardware, and the software of the Karel platform. You will find

    information about the final prototype, but also information related to the evolution of the platform, and

    the intermediary prototypes. You also can find in one place the links to the different documents

    necessary to produce and use Karel.

    1.3 

    Who Wrote This Manual?

    During the implementation of the Karel project, we decided together that this manual has to be written

    in cooperation by all partners. Unfortunately, our Turkish, and Greek partners couldn’t involve in this

    task. That is the reason that this manual is written just by Romanian, and Polish team. Anyway, thismanual include references to the works of our Turkish partners in the Karel project.

    1.4  What Is Karel?

    1.4.1  Karel – Autonomous Robot for Enhancing Learning

    The multilateral Comenius partnership Karel brought together four partners: two technical high schools

    from Poland (Technikum nr 1 im. Stanisława Staszica w Zespole Szkół Technicznych w Rybniku), and

    Turkey (Beypazari Teknik ve Endüstri Meslek Lisesi), one theoretical high school from Greece (Platon

    Schools), and a nonformal educational institution from Romania (Palatul Copiilor Drobeta Turnu

    Severin). The purpose of the Karel project was to develop curricular materials for science and

    technology learning with robots. Karel is a recursive acronym for “Karel – Autonomous Robot forEnhancing Learning”. The name of the project was proposed by the project’s initiator, Mihai Agape, and

    it is a tribute to Karel Čapek, the Czech writer who introduced the word robot.

    Karel project has been funded with support from

    the European Commission.

    This publication reflects the views only of theauthor, and the Commission cannot be heldresponsible for any use which may be made of

    the information contained therein. 

  • 8/18/2019 Karel User's Manual

    8/70

    Karel User’s Manual 

    Page 4 of 66

    The Karel project has been implemented in period 2013 – 2015. During the two years of the project we

    designed, built and tested three prototypes of Karel, an autonomous, mobile, flexible, and low-cost

    robotic platform for secondary schools. This platform it is affordable for the secondary schools and has

    better performances than the commercial available kits with similar prices. We created a platform user

    manual in order to help the people who wants to manufacture their own Karel robots. We also

    developed a curriculum for the KAREL robot. The curriculum includes lesson plans from different fields

    (physics, biology, electronics, mechanics, programming, and robotics). We also created a short roboticsdictionary.

    The Karel implementation process was interdisciplinary, challenging and promoted teamwork,

    innovation and lifelong learning. After we agreed detailed specifications for the Karel platform, we

    designed, built, and tested mechanical, and electrical parts of it. During these processes we met

    different theoretical and practical problems we had to solve. We succeed to improve the process of

    manufacturing, and assembling PCB’s in order to accommodate small footprint packages. For designing,

    and testing some electronics prototypes, we were in contact with different companies in order to clarify

    aspects related to their products (Rayson), or to receive free samples used in our prototypes (TI, Seiko).

    We created programs for Karel robotic platform using C language. Claudia Tudosie, a former student of

    the Romanian partner, and her colleague Andra Carmina Radu created, as part of their universitygraduation project, MicroBlocks, a visual programming environment for the Karel platform.

    The Karel project involved both pupils (girls, and boys ages 14 to 19), and teachers (women, and men).

    People involved in Karel project used and developed their competences in mathematics, ICT,

    technology, sciences, curriculum design, and languages. Due to the many problematic situations that

    arisen, participants developed their competence in problem solving. During the different workshops we

    organized (PCB manufacturing, assembling, and testing; Arduino, and Karel programming; using Google

    Docs), we shared our experience. So, each partner developed the competences necessary to build their

    own Karel platforms. All participants improved their English but they also learned robotics terms in

    languages of the partners.

    All partners manufactured their Karel robots and they can use it with the lessons in the curriculum we

    created. The created documentation (drawings of electronics parts, user’s manual of robotic platform,

    and curriculum) are freely available in electronic format (under different open source licenses). These

    can be useful for schools that want to start a robotics course.

    We disseminated the Karel project at local, national, and international level. We organized four

    symposiums during our project meetings, one in each partner’s country. The project was disseminated

    during two international conferences: Scientix 2 (Brussels), and TTTNet (Sofia); the participants

    considered that the project is very complex for a Comenius multilateral partnership. We also organized

    3 international robotics trophies (two in Poland, and one in Romania); students and teachers

    appreciated the features of the Karel platform.

    In the future, we can improve the Karel project in many different ways: adding new I/O devices;

    redesigning some electronics modules with easy to find electronic components; write new codes for the

    robot; developing a visual programming environment; creating new lesson plans in different STEAM

    fields. These could be done in a future Erasmus+ project.

    1.4.2  Karel, the Robot

    Karel is a low cost autonomous mobile robotic platform, designed for beginners, as well as experienced

    electronics and software developers, as an introduction to the fascinating world of robotics. The

    platform has two driving wheels, and a caster wheel. There are 2 PCB’s, the lower one also being the

    chassis of the robot. On the two PCB’s there are next electronics modules:

    Lower Board

  • 8/18/2019 Karel User's Manual

    9/70

    Karel User’s Manual

    Page 5 of 66

    o  Battery protection circuit

    o  Battery charger

    o  Line sensor array

    Upper Board

    o  Power switch

    o  +7 V voltage regulator

    +5 V voltage regulatoro  +3.3 V voltage regulator

    o  ATmega32U4 microcontroller

    o  Bluetooth module

    o  Voltage level converter 3.3 V to 5 V

    o  Motors drivers

    o  User pushbuttons

    o  User LEDs

    o  User potentiometer

    o  SPI, USB, and UART interface

    o  Connectors

    The modular structure of the PCB’s gives you the possibility to include in your Karel robot just the

    modules you are interested in. As example, if you don’t want to use the +7 V voltage regulator, you

    don’t assembly the components of this module on the PCB. This way, you can customize Karel to your

    needs.

    Karel also gives you the opportunity to add your own I/O devices. This way you can add new features to

    Karel for a lot of interesting experiments from different STEAM fields.

  • 8/18/2019 Karel User's Manual

    10/70

    Karel User’s Manual 

    Page 6 of 66

    2  Karel’s Specifications 

    Karel robotic platform was designed according to the hardware, software, financial, environmental, and

    functional specifications [1] agreed in the first project meeting, held in Beypazari.

    2.1  Hardware Specifications

    The mechanical, and electrical specifications that the Karel platform had to satisfy are listed in this

    section. We decided to have two kind of specifications: compulsory, and optional.

    2.1.1  Mechanical Specifications

    2.1.1.1  Compulsory

    Should be able to climb a surface with a 30 % slope  

    The maximum speed should be more than 0.5 m/s  

    The footprint smaller than 12 x 12 cm  

    Height less than 10 cm  

    Weight less than 250 g  

    Payload 200 g  

    Two wheels  

    Two ball caster1  x

    Two DC brushed gear motors which drive independently both wheels  

    2.1.1.2 

    Optional

    One slot for a felt pen in the centre of the robot base  

    Two incremental encoders x

    One robot gripper xOne shooter x

    2.1.2  Electrical Specifications

    2.1.2.1  Compulsory

    The battery autonomy has to be at least 2 hours (for a movement time around 15 %)  

    Operating voltage 6 – 9 V  

    Reverse voltage protection circuit  

    Digital circuits supply voltage 5 V (level shifters are used for system bus connection of

    components which use other supply voltage)

     

    MOSFET IC drivers with output continuous current at least 1.2 A  

    Microcontroller with at least 16 kB flash memory and frequency at least 8 MHz  

    Communication between controller and PC via USB  

    Two bumper sensors  

    Four user programmable pushbuttons / switches  

    Eight infrared optical sensors (ambient light, obstacle detection, line detection)  

    Four LEDs  

    1 The final prototype of the Karel robot has just one ball caster

  • 8/18/2019 Karel User's Manual

    11/70

    Karel User’s Manual

    Page 7 of 66

    One servomotor  

    2.1.2.2  Optional

    One potentiometer  

    One microphone x

    One speaker x

    One colour sensor x

    Two ultrasonic sensors x

    Two encoders x

    Wireless communication with computer using Bluetooth technology  

    TV remote receiver x

    Arduino compatible  

    2.2 

    Software, Financial, and Environmental Specifications

    The financial, environmental, and robotics challenges specifications that the Karel platforms has tosatisfy are:

    The software used for programming the robot has to be open source  

    The price of the raw materials used for robotic platform should be less than 99 EUR  

    The robot is designed for indoor use  

    The robot generates a low noise (no audible noise from a distance of 10 m)  

    2.3 

    Challenges

    In this section, the robotics challenges that the Karel platform had to be able to perform are listed.

    2.3.1 

    Compulsory

    Follows the light  

    Follows the wall  

    Follows a front moving object (when nothing is in front of it, it stops)  

    Avoids obstacles  

    Follows the line  

    Fights in sumo contest  

    Escapes from a line maze

     

    Escapes from a maze with walls  

    2.3.2  Optional

    Draws with a marker attached to the robot  

    Breaks balloons of one colour x

  • 8/18/2019 Karel User's Manual

    12/70

    Karel User’s Manual 

    Page 8 of 66

    3  Karel’s Design Evolution 

    Karel robot is complex, and we decided to start designing, manufacturing, and testing first the electronic

    modules totally new for us. After that, we designed, manufactured and tested three prototypes, one

    more complex than the previous one. In this section we will present the modules, and the three

    prototypes we designed. The last prototype will be detailed in the next section of this manual.

    3.1 

    Karel’s Electronic ModulesFirst electronic modules that we designed are: electronic switch, motor driver, battery charger, voltage

    regulator, and, line follower sensors array. These will be presented in this subsection.

    3.1.1  Electronic Switch

    The electronic switch was less complex than other modules, and it was designed by a Romanian student,

    Cristina-Maria Agape. She wrote a paper [2] that she presented in different scientific events for

    students.

    We chose next specifications for the electronic switch:

    Connect / disconnect the load from the battery

    Protect load against battery reverse polarity connection

    Maximum voltage of the battery 9 V

    Maximum load current 3 A

    We identified two possible solutions:

    A switch in series with a diode (hard version)

    An electronic switch (soft version)

    3.1.1.1  HardVersion– MechanicalSwitch,andDiode

    The simplest solution requires just two components: a mechanical switch, and a diode, connected as in

    Figure 1. 

    Figure 1 Schematic of the circuit with mechanical switch, and diode

    The battery is connected to J1 connector, and the load to J2. The S1 switch connect and disconnect the

    load from the battery. The D1 diode protect the load if the battery is connected with wrong polarity, i.e.

    the + pole of the battery connected to the ground (pin 2 of J1).

    The circuit is very simple, but it has some disadvantages:

    The components are quite big (Figure 2).

    The average power dissipated by D1 diode, P = U * I = 0,5 V * 3 A = 1,5 W, is also big

  • 8/18/2019 Karel User's Manual

    13/70

    Karel User’s Manual

    Page 9 of 66

    Copper and silkscreen – top view 3D top view

    Figure 2 Assembly design for hard switch

    In order to eliminate the disadvantages of this solution, we designed an electronic switch with MOSFET

    transistors, which will be described in next subsection.

    3.1.1.2 

    SoftVersion– ElectronicSwitch

    The electronic switch we designed (Figure 3) is based on the FDC6329L integrated load switch [3], and

    the IR6402 P-Channel MOSFET [4]. The battery is connected on J1, and the load on J2. The circuit is

    controlled with a jumper connected between the pins of J3 connector.

    The T1 transistor protects the load in case of battery reverse polarity:

    -  If the battery is connected the right way (+ to VBAT, and – to the GND), T1 is in conduction and

    the battery voltage is on the input of IC1 load switch

    -  If the battery is connected the wrong way ( – to VBAT, and + to the GND), T1 is blocked, and the

    IC1 load switch, and the load are protected.

    The on-off switch is working as follows:

    -  If the jumper is connected between pins 1, and 2 of J3 connector, the switch is on, and the load

    is powered by battery

    -  If the jumper is connected between pins 2, and 3 of J3 connector, the switch is off, and the load

    is disconnected

    Figure 3 Electronic switch schematic

    The power dissipated by the electronic switch is smaller than the power dissipated by the Schottky

    diode used in hard version of the switch. The PCBA (Printed Circuit Board Assembly) we designed (Figure

    4) for soft version of the switch also is smaller than hard version of the switch.

  • 8/18/2019 Karel User's Manual

    14/70

    Karel User’s Manual 

    Page 10 of 66

    Figure 4 Electronic switch –  Copper & Silkscreen

    Of course, we decided to use in Karel platform the electronic switch.

    3.1.1.3  ElectronicSwitchPrototype

    We manufactured our single-sided PCB using TTS (Tonner Transfer System) method. We used a

    soldering iron to solder the components on the PCB.

    3D View – Bottom 3D View - Top

    Figure 5 Electronic switch 3D views

    Our electronic switch prototype (Figure 6) looks similar as 3D views of our design (Figure 5).

    Bottom Top

    Figure 6 Electronic switch prototype

    If you want to manufacture the electronic switch presented here, you can use the documentation we

    posted on Github [5].

    3.1.1.4  ElectronicSwitchTesting

    We tested the electronic switch with a 2s LiPo battery (7.4 V) connected on J1 and a small load (tens of

    mA). We use a jumper connected on J2 to switch on / off. Our first test went so:

    1. 

    We connected the battery on J1 with reverse polarity. The switch didn’t connect the battery tothe load, i.e. success.

  • 8/18/2019 Karel User's Manual

    15/70

    Karel User’s Manual

    Page 11 of 66

    2.  We connected the battery on J1 with right polarity.

    a.  When the jumper in off position, the battery wasn’t connected to the load, i.e. another

    success.

    b.  When the jumper was in on position the battery again wasn’t connected to the load, i.e.

    a big failure.

    First conclusion after testing was that our electronic switch did nothing, load being all the time

    disconnected from the battery. We tested the functioning of T1, and it was OK. This means that the

    error was located in load switch IC1. First we checked if the components have the value in our schematic

    (Figure 7) but everything was OK.

    Figure 7 Electronic switch schematic with a design error (R2)

    After we measured the voltages in the circuit we understood that we had a big mistake in our design.

    Our first prototype didn’t function because the R2 value was wrong. I hope you are asking how this was

    possible.

    In FDC6329L, it is given next design relation: R1 / R2 = 10  – 100. Bye mistake, we used the relation R2/R1

    = 10 – 100. For R1 = 2.2 kΩ we obtained R2 = 22 – 220 kΩ, and we chose R2 = 100 kΩ, as you can see in

    Figure 7. Because R2 was around 50 times bigger than R1, IC1 switch was blocked all the time,

    regardless the position of the jumper.

    Using the right design relation, for R1 = 2.2 kΩ we obtained R2 = 22 – 220 Ω, and we chose R2 = 220 Ω. 

    We reworked our prototype, and after we replaced the wrong R2 with the right one, the electronic

    switch passed all the tests.

    You can find a detailed description of the electronic switch in [6].

    A modified version of the electronic switch was included in the last Karel design.

    3.1.2  Lithium Polymer (LiPo) Charger

    In this subsection we will describe the LiPo battery charger we designed in the first phase of Karel

    development.

    We intended to build a charger for battery on the platform, in order to not be necessary to buy an

    external charger for the battery. Because we didn’t have previous experience with LiPo battery charging,

    we decided to start with something easy. That’s why we designed first a charger for a single LiPo cell.

    We select the integrated circuit MCP73833/4, which is a stand-alone linear Li-Ion / Li-Polymer charge

    management controller, produced by Microchip Company.

    We used the typical application circuit (Figure 8), recommended in the MCP73833/4 datasheet [7].

  • 8/18/2019 Karel User's Manual

    16/70

    Karel User’s Manual 

    Page 12 of 66

    Figure 8 Single Lithium Polymer cell charger with MCP73833 schematic

    The voltage source can have a voltage between 4.5 V and 6 V, and it is connected on J1 connector. The

    LiPo cell is connected on J2 connector. Use the right polarity: connect the negative terminal of voltage

    source, and cell to the GND! The LEDs D1, D2, and D3 provides information on the state of charge. The

    R7 thermistor sense the temperature of the cell. Resistances of R1 – R6 resistor was designed according

    to recommendations given in datasheet.

    Copper & silkscreen Copper – bottom Silkscreen – bottom PCBFigure 9 PCB design for charger with MCP73833 (scale 2:1)

    We designed and manufactured a PCB of the charger (Figure 9). We didn’t assembly the components on

    the PCB, because in the meantime we decided to focus on a solution for a charger able to charge 2

    series Lithium Polymer battery (2s LiPo).

    If you want to manufacture the single cell LiPo charger presented here, you can use the documentation

    we posted on Github [8].

    3.1.3  Motor Driver

    In this subsection we will describe the single, and dual motor drivers with DRV8833 we designed,prototyped, and tested.

    For the previous robots we built we used different versions of L293, and L298 motor drivers ICs. Even

    these two IC’s are quite old, they are still widespread. Because these two drivers use as power switches

    bipolar transistors (BJT), which doesn’t have a good efficiency. That’s we decided that is time to reorient

    to the new motor drivers, which are using field effect transistors (FET), which have a better efficiency

    than the BJTs.

    We research the new motor drivers based on FETs, and finally we decided to use DRV8833 motor driver

    [9]. The circuit has a wide power supply voltage range (2.7 V to 10.8 V), and a high output current (1.5 A

    RMS). The DRV8833 IC can drive to DC brush motors, but also the outputs can be in parallel in order to

    double the output current (3 A RMS). We designed two motor drivers, which will be described in next

    subsections.

  • 8/18/2019 Karel User's Manual

    17/70

    Karel User’s Manual

    Page 13 of 66

    3.1.3.1  SingleMotorDriver

    The schematic of the single motor driver with DRV8833, which we designed, is shown in Figure 10. The

    battery is connected on J1 connector (negative terminal of battery to GND). The circuit made by T1, R1,

    and D2 protects IC1 against battery reverse connection. The DC brush motor is connected to J3

    connector. In order to control the driver we use 2 signals In1, and In2 (J2 connector). If we apply a low

    signal on nSLEEP input (J2), the circuit enters a low-power sleep mode. The nFAULT signal (J2) is an

    output that will be in driven low by IC1 whenever an overcurrent, undervoltage, or overtemperatureoccurs. This state is signalised by red LED D1.

    Figure 10 Single motor driver with DRV8833 schematic

    We design a single sided PCB (Figure 11) with two jumper wires routed on the top side. The copper top

    drawing is used just to show you where to connect the jumper wires.

    Copper bottom Copper top Silkscreen bottom Silkscreen topFigure 11 Single motor driver with DRV8833 PCB design

    During the manufacturing of the motor driver we made some mistakes, which will be described next.

    M1. Our first PCB we manufactured looked like in Figure 12. As you can see, the distance between the

    pads for IC1 is smaller than the distance between pins of IC1. We obtained this result because we had

    some wrong printer settings. Unfortunately, we produced a lot of small PCBs on the same board, and we

    cannot use any of them.

  • 8/18/2019 Karel User's Manual

    18/70

    Karel User’s Manual 

    Page 14 of 66

    M2. After we assembled the components on the good PCB, our circuit didn’t function at all. We

    succeeded to fix the problem after we discovered that the T1 transistor was placed in a wrong position

    on the PCB (Figure 13).

    M3. After we place the T1 transistor in the right position, we had a big surprise: the red LED was on,

    which meant overcurrent, undervoltage, or overtemperature. We immediately discovered the there was

    an overcurrent caused by a short circuit between output OUT1, and ground. This fault also is visible on

    the left PCBA in Figure 13. On the right PCBA everything is OK.

    Figure 12 Wrong PCBs because of scaling problems

    Finally our single motor driver prototype functioned very well. We learned that we can have problems

    even with small circuits.

    Initially we intended to use two single motor drivers on the Karel platform. Because of the lack of the

    space on the upper board of the Karel platform, we finally used one dual motor driver.

    The drawings for manufacturing the single motor driver with DRV8833 are available online [10].

    PCBA with mistakes 3D bottom view PCBA OK

    Figure 13 Mistakes on the left PCBA: transistor T1 placed wrong & short circuit between OUT1 and GND (right upper side)

    3.1.3.2  DualMotorDriver

    We designed a dual motor driver with DRV8833, which was included in the Karel robotic platform

    (Figure 14). The positive battery terminal is connected to VMM, and the negative one to the GND. One

    motor is connected between AOUT1, and AOUT2. The other motor is connected between BOUT1, and

    BOUT2. Each of the resistors R1, and R2, are in series with one of the two motors, and provide

    information related to the currents in the two motor, to the IC1. The two motors are controlled with the

    signals on inputs AIN1, AIN2, BIN1, and BIN2.

  • 8/18/2019 Karel User's Manual

    19/70

    Karel User’s Manual

    Page 15 of 66

    Figure 14 Dual motor driver with DRV8833 schematic

    We designed two PCB’s: a single sided one, and a double sided one. The first design was included in the

    first Karel platform prototype, and the second one in the last prototype. As you can see in Figure 15, for

    the single-sided PCB design we used four jumper wires.

    Copper & Silkscreens 3D view top 3D view bottom

    Figure 15 Dual motor driver with DRV8833 single sided PCB design

    During the tests of the dual motor driver we discovered a short circuit between on pin of the IC1, and

    GND. We initially supposed that the short circuit was created during the manufacturing process. When

    we check the documentation, we observed that there was a short circuit also in documentation (Figure

    16). We were surprised, because we checked we our PCB design software if there are short circuit in the

    design, and the result was negative.

    Copper bottom wrong design 3D view top Copper bottom right designFigure 16 Mistake on the left PCB (short circuit between nF signal and GND.

    Indeed, there was not a mistake in our design. The problem caused by one of the pads in the PCB, which

    had a very small aura. Because of that, the software didn’t see a short circuit. But when we printed the

  • 8/18/2019 Karel User's Manual

    20/70

    Karel User’s Manual 

    Page 16 of 66

    copper bottom, the distance from pad to rounding ground area was so small that appeared like a

    contiguous region, and that’s how a short circuit was born. 

    Finally, the dual motor driver functioned well, and it was included in the design of the Karel platform.

    If you want to build the dual motor driver on single sided PCB, use documentation [11], and if you want

    to build the dual motor driver on a double sided PCB, use documentation [12].

    3.1.4 

    +7 V Voltage Regulator

    In this subsection we will describe the +7 V voltage regulator with TPS63060 IC that we designed,

    prototyped, and tested.

    First of all, why a +7 V voltage regulator? The speed of the motor depends on the battery voltage, which

    decrease when battery discharges. In order to regulate the speed of the motor we could use encoders,

    but we didn’t chose this solution because of lack of the pins of the microcontroller. So, we decided to

    use a voltage regulator, in order to maintain motor supply voltage constant regardless battery state of

    charge. Because the nominal voltage of motors we use is 6 V, and there are voltage drops across

    switching transistors in motor driver, we decided to increase voltage at +7 V.

    The regulator input voltage is the same as the battery voltage, i.e. from 6 V to 8.4 V. Because 7 is in the

    range of input voltage, the regulator has to be able to increase and to decrease input voltage,

    depending on the value of input voltage. That is why we chose to design a switching regulator based on

    the Texas Instruments TPS63060 IC [13] , a highly efficient, single inductor, internally compensated,

    buck-boost converter, in a 10-pin, 3-mm × 3-mm WSON package.

    Figure 17 +7 V voltage regulator schematic

    The schematic of the regulator is shown in Figure 17. The power supply is applied on J1 connector, and

    the regulated voltage is available on J2 connector. We dimensioned R1, and R2 resistors for an output

    voltage of 7 V.

    Copper & Silkscreen Copper bottom Silkscreen bottom Silkscreen topFigure 18 +7 V voltage regulator PCB design

    We designed a PCB as in Figure 18. As we know, for all switching power supplies, the layout is animportant step in the design, especially at high peak currents and high switching frequencies. If the

  • 8/18/2019 Karel User's Manual

    21/70

    Karel User’s Manual

    Page 17 of 66

    layout is not carefully done, the regulator could have stability, and EMI problems. We followed the

    recommendations in the IC’s datasheet. 

    The PCB manufacturing was quite challenging because the distance between package pads is just 0.5

    mm. Because it was first time when we soldered a WSON package, we had to try more than once in

    order to solder IC1. The result can be seen in Figure 19. 

    We were very nice surprised that the voltage regulator gave us an output voltage of +7 V. We testedoutput voltage for different values of input voltage, and everything was OK. The enthusiasm decreased

    after we measured the output voltage as a function of the load current. The output voltage remain

    constant, +7 V, until the current increased to 0.3 A. From this value, the output voltage started to

    decrease as the output current increased. We consider that this behaviour is due to thermal protection

    activation activate because the copper area cannot dissipate the heat of the IC1.

    3D view bottom PCBA bottomFigure 19 +7 V voltage regulator 3D view & PCBA

    The +7 V voltage regulator was included in the final design of the Karel prototype.

    If you want to build the +7 V voltage regulator use the online documentation [14].

    3.1.5  12 Reflectance Sensor Array

    In this subsection we will describe the line sensor with 12 IR reflectance sensors that we designed, and

    manufactured. The line sensor was designed to be used in a performant line follower.

    The line sensor (Figure 20) has 12 SMD reflective optical sensors of type KTIR0711S [15]. In order to

    reduce current consumption we connected the LEDs of three sensors in series. Of course, this wouldn’t

    be a good idea if the supply voltage is 5 V, because is not large enough to power three LEDs in series.

    We do that because we had in mind that we will have a 7 V regulator on the platform, and this voltage is

    large enough to power three LEDs in series. We can control the flow of current through LEDs by C signal

    applied on the gate of T1 MOS transistor. If the voltage applied on the gate of T1 is close to the ground

    (0 V) T1 is off, so there is not current through LEDs. If no external voltage is applied on the gate or the

    applied voltage on the gate is close to the VCC (5 V) the T1 transistor is on, and there is a current which

    passes through LEDs. As you can see you can use the R17 trimmer potentiometer to modify the value of

    the current through LEDs. This is useful to adapt the LEDs lighting level to the ambient illumination. The

    line sensor is controlled by a microcontroller digital output connected to the C signal.

  • 8/18/2019 Karel User's Manual

    22/70

    Karel User’s Manual 

    Page 18 of 66

    Figure 20 12 reflective optical sensor array (line sensor)

    We also power the line sensor with VCC voltage (5 V) which supplies the output circuits (phototransistor

    in series with a resistor). We use VCC in order to have an output voltage range from 0 V to 5 V, compatible

    with the voltage range of microcontroller analogic inputs. The information from sensors is available as a

    0 – 5 V variable voltage on A0 – A11 outputs. The A0 – A11 outputs of the line sensor has to be connected

    to the 12 analogic inputs of microcontroller.

    The output voltage of each sensor (A0 – A11) depends on the reflectivity of the surface under the sensors:

    If the surface is black is large the amount of reflected light is small, the phototransistor resistance

    is high, and the sensor output voltage is close to the power supply voltage, VCC;

    -  If the surface is white, the amount of reflected light is high, the resistance of the phototransistor

    is small, and the sensor output voltage is close to the GND.

    The sensor output voltage is inversely proportional to the value of the surface reflectivity coefficient. The

    output voltage of each sensor (A0 – A11) also depends on many other factors as the distance between

    sensor and surface, angle between surface and the sensors plan, and ambient illumination.

    Figure 21 Line sensor behaviour simulation

  • 8/18/2019 Karel User's Manual

    23/70

    Karel User’s Manual

    Page 19 of 66

    We use some Excel sheets (Figure 21) in order to simulate the behaviour of the line sensor for different

    relative positions of the sensors positions on the PCB. This help us to decide how to position the optical

    sensors on the PCB.

    We designed a single side PCB and used THD resistors in order to reduce the number of the jumper

    wires used. You can see the 3D views and PCBAs of the line sensor in Figure 22. 

    There are a lot of sensors on the board. Next question is: how to compute the error? The error is thedifference between the desired (reference) value and the actual (measured) one. If we consider that the

    positions of the 12 sensors are -11, -9… -1, 1… 9, 11, and S1, S2… S12 are the values of sensors A0, A1…

    A12 (read by microcontroller) we can compute the error using weighted mean ( 1 ). 

    ( 1 )

    When we tested the line sensor, we discovered that 10 sensors have a similar behaviour, but two of

    them provide different values of output voltage. This was due the fact that those two sensors were not

    parallel with PCB.

    If you want to manufacture the line sensor presented here, you can use the documentation we posted

    on Github [16].

    Figure 22 Line sensors –  3D views and PCBAs

  • 8/18/2019 Karel User's Manual

    24/70

    Karel User’s Manual 

    Page 20 of 66

    3.2 

    Karel’s Mechanical Design 

    In this section we will discuss about mechanical components of the Karel platform. The Turkish team

    was in charge of the mechanical parts of Karel.

    3.2.1  Chassis

    For the first Karel prototype, Turkish team designed, and built two chassis, as you can see in Figure 23. 

    The both chassis were made of plastic. The chassis were presented in first Rybnik project meeting. None

    of the two prototypes manufactured by Turkish team didn’t satisfy the specifications, being too large. 

    Figure 23 Chassis designed by Turkish team

    You can watch a video which presents the manufacturing process of the two bases [17]. As we can see in

    the movie the process is quite complex.

    Because the design of the prototype was delayed by Turkish team, Romanian team designed and

    manufactured two chassis (Figure 24). These chassis are made from plastic and are very easy to

    manufacture. The hexagonal shape didn’t satisfy the specification related to climbing a 30% ramp.

    Figure 24 Chassis designed by Cristina-Maria Agape

    During the first project meeting in Katerini we integrate the mechanical, and electronical parts, and we

    had to choose between these four designs presented. Finally we chose one of the designs proposed by

    the Romanian team, because was the only one which satisfied all the requirements for the chassis. More

    than that, we decided that the chassis will be one of the PCB of the robotic platform. In this way, the

    chassis is accommodating not just the mechanical parts of the robot, but also some of the electrical

    subsystems of the robot.

  • 8/18/2019 Karel User's Manual

    25/70

    Karel User’s Manual

    Page 21 of 66

    3.2.2  Wheels

    We tried to manufacture different type of wheels. Turkish team, which was in charge of the mechanical

    system designed and manufactured the wheel in Figure 24. The wheel had the right dimension without

    tire. But if we add a tire, the wheel would became too large. Romanian team proposed a wheel they

    designed before start of Karel project, and it was produced by a 3D printer. The wheel had the right

    dimensions but we didn’t have a tire for it. 

    Figure 25 Wheel designed and manufactured by Turkish team Figure 26 Wheel designed by Romanian

    team and 3D printed

    Romanian team manufactured a silicon tire (Figure 28) for the aluminium wheel (Figure 27) produced by

    Solarbotics [18]. The silicon tire we manufactured has a high traction.

    Figure 27 Aluminium wheel manufactured by Solarbotics Figure 28 Silicon tire manufactured by

    Romanian team

    We manufactured the tires form silicon, using some iron moulds Figure 29. 

    Figure 29 Moulding silicon tires

  • 8/18/2019 Karel User's Manual

    26/70

    Karel User’s Manual 

    Page 22 of 66

    3.2.3  Brackets

    Turkish team designed a bracket to fix the motor on the chassis (Figure 30). Unfortunately, the bracket

    didn’t fit with Karel lower board design. This is why we decided to use the plastic mounting brackets,

    produced by Pololu Corporation, for mounting the micro gear motor motors on the lower board.

    Figure 30 Brackets designed and manufactured by Turkish team

    3.2.4  Motors

    We decided to choose some geared micro motors produced by Pololu company [19]. In order to satisfy

    the power needs we chose an HP (high-power) motor. In order to satisfy the speed requirement we

    tested next motors: 30:1 HP, 50:1 HP, and 100:1 HP. Finally we choose the 50:1 HP dual shaft motor

    (Figure 31) as it can satisfy both requirements related to power and speed [20]. Because of the extended

    output shaft that protrudes from the rear of the motor it is possible to add and encoder to provide

    motor speed.

    Figure 31 50:1 HP dual shaft gear motor

    The motor has next parameters:

    -  Size: 10 × 12 × 26 mm -  Weight: 9.5 g

    -  Shaft diameter: 3 mm2

    -  Gear ratio: 51.45:1

    Free-run speed @ 6V: 630 rpm

    Free-run current @ 6V: 120 mA

    Stall current @ 6V: 1600 mA

    Stall torque @ 6V: 1.08 kg cm

  • 8/18/2019 Karel User's Manual

    27/70

    Karel User’s Manual

    Page 23 of 66

    3.3 

    Karel’s Prototypes 

    3.3.1  First Karel Prototype, Karelino

    First prototype we designed was less complex than we initially proposed. We decided to do it so

    because we didn’t find solutions for some systems, as management system for Lithium Polymer battery,

    and +7 V voltage regulator. We found a TI solution for LiPo balancing, but in short time the IC became

    obsolete. For +7 V / 1.2 A buck boost voltage regulator we didn’t find a solution at that time. 

    Because we were behind the schedule, in order to advance, we decided to give up some features, and

    create a simpler prototype, Karelino. Cristina-Maria Agape named this prototype Karelino from two

    reasons: Karelino suggests a small Karel, and also it suggests association with Arduino platform. As you

    already know, Karelino uses ATmega32U4 microcontroller, the same microcontroller used in Leonardo

    Arduino platform.

    3.3.1.1  KarelinoSchematic

     

    Figure 32 Karelino schematic

  • 8/18/2019 Karel User's Manual

    28/70

    Karel User’s Manual 

    Page 24 of 66

    As you can see in Figure 32, Karelino consists of next modules:

    o  +5 V voltage regulator

    o  +3.3 V voltage regulator

    o  ATmega32U4 microcontroller

    o  Bluetooth module BTM-112

    o  Voltage level converter 3.3 V to 5 V

    Motor driver

    o  User pushbuttons (3)

    o  User LEDs (3)

    o  SPI and USB interface

    o  Connectors

    One of requirements for Karelino was to have all the 12 analog inputs available for the user. So, Karelino

    could be used with the 12 reflective optical sensor array we designed and manufactured. The

    microcontroller pins were allocated as follows:

    Drive the transistor which control the current through emitters (1): PE6

    Phototransistor reading (12): PF7 –PF4 (A0 –A3), PF –PF0 (A4 –-A5), PD4 (A6), PD6 (A7), PD7 (A8),

    and PB4 –PB6 (A9 –A11)

    Motors Drivers Control (4):

    o  Motor 1 (pin 12 – OC0A = AIN2, pin 18 – OC0B = AIN1)

    o  Motor 2 (pin 31 – OC3A = BIN2, pin 32 – OC4A = BIN1)

    Pushbuttons (3): PB1 – PB3 (SPI pins)

    LEDs (3): PB0, PD1, and PD5

    Bluetooth Communication (2): RX and TX

    We don’t describe the operation of Karelino because all the modules are included in the final prototype,

    and will be described in the “Hardware” chapter of this manual. 

    3.3.1.2  KarelinoPCBDesign

    In order to be easier to manufacture the Karelino PCB, we decided to use a single sided PCB laminate (at

    that time we didn’t have experience with double sided PCBs). The copper bottom layer of the PCB is

    shown in Figure 33. 

    Figure 33 Karelino PCB –  copper bottom layer

  • 8/18/2019 Karel User's Manual

    29/70

    Karel User’s Manual

    Page 25 of 66

    We used both types of components, SMD and THD. Using THD components we succeed to reduce the

    number of jumper wires used for routing some connections. For components assembly on the PCB use

    the drawings in Figure 34. 

    Figure 34 Karelino PCB –  bottom & top silkscreen

    The 3D views of the PCBA are shown in Figure 35. 

    Figure 35 Karelino PCBA—top & bottom 3D views

    3.3.1.3  KarelinoPCBManufacturing

    In this subsection we will describe the method and materials for manufacturing PCB, and assembly

    PCBA.

    We manufactured PCBs using the Transfer Tonner System (TTS) method. Romanian team uses this

    method since 11 years ago, and is quite experienced in this field. The challenge was given by the large

    size of the board, and the small size of some components.

    We use for PCBs manufacturing the materials in Pulsar kit “PCB Fab in A Box”. Detailed information

    related to this kit and to the TTS method are available online on the manufacturer website [21].

    Next, we will present on short the steps of manufacturing PCBs, based on the presentation delivered by

    Cristina-Maria Agape during the first Rybnik project meeting [22]. Some images taken during the

    manufacturing of Karelino PCB by Romanian team are presented in Figure 36. 

    Karelino PCB manufacturing in 10 easy steps:

    1. 

    Print the copper layer on paper using a laser printer.

    2. 

    Prepare the single sided board using a sandpaper.3.  Clean the surface with a cloth. Do not touch the surface once the cleaning is done!

  • 8/18/2019 Karel User's Manual

    30/70

    Karel User’s Manual 

    Page 26 of 66

    Figure 36 Karelino PCB Manufacturing

    4. 

    Use a laminator to transfer the toner from paper to the board.

    5. 

    Remove the paper from the board using water. The copper layer is transferred to the board.

    6. 

    Use green foil to seal the toner.

    7. 

    Remove easily the green foil.

    8. 

    Etch the board using ammonium persulfate. The uncovered copper was removed.9.

     

    Remove the toner from the board using thinner.

    10. 

    Drill the holes.

  • 8/18/2019 Karel User's Manual

    31/70

    Karel User’s Manual

    Page 27 of 66

    3.3.1.4  KarelinoPCBAAssembling&Testing

    Once the PCB is ready, it is the time to assemble the components on the Karelino PCB (Figure 37).

    It is a very good practice to test the PCB traces for continuity and short circuits using a multimeter

    because the fixing of a PCBA it is very hard if there are errors in the PCB. As you can see in the  Figure 37, 

    we forgot to check the PCB before starting components assembly. We remembered to do it after the

    microcontroller was already soldered on the board. During the PCB traces test, Veli (Velibor

    Mladenovici) discovered some short circuits caused by a PCB design mistake: the distance between two

    traces was so small in the PCB design that on the real board the traces touched each other. We

    continued our work after we removed the short circuits.

    We used a soldering iron station to solder the components. The soldering station has a hot air gun, and

    a soldering iron. We soldered most of the components using the soldering iron. The motor driver IC was

    the only one we soldered on the board using the hot air gun.

    We first soldered the jumper wires on the board. Next, we added the electronic components and we

    soldered them (SMD first & THD last). Because some SMD components are real small (e.g. 0.5 mm x 1

    mm), a magnifier is very helpful.

    Figure 37 Karelino PCBA Assembling

    Of course we did some mistakes during the Karelino design and assembly. There was 2 types of

    mistakes: design mistakes, and manufacturing mistakes. We already told you about the short circuits

    between traces, caused by a design mistake. Next we describe other problems we met during the

    Karelino manufacturing.

    One short circuit between two traces (caused by etching) was not discovered during the PCB traces test.

    It was a really challenge to discover this short circuit after we assembled all the components on the

    board. The fixing process was also hard because we knew that the board was checked and there are not

    short circuits between traces.

    We had a problem with USB connector assembly, because it was not placed near the edge of the board,

    and we couldn’t insert the USB plug. The problem was solved by cutting a small part of the board in the

  • 8/18/2019 Karel User's Manual

    32/70

    Karel User’s Manual 

    Page 28 of 66

    front of the USB connector (Figure 38). Unfortunately, on the removed board part were routed two

    traces. We used jumper wires to make missing connections.

    We made also some mistakes during the components assembly, when we placed some SMD

    components in the wrong positions. In order to understand that sometimes can be difficult to find the

    problem, we challenge you to test your attention to detail: identify the two resistors placed wrong on

    the PCB in Figure 38. Use as reference the PCB drawings available online at http://1drv.ms/1jet3ci.

    Figure 38 Karelino first prototype errors: USB and some components wrong placed

    We finally identified and fixed all the mistakes related to PCBA and most of the blocks (voltage

    regulators, microcontroller, and driver motor) functioned well. The last problem was related to the

    wireless communication.

    The problem related to the Bluetooth module took us a lot of time to solve it. We initially used theRayson BTM-110 Bluetooth module for wireless communication between platform and laptop. We

    chose it because it is cheap and we can procure it. We tested but it didn’t function at all and we didn’t

    find any explanation for this in the datasheet. We decided to contact the producer, who explained us

    that the BTM-110 is not programmed in the factory (for us is hard to understand why this information is

    not written in the datasheet). After that we replaced BTM-110 with BTM-112, tested and it functioned

    very well. In the final design we chose BTM-182, which is similar to BTM-112, but includes also an

    antenna on the board.

    After we solved the last problem related to the Bluetooth module, first Karelino prototype (Figure 39) 

    functioned according the specifications.

    If you want to manufacture the Karelino controller presented here, you can use the documentation we

    posted on Github [23].

  • 8/18/2019 Karel User's Manual

    33/70

    Karel User’s Manual

    Page 29 of 66

    Figure 39 Karelino prototype (top & bottom sides)

    3.3.1.5 

    Karelinoplatform

    The prototype of the Karelino platform (Figure 40) was assembled, and tested during the first Rybnikproject meeting. The Karelino controller, motors, and wheels were assembled on one of the chassis

    manufactured by Romanian team. We didn’t use one of the chassis manufactured by the Turkish team

    because they didn’t fit specifications, being too large. We didn’t integrate the peripherals, which were

    the task of the Polish team, because weren’t ready at that moment.

    After successful testing of the first Karelino platform prototype during the first Rybnik project meeting,

    we proposed next improvements:

    Integrate new blocks (e.g. Motor voltage regulator, UART connector, Battery management

    system)

    Make changes to the initial design (e.g. replace USB micro B connector with an USB mini Bconnector)

    Redesign the PCB (components places and traces) according to the chassis shape

    Add LEDs to show the state of Bluetooth module

    -  Figure 40 Karelino platform prototype

    As you can see next, all of these were included in the second prototype of the Karel platform.

  • 8/18/2019 Karel User's Manual

    34/70

    Karel User’s Manual 

    Page 30 of 66

    3.3.2  Second Karel Prototype

    In this subsection we will present on short the design of the second prototype.

    3.3.2.1  SecondKarelPrototypeDesign

    The Karel second prototype was designed with some new requirements:

    1.  Use two PCBs (lower board, and upper board), the lower board also being the chassis of the

    robot.2.

     

    Implement all the improvements proposed during the first Rybnik project meeting.

    3. 

    Use single sided PCB laminate for lower board, and double sided PCB laminate for upper board.

    The dimensions of the lower board are showed in Figure 41. 

    Figure 41 Second Karel prototype –  lower board dimensions

    In the second designed the software for the PCB design played an important role, as you will see later.

    Let’s say just that we used Target3001! Light version, which is limited at 400 pins / pads for each design.

    Figure 42 Second Karel prototype lower board –  top & bottom 3D views

  • 8/18/2019 Karel User's Manual

    35/70

    Karel User’s Manual

    Page 31 of 66

    On the lower board of the second Karel prototype (Figure 42) we have two electronic modules: the

    battery protection circuit, and the battery charger.

    We were surprised when we tried to save our design of lower board, and we the software displayed the

    next message “The limitation of this version is exceeded” (Figure 43).

    Figure 43 Reaching the limitations of the PCB design software Target3001! Light version

    The images in Figure 42, and Figure 43 are print screens, but we couldn’t generate the files for

    manufacturing lower board of the second Karel prototype. We continue our work after we bought theSmart version of the Target3001! Software, whose limitation is higher, 700 pins / pads per PCB.

    After the lower board unsuccessful design we focused on the upper board, which contains next

    electronic modules: controller, voltage regulators (5 V, 3.3 V, and 7 V), I/O devices (four pushbuttons,

    one trimmer potentiometer, and four LEDs), and motor driver (Figure 44).

    Figure 44 Second Karel prototype upper board –  top & bottom 3D views

    We succeeded to finish the design but what electronic module do you think is missing from it? If you

    answer the power switch than you are right. But could you guess why? If you answer the limitations of

    the Target3001! Light version you are right again. As you can see in Figure 45 we were very close to thePCB software limitation without including the power switch. This is why we decided to not include the

    power switch on the upper board of the second Karel prototype.

  • 8/18/2019 Karel User's Manual

    36/70

    Karel User’s Manual 

    Page 32 of 66

    Figure 45 Second Karel prototype upper board design –  very close to the limitations

    3.3.2.2  SecondKarelPrototypeManufacturing

    We manufactured the PCB for the upper board after we made some changes in our manufacturing

    process, in order to increase the quality of the PCBs. We changed our old Samsung printer (600 dpi

    resolution) with a new HP printer (1200 dpi resolution. Even the HP printer had better resolution wasalso quite old, and we had some problems with the drivers for Windows 7, but we succeeded to solve it.

    After some trials we succeeded to have a good alignment between top and bottom sides of the board

    (Figure 46).

    Figure 46 Second Karel prototype lower board PCB

    The second Karel prototype was presented during the Katerini project meeting [24].

    The conclusions for the second prototypes were:

    -  Some circuits (e.g. battery management) were not tested

    -  Some integrated circuits are not so easy to procure (e.g. the ones made by Seiko)

    -  Possible new changes in the design to use new integrated circuits (e.g. boost regulator

    supplied from one LiPo cell with high output current capabilities).

    If you want to manufacture Karel we recommend the last design of the platform.

  • 8/18/2019 Karel User's Manual

    37/70

    Karel User’s Manual

    Page 33 of 66

    3.3.3  Third Karel Prototype

    The third and the last prototype of the Karel robot will be described in detail in the “Hardware” section

    of this manual. Here we present just the changes we made from the second prototype, and show you

    how it looks. We redesigned both Karel boards after we bought the Smart version of the Target3001!

    PCB design software.

    3.3.3.1  LastKarelPrototype– LowerBoard

    Because there was some free space on the front of the previous version of the lower board, we decided

    to add four reflective optical sensors to be used as line sensor. You can see the lower board PCBA in

    Figure 47. The lower board passed all the tests.

    Figure 47 Last Karel prototype lower board

    You can find more information related to lower board in the presentations used during two workshops

    organized in second Rybnik project meeting, related to the designing, manufacturing, and testing of the

    lower board [25], [26].

    The documentation for manufacturing the last prototype of Karel lower board is posted on Github [27].

    3.3.3.2  LastKarelPrototype– UpperBoard

    In the last upper board prototype we added an electronic power switch based on a previous design of

    Cristina-Maria Agape [2]. You can see the upper board PCBA in Figure 48. The upper board passed all the

    tests.

    Figure 48 Last Karel prototype upper board

    You can find more information related to the upper board in the presentations used during two

    workshops organized in second Rybnik project meeting, related to the designing, testing, and

    programming the lower board [28], [29].

    The documentation for manufacturing the last prototype of Karel upper board is posted on Github [30].

  • 8/18/2019 Karel User's Manual

    38/70

    Karel User’s Manual 

    Page 34 of 66

    HardwareIn this section we will present the mechanical parts (chassis, wheels, brackets, motors), and the

    electronics (lower and upper boards) of the Karel platform.

    4.1  Mechanical Components

    In this subsection we will present mechanical components of the Karel platform.

    4.1.1 

    Chassis

    The chassis of the final prototype of the Karel robotic platform is the one of the two PCBs of the

    platform (the lower one). This way, the chassis (Figure 49) accommodates the mechanical parts of the

    robot, and some of the electrical subsystems of the robot.

    Figure 49 The chassis of the Karel platform is the lower board

    4.1.2  Wheels

    We decided to use wheels with circumference around 10 cm, which means that if the robot goes

    straight, the wheels has to turn 10 times in order to advance 1 m. From this condition results the

    diameter of the wheel with tire:

    =10

      ≅ 3.2  

    ( 2 )

    Because the diameter of the wheel produced by Turkish partner is larger than 32 mm, we chose a wheel

    (Figure 50) produced by Pololu, which has silicone tire, a diameter of 32 mm and fits with the motor we

    use.

    Figure 50 Wheel used in the Karel platform

  • 8/18/2019 Karel User's Manual

    39/70

    Karel User’s Manual

    Page 35 of 66

    As third wheel we also chose the Pololu ball caster with 9.5 mm ball (Figure 51). There are two different

    versions: with plastic ball [31] or with metal ball [32]. You can choose the one is better for you.

    Figure 51 Ball casters with 9.5 mm plastic ball (left) and metal ball (right)

    4.1.3  Brackets

    Because the mounting holes of the brackets designed by Turkish team didn’t matched the holes on the

    chassis (lower board) we use Pololu brackets (Figure 52) to fix the motors on the chassis.

    Figure 52 Pololu brackets used to mount the motors

    4.1.4  Motors

    Karel platform uses 2 micro gear motors. In order to satisfy the specifications related to speed and torque,

    we chose an HP 50:1 gear motor with extended shaft.

    The parameters of the motor are:

    Free-run speed @ 6V: 630 rpm- 

    Gear ratio: 51.45:1

    Free-run current @ 6V: 120 mA

    -  Stall current @ 6V: 1600 mA

    -  Stall torque @ 6V: 15 kg x cm

    With these two motors the speed of the robot on a horizontal surface is higher than 0.5 m/s, and the

    robot can climb a 30% ramp.

    The motors are mounted on the chassis with Pololu brackets.

    4.2 

    ElectronicsThe last prototype of Karel platform has two PCBAs which we will detail in this subsection.

  • 8/18/2019 Karel User's Manual

    40/70

    Karel User’s Manual 

    Page 36 of 66

    4.2.1  Lower Board

    In this subsection we will describe the lower board of the Karel robotic platform. As you can see in

    Figure 53, the board has next electronic modules: battery protection circuit, battery charger, and line

    sensor.

    Figure 53 Karel lower board –  bottom view

    Figure 54 Karel low board –  top view

  • 8/18/2019 Karel User's Manual

    41/70

    Karel User’s Manual

    Page 37 of 66

    The lower board is also the chassis of the robot. The battery, the motors, and the ball caster are mounted

    on the low board (Figure 54).

    The documentation for manufacturing lower board was created by Mihai Agape, and is available in “Karel

    Lower Board” Github repository [27].

    4.2.1.1  Battery

    Robotic platform Karel is powered by a 2 LiPo battery (Lithium Polymer battery consisting of 2 cells inseries) with next parameters:

    -  Nominal voltage, U = 7.4 V

    Maximum discharge current, Imax = 15 A

    -  Electrical capacity, C = 850 mAh

    - Figure 55 Karel Lithium Polymer battery

    The LiPo battery (Figure 55) has two connectors: one for charging, and discharging the battery; one for

    monitoring, and balancing the battery. The voltage supplied by the battery changes during the operation

    from 8.4 V (when the battery is fully charged) to 6 V (when the battery is fully discharged).

    A battery protection circuit protects the battery in case of overvoltage, overcurrent, overtemperature,

    and balance the two LiPo cells. The battery protection circuit also limits the current supplied by battery at

    4 A, and disconnects the battery if the voltage across the battery is less than 6 V.

    The using of Lithium Polymer (LiPo) batteries could be dangerous, and you must follow all the safety

    precautions related to the LiPo batteries using. It is out of the scope of this manual to present all the safety

    rules for using LiPo batteries.

    4.2.1.2  BatteryChargerCircuit

    The battery charger circuit is based on BQ24103RHLR IC manufactured by Texas Instruments, as you can

    see in the schematic of circuit (Figure 56). The BQ24103RHLR [33] is a highly integrated switch mode

    charger for 1s (single cell) or 2s (2 cells in series) LiPo battery.

    A 12 V / 0.5 A DC voltage source, connected on J6 DC jack, supplies the battery charger circuit. You can

    use a wall adapter whose output voltage is 12 V, and output current is higher than 0.5 A. The B1 diode

    bridge “rectifies” the supply voltage applied at the input of the charger. We added B1 in order to prevent

    the destruction of the charger if we use a voltage source with wrong polarity. After the B1 rectifier bridge,

    the voltage has good polarity, regardless the polarity of voltage applied to the input.

  • 8/18/2019 Karel User's Manual

    42/70

    Karel User’s Manual 

    Page 38 of 66

    Figure 56 Battery charger schematic

    The 2s LiPo battery that has to be charged must be connected between P+ and Cha- terminals. The battery

    charging has three phases, shown in Figure 57. 

    4.2.1.2.1 

    Precharge PhaseIf the battery voltage is below the short circuit voltage  (around 4 V), the battery is charged with a

    constant current of 35 – 60 mA. This is named the precharge phase (or battery preconditioning) and is

    useful for deeply discharged cells. If the voltage is higher than the   threshold, the charging is

    charged with a constant current, named precharge current. The precharge current is the same as the

    termination current, therefore these are renamed as precharge-termination current. The R33 resistor

    connected on ISET2 pin sets the precharge-termination current, which is computed with next formulae:

    ×   ( 3 )

    where   is the precharge-termination current, = 1000 /,   =   = 10 Ω,

    = 100  and = = 100 Ω.

    For given values, it results = 100 .

    If   =   = 4,7 Ω and = = 200 Ω results = 106 .

    4.2.1.2.2  Current Regulation Phase

    Current regulation phase starts if the voltage across battery is higher than the  threshold, which is

    around 71 % of the regulation (termination) voltage   = 8,4 . This means that = 71 % ∗

    8,4 = 6.

    The value of regulation current is computed with next formulae:

    ×   ( 4 )

    where   is the regulation current, = 1000 /, = 1 ,   =   = 10 Ω and

    = = 100 Ω.

    For given values, it results = 1 .

    For   =   = 10 Ω and = = 200 Ω it results = 500 .

    Regulation current phase ends if the voltage across the battery is higher than the regulation voltage

    threshold   = 8,4 .

  • 8/18/2019 Karel User's Manual

    43/70

    Karel User’s Manual

    Page 39 of 66

    4.2.1.2.3  Voltage Regulation Phase

    The voltage regulation phase starts when the voltage across the battery equals the regulation voltage

      = 8,4 . The charging current decrease, and the battery voltage is constant.

    The charging is finished when the charging current decrease below the precharge-termination current

    threshold .

    Figure 57 Typical charge profile

    4.2.1.2.4 

    Charge Status

    The D3, D4, and D5 LEDs indicate various charger operations.

    The D3 LED (red) is on if a power supply with the correct value is connected on the input of the charger.

    The D4 (green), and D5 (yellow) LEDs give information related to the charge status, according to Table 1. 

    Charge state D5 (yellow) D4 (green)

    Charge-in-progress ON OFFON OFF

    Charge completeOFF ON

    Charge suspend, timer fault, overvoltage, sleep mode, battery

    absentOFF OFF

    Table 1 Chare status indicated by D4 and D5 LEDs

    4.2.1.3  BatteryProtectionCircuit

    First, I remind you that the using of Lithium Polymer (LiPo) batteries could be dangerous, and you have to

    follow all the safety precautions related to the LiPo batteries using.

    The battery protection circuit (Figure 58) assure the battery operation in safety zone. The two S-8290A

    Seiko ICs, protect the battery against overcharge, overdischarge, and balance the two cells. The S-8239A

    Seiko IC protect the battery against overcurrent.

  • 8/18/2019 Karel User's Manual

    44/70

    Karel User’s Manual 

    Page 40 of 66

    LiPo batteries have two connectors: one for charging, and discharging the battery; one for monitoring,

    and balancing your battery. The 2s LiPo battery charging – discharging connector is connected on J2. The

    connector for monitoring and balancing is connected on J1.

    The load supplied by the battery is connected between P+, and Dis-. The battery is connected to the load

    if the T5 MOSFET transistor conducts. If T5 is blocked, the battery and the load are disconnected.

    The power supply for charging the battery has to be connected between P+ și Cha-. The battery isconnected to the charging power supply if both MOSFET transistors T5 and T6 conduct. If one of the

    transistors T5 and T6 is blocked, the battery and the charging power supply are disconnected.

    The T5 transistor is controlled by T3 BJT transistor, which is controlled by IC1, IC2, and IC3.

    The T6 transistor is controlled by T4 BJT transistor, which is controlled by IC1, and IC2.

    The voltage across each battery cell is measured by the corresponding S-8209 [34] circuit. So, the IC1 and

    IC2 can protect the two cells if they detect cells overcharge or overdischarge conditions. In these two

    cases, the T3 and T4 transistors are blocked, and also the T5, and T6 transistors are blocked (due of the

    resistors connected between source and gate of each transistor). So, the battery is disconnected from

    both source, and load. IC1, and IC2 balance the two cells via T1, and T2 transistors they control. The cell

    balance starts when the cell voltage is higher than a specific voltage threshold, and is made by discharging

    the cell with a certain current. The current flows through the series circuit of the T1 (T2) transistor, and of

    the resistor R27 || R3 (R28 || R6). For the component values in Figure 58, it results R27 || R3 = 200 Ω / 2

    = 100 Ω, and the balancing current is 40 mA = 4V / 100 Ω. 

    Figure 58 Battery protection circuit schematic

    The S-8239A [35] IC protects the battery against the overcurrent. The current through battery is measured

    with parallel resistors R17 – R20. The current threshold which activates overcurrent protection is 100 mV

    / 25 mΩ = 4A. When the voltage across R17 – R20 resistors is 100 mV, the IC3 blocks the T5 transistor, andthis way, the battery is isolated from both source, and load.

  • 8/18/2019 Karel User's Manual

    45/70

    Karel User’s Manual

    Page 41 of 66

    4.2.1.4  LineSensor

    The second prototype of the Karel platform, didn’t contain a line sensor on the lower board. This was

    added on the last prototype, because there was some free space on the board.

    The line sensor (Figure 59) has four reflective optical sensors KTIR0711S [15]. The LEDs of two sensors

    are connected in series, in order to reduce the current consumed.

    The power for the line sensor is supplied between VCC and GND. The output signal A0 – A3 aretransmitted to the microcontroller through 4 wires cable.

    The output voltage of each sensor (A0 – A3) depends on the reflectivity of the surface under the sensors:

    -  If the surface is black, the amount of reflected light is small, the phototransistor resistance is high,

    and the sensor output voltage is close to the power supply voltage, VCC;

    -  If the surface is white, the amount of reflected light is high, the resistance of the phototransistor

    is small, and the sensor output voltage is close to the GND.

    The sensor output voltage is inversely proportional to the value of the surface reflectivity coefficient.

    Figure 59 Line sensor schematic

    4.2.2  Upper Board

    In this subsection we will describe the upper board of the robotic platform Karel. As you can see in Figure

    60, the upper board contains next electronic modules:

    -  Electronic switch.

    -  +5 V voltage regulator with LM2940CS to power the microcontroller and other digital circuits.

    +3.3 V voltage regulator with LM1117IMP to power the Bluetooth, and other digital circuits that

    operate on this voltage.

    -  +7 V voltage regulator with TPS63060 to provide a regulated voltage to the motors.

    ATmega 32U4 microcontroller, the brain of the Karel platform.

    Bluetooth BTM-182 module for communication between microcontroller, and laptop.

    Level shifter circuit between 3.3 V and 5 V to allow the communication between Bluetoothmodule (powered at 3.3 V) and the microcontroller (powered at 5 V).

    Motor driver with DRV8833PWP.

  • 8/18/2019 Karel User's Manual

    46/70

    Karel User’s Manual 

    Page 42 of 66

    The upper board is powered through JST connector with the voltage across the output of the battery

    protection circuit.

    Figure 60 Karel upper board –  bottom view

    As you can see in Figure 61, the user has easy access to the next components placed on the top side of

    the upper board:

    The electronic power switch switches power on and off, and is controlled by a micro-switch. A

    SMD LED (power LED) on the board is on when the board is powered.

    -  The +3.3 V, +5 V, and +7 V voltages are available on certain 2 pins connectors placed near the

    edge of the board. For all the connectors, the GND pin is placed to the outside, and the positive

    pin is placed to the inside.

    -  On board +7 V voltage regulator could be used if you power it by connecting a jumper between

    dedicated pins placed on left down side of the board (“Jumper to Supply the +7 V Voltage

    Regulator”). 

    -  Motor driver can be powered with the battery unregulated voltage, or with +7 V regulated

    voltage. The selection of one of the two voltages is made by connecting a jumper on proper pins(“Pins for Motor Power Supply Selection”). If the motors are supplied with regulated voltage, the

    motors behave the same way, regardless the battery charge state.

    The two motor drivers are controlled by four PWM outputs of the microcontroller. If there is a

    problem related to driver functioning (e.g. output short circuit) a SMD led indicate this (“Motor

    Driver State LED”). The motors are connected to the driver through pin connectors.

    16 pins of the microcontroller named A0  –  A11, and D12  – D15 are available to user. As you

    already, guessed the A0 – A11 are connected to the 12 analogic inputs of the microcontroller. D12

     – D15 are digital I/O.

    -  The reset button resets your microcontroller if it is pushed.

    The ISP programming connector allows microcontroller’s programming with a programmer (e.g.AVRISP MKII).

  • 8/18/2019 Karel User's Manual

    47/70

    Karel User’s Manual

    Page 43 of 66

    -  The mini USB connector is used to program the microcontroller without using a programmer,

    which is possible if the right bootloader is loaded in the microcontroller memory. If you want to

    enter programming mode, you have to release the left pushbutton in the four pushbuttons line

    (“Hardware Bootloader Pushbutton) after the reset of the microcontroller. 

    Figure 61 Karel upper board –  top view

    The trimmer potentiometer is power across the end terminals with +5V, and GND. On the wiper

    there is a variable voltage in range of 0  – 5 V, which can be applied to the A0 analogic input

    through a jumper.

    -  Four THD LEDs (red, yellow, green, and blue) are available to the user. Each of them can be

    connected through a jumper to one of the D12 – D15 pins.

    -  Four pushbuttons available to the user are connected to the HWB, MISO, MOSI, and SCK pins of

    the microcontroller, which are also used for entering the USB programming mode or

    microcontroller programming via ISP.

    -  The Bluetooth module provide wireless communication between microcontroller between

    microcontroller and other device (e.g. laptop). The Bluetooth module communicates with the

    microcontroller via UART interface. The signals RX, and TX are adapted between +5 V, and +3.3 Vwith a level shifter converter. For Bluetooth communication, we have to connect through a

     jumper, the TX signal of the Bluetooth module to the RX signal of the microcontroller which is

    available on a pin of the UART interface connector.

    -  Three SMD LEDs placed on the bottom right side of the upper board indicate the state of the

    Bluetooth module. The left LED indicate if the connection is established, and the other two

    indicate when the Bluetooth module transmits or receives information.

    UART interface connecter provide the access to the UART interface of the microcontroller. If the

    UART interface is used, the bidirectional communication between microcontroller and Bluetooth

    module cannot be done.

    The documentation for the Karel board manufacturing was created by Mihai Agape, and it is available

    on the Github repository „Karel Upper Board” [36].

  • 8/18/2019 Karel User's Manual

    48/70

    Karel User’s Manual 

    Page 44 of 66

    4.2.2.1  KarelPowerSupply

    Robotic platform Karel is powered by 2s LiPo battery (2 cells in series) with a capacity of 850 mAh (Figure

    55). The voltage supplied by the battery changes during operation from 8.4 V (when the battery is fully

    charged) to 6 V (when the battery is fully discharged).

    The battery voltage is regulated by three voltage regulators in order to obtain 5 V, 3.3 V, and 7 V voltages.

    Most of the logical circuits on the platform are powered at +5 V. The Bluetooth module is powered at 3.3

    V. The motors can be powered directly from the battery or at +7 V regulated voltage.

    4.2.2.1.1  Upper Board Power Switch

    Most of the robots we built previously didn’t have a power switch; that means  that every time when we

    used the robot we had to connect / disconnect the battery connector. Sometimes we connected the

    battery reverse way, because we used unpolarised connectors and we were quite nervous during some

    contests. In fact, the first two prototypes of the Karel platform didn’t include a power switch. We included

    in the last Karel design a power switch (Figure 62) which is based on the electronic power switch designed

    by Maria-Cristina Agape [37].

    The power switch works as it follows: if we switch the S6 micro-switch the T3 transistor is on or off and

    therefore the upper board is connected or disconnected from the power supply. In the initial design therewas also a battery reverse protection circuit. We didn’t use because the battery voltage is supplied to the

    board through a polarised JST connector.

    Figure 62 Power switch schematic

    4.2.2.1.2  +5 V Voltage Regulator

    Most of the circuits—microcontroller, inputs cir