Академический Документы
Профессиональный Документы
Культура Документы
Users Manual
KAREL
Users Manual
Mihai Agape
Cristina-Maria Agape
Maciej Aleksandrowicz
Maria-Genoveva Agape
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
Contents
1
Introduction .................................................................................................................................................. 3
1.1
1.2
1.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
2.3
Challenges.................................................................................................................................................... 7
2.3.1 Compulsory ............................................................................................................................................. 7
2.3.2 Optional ................................................................................................................................................... 7
3
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
Manufacturing .............................................................................................................................................55
Page 1 of 66
Programming .............................................................................................................................................. 56
6.1
6.2
6.3
Debugging ................................................................................................................................................. 60
6.4
6.5
Bibliography ................................................................................................................................................ 64
Page 2 of 66
1 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 made
under 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.
Page 3 of 66
Lower Board
Page 4 of 66
The modular structure of the PCBs gives you the possibility to include in your Karel robot just the
modules you are interested in. As example, if you dont want to use the +7 V voltage regulator, you
dont 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.
Page 5 of 66
2 Karels 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.
Compulsory
Payload 200 g
Two wheels
2.1.1.2
Optional
One slot for a felt pen in the centre of the robot base
One shooter
Compulsory
The battery autonomy has to be at least 2 hours (for a movement time around 15 %)
Operating voltage 6 9 V
Digital circuits supply voltage 5 V (level shifters are used for system bus connection of
components which use other supply voltage)
Eight infrared optical sensors (ambient light, obstacle detection, line detection)
Four LEDs
The final prototype of the Karel robot has just one ball caster
Page 6 of 66
Optional
One potentiometer
One microphone
One speaker
Two encoders
TV remote receiver
Arduino compatible
The price of the raw materials used for robotic platform should be less than 99 EUR
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
Avoids obstacles
2.3.2 Optional
Draws with a marker attached to the robot
Page 7 of 66
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:
-
Page 8 of 66
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 Soft Version Electronic Switch
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.
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
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.
Page 9 of 66
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 Electronic Switch Testing
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 didnt connect the battery to
the load, i.e. success.
Page 10 of 66
After we measured the voltages in the circuit we understood that we had a big mistake in our design.
Our first prototype didnt 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.
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 bottom
Silkscreen bottom
PCB
We designed and manufactured a PCB of the charger (Figure 9). We didnt 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].
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 top
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.
Page 13 of 66
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].
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)
Page 14 of 66
We designed two PCBs: 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.
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.
3D view top
Figure 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 didnt see a short circuit. But when we printed the
Page 15 of 66
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 bottom
Silkscreen bottom
Silkscreen top
We designed a PCB as in Figure 18. As we know, for all switching power supplies, the layout is an
important step in the design, especially at high peak currents and high switching frequencies. If the
Page 16 of 66
3D view bottom
PCBA bottom
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].
Page 17 of 66
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.
Page 18 of 66
(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].
Page 19 of 66
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 didnt satisfy the specifications, being too large.
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 didnt satisfy the specification related to climbing a 30% ramp.
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.
Page 20 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 didnt have a tire for it.
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.
We manufactured the tires form silicon, using some iron moulds Figure 29.
Page 21 of 66
3.2.3 Brackets
Turkish team designed a bracket to fix the motor on the chassis (Figure 30). Unfortunately, the bracket
didnt 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.
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.
Size:
Weight:
Shaft diameter:
Gear ratio:
Free-run speed @ 6V:
Free-run current @ 6V:
Stall current @ 6V:
Stall torque @ 6V:
Page 22 of 66
10 12 26 mm
9.5 g
3 mm2
51.45:1
630 rpm
120 mA
1600 mA
1.08 kg cm
Karelino Schematic
Page 23 of 66
+5 V voltage regulator
+3.3 V voltage regulator
ATmega32U4 microcontroller
Bluetooth module BTM-112
Voltage level converter 3.3 V to 5 V
Motor driver
User pushbuttons (3)
User LEDs (3)
SPI and USB interface
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): PF7PF4 (A0A3), PF PF0 (A4-A5), PD4 (A6), PD6 (A7), PD7 (A8),
and PB4PB6 (A9A11)
We dont 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 Karelino PCB Design
In order to be easier to manufacture the Karelino PCB, we decided to use a single sided PCB laminate (at
that time we didnt have experience with double sided PCBs). The copper bottom layer of the PCB is
shown in Figure 33.
Page 24 of 66
4.
5.
6.
7.
8.
9.
10.
Page 26 of 66
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 couldnt insert the USB plug. The problem was solved by cutting a small part of the board in the
Page 27 of 66
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 the
Rayson 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 didnt function at all and we didnt
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].
Page 28 of 66
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 B
connector)
Redesign the PCB (components places and traces) according to the chassis shape
Add LEDs to show the state of Bluetooth module
As you can see next, all of these were included in the second prototype of the Karel platform.
Page 29 of 66
In the second designed the software for the PCB design played an important role, as you will see later.
Lets 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
Page 30 of 66
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 couldnt generate the files for
manufacturing lower board of the second Karel prototype. We continue our work after we bought the
Smart 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 the
PCB 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.
Page 31 of 66
Figure 45 Second Karel prototype upper board design very close to the limitations
The second Karel prototype was presented during the Katerini project meeting [24].
The conclusions for the second prototypes were:
-
If you want to manufacture Karel we recommend the last design of the platform.
Page 32 of 66
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 Last Karel Prototype Upper Board
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.
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].
Page 33 of 66
4 Hardware
In 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.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.
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
(2)
3.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.
=
Page 34 of 66
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 didnt matched the holes on the
chassis (lower board) we use Pololu brackets (Figure 52) to fix the motors on the chassis.
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:
-
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 Electronics
The last prototype of Karel platform has two PCBAs which we will detail in this subsection.
Page 35 of 66
Page 36 of 66
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 Battery Charger Circuit
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.
Page 37 of 66
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 Phase
If 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)
(4)
Page 38 of 66
D5 (yellow)
D4 (green)
ON
OFF
OFF
ON
OFF
OFF
Page 39 of 66
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, and
this way, the battery is isolated from both source, and load.
Page 40 of 66
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.
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 Bluetooth
module (powered at 3.3 V) and the microcontroller (powered at 5 V).
Motor driver with DRV8833PWP.
Page 41 of 66
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 microcontrollers programming with a programmer (e.g.
AVRISP MKII).
Page 42 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.
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 V
with 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].
Page 43 of 66
Page 44 of 66
The voltage regulator can also provide 3.3 V voltage to other circuits added to the platform because the
output current is higher than the current consumed by Bluetooth module.
4.2.2.1.4 +7 V Voltage Regulator
The supply voltage provided by 2s LiPo battery can changes between 6 V and 8.4 V. This means that the
motor speed is affected by the battery charge state. In order to solve this, we can use encoders to regulate
the motor speed or the power the motors with a regulated voltage. As you can see in Figure 65, we
included a switching voltage regulator made with IC5 integrated circuit of type TPS63060DSCR [40].
The voltage regulator is powered with battery voltage (6 8.4 V) and provide an output voltage of +7 V.
Depending on the voltage applied to the input of the TPS63060 integrated circuit, it can function as buck
or boost convertor, in order to maintain a constant value for the output voltage.
Page 45 of 66
Pin
Name
Alternative Functions
Karel
PE6
INT.6/AIN0
UVCC
D-
D+
UGND
GND (Ground)
UCAP
VBUS
PB0
SS/PCINT0
PB1
PCINT1/SCLK
SCK (SPI)
S4 (Pushbutton active low)
10
PB2
PDI/PCINT2/MOSI
MOSI (SPI)
S3 (Pushbutton active low)
11
PB3
PDO/PCINT3/MISO
MISO (SPI)
S5 (Pushbutton active low)
12
PB7
PCINT7/OC0A/OC1C/!RTS
13
!RESET
Page 46 of 66
Pin
Name
14
VCC
15
GND
GND (Ground)
16
XTAL2
17
XTAL1
18
PD0
OC0B/SCL/INT0
19
PD1
SDA/INT1
20
PD2
RXD1/INT2
RX (uC RX)
Bluetooth TX (Connected through jumper)
21
PD3
TXD1/INT3
TX (uC TX)
22
PD5
XCK1/!CTS
23
GND
GND (Ground)
24
AVCC
25
PD4
ICP1/ADC8
26
PD6
T1/!OC4D/ADC9
27
PD7
T0/OC4D/ADC10
28
PB4
PCINT4/ADC11
29
PB5
PCINT5/OC1A/!OC4B/ADC12
30
PB6
PCINT6/OC1B/OC4B/ADC13
31
PC6
OC3A/!OC4A
32
PC7
ICP3/CLK0/OC4A
33
PE2
!HWB
34
VCC
35
GND
GND (Ground)
36
PF7
ADC7/TDI
37
PF6
ADC6/TDO
Alternative Functions
Karel
Page 47 of 66
Pin
Name
Alternative Functions
Karel
38
PF5
ADC5/TMS
39
PF4
ADC4/TCK
40
PF1
ADC1
41
PF0
ADC0
42
AREF
43
GND
44
AVCC
UVCC is the input of 3 V voltage regulator for USB module, and is connected to VCC. It also can be
connected to VBUS.
UCAP is the output of the 3 V voltage regulator for the USB module, and it is connected to UGND
trough a 1F capacitor.
D- and D+ pins of micro USB connector are connected to the D- and D+ pins of the microcontroller
through some 22 Ohm resistors. We use two CG0603MLC-05E varistors to prevent USB pads to
be damaged by external disturbances.
UGND is the ground of USB module.
VBUS is the input which monitor the supply voltage on the USB connector. For protection of the
5 V supply source we are use a 500 mA resettable fuse. The VBUS pin of the USB connector is
Page 48 of 66
Considering the type of the outputs, the resolution is limited to 8 bits. The limitation is due to T/C0 timer
/ counter.
Page 50 of 66
The way that the connectors are placed on the board makes very easy to connect a usual peripheral,
which use a single row 3 pins row female header (Signal, VCC, and GND).
Page 51 of 66
The next step is drawing a PCB schematics, with a reminder of montage features provided by holes in
the Karel units main boards. In this case (Figure 73) the strips with holes for assembly procure will be
glued to sensors board.
Page 52 of 66
Before printing PCB schematics on foil, the printer options must be set to best quality. In Figure 75 there
is an example of foil with PCB schematics of the KAREL mainboard printed onto it.
After printing, the next thing to do is to transfer the toner from the foil to copper laminate. It can be
done using the laminator (Figure 76). To get better quality, this procedure should be done at least two
times.
When the last step is completed, remove the foil and correct any imperfections using waterproof
marker (Figure 77).
The PCBs are ready to be etched in sodium persulfate solution (Figure 78).
Page 53 of 66
The next step is drilling holes and cutting the excess of laminate. After that procedure the PCB is ready
for soldering. Begin with integrated circuits, through passive elements and end with wires and gold pins
(Figure 80).
Assembly all parts and mount the new module to the KAREL unit (Figure 81).
The final step is to write a diagnostic program and test the module (Figure 82).
Page 54 of 66
5 Manufacturing
We intended to detail in this chapter the steps for manufacturing the Karel platform but we change our
mind. In this manual there three different subsections which include information related to the PCBA
manufacturing:
-
You can see that the Romanian and Polish teams use the same method to manufacture PCB, Transfer
Toner System (TTS). There are small differences due to the materials used. The best method is the one
you know better, if gives you the desired result.
We gather in this section some information related to the manufacturing of electronic modules
developed by Karel project.
1. Information about how to manufacturing PCBs using PulsarProFX kit PCB Fab in A Box on the
manufacturer website [21].
http://www.pcbfx.com/main_site/pages/start_here/overview.html
2. Karel controller manufacturing presentation [22].
http://1drv.ms/1iNc1qx
3. Electronic switch manufacturing documentation [5].
https://github.com/magape/KarelSwitch
4. Single cell LiPo manufacturing documentation [8].
https://github.com/magape/KarelCharger
5. Single motor driver manufacturing documentation [10].
http://1drv.ms/1OFONi0
6. Dual motor driver on single sided PCB manufacturing documentation [11].
http://1drv.ms/1WagtxM
7. Dual motor driver on a double sided PCB manufacturing documentation [12].
http://1drv.ms/1LoT0FI
8. +7 V voltage regulator manufacturing documentation [14].
http://1drv.ms/1VTje6j
9. Line sensor (12) manufacturing documentation [16].
https://github.com/magape/KarelLiFo12Sensor
10. Karelino controller documentation [23].
https://github.com/magape/KarelController
11. Karel Lower Board Testing Workshop manufacturing presentation [25].
http://1drv.ms/1bubNRm
12. How to Assemble Karel Lower Board - Workshop manufacturing presentation [26].
http://1drv.ms/18Z4cZf
13. Karel Upper Board Testing - Workshop manufacturing presentation [28].
http://1drv.ms/18Z4nnn
14. Karel lower board last prototype manufacturing documentation [27].
https://github.com/magape/Karel-Lower-Board
15. Karel upper board last prototype manufacturing documentation [30].
https://github.com/magape/Karel-Upper-Board
Some of the resources above, also have links to other valuable resources.
Page 55 of 66
6 Programming
We intended to have a detailed section related to the programming of the Karel platform. This doesnt
happened because human resources involved in this task were less than we expected. We will just
present on short how to write a C program for Karel, and how to program Karel using SPI, and USB
interfaces.
During the Karel project we organized few workshops related to programming [29], [43].
In the Device Selection window will be displayed all devices that can be programmed with Atmel Studio
6.2. Select ATmega32U4, the microcontroller used in Karel platform, by writing its name in the text box
placed in upper right side of the window. Click OK to create the project (Figure 84).
Page 56 of 66
Delete the template code placed automatically in RedLedBlink.c and add the code in Figure 85.
Is not necessary to type the green text because are just comments and dont affect the code. Instead
will affect you because after few months you want understand your own code.
Figure 85 Code for blinking the red led D9 on the Karel upper board
Page 57 of 66
If everything is OK, you should receive good news from the program (Figure 87).
Figure 87 Message displayed by Atmel Studio 6.2 after the code compilation
Dont close Atmel Studio, because in next subsection we will burn the program you just wrote in the
flash memory of Karel microcontroller, using SPI interface.
After the hardware preparation youve made, its time to come back to the program you wrote in Atmel
Studio 6.2.
In Atmel Studio 6.2 go to Tools menu and select Device Programming (Ctrl+Shift+P). Of course you can
use the Ctrl+Shift+P key combination (Figure 89).
In the Device Programming window make selections showed in Figure 90: Tool = AVRISP mkII, Device =
ATmega32U4, and click Apply button.
Figure 90 Selecting tool & device for device programming in Atmel Studio 6.2
Page 59 of 66
Figure 91 Checking device signature and target voltage in Atmel Studio 6.2
In the Device Programming window select Memories button on the left side of the window (Figure 92).
Under Flash (32 kB) there is a text box (Flash text box) which contains the path to the ELF file generated
when you compiled the RedLedBlink program. If it is not there, you have to search for it using the
button placed to the right side of the Flash text box. The file is in a folder named Debug placed in the
folder of your solution (project). Click the Program button under Flash text box.
You probably are very happy because the red LED already started to blink! Congratulations for the first
program for Karel platform that you wrote and tested!
If the LED didnt blink we welcome you in the debugging world.
6.3 Debugging
Debugging is the process of finding and fixing bugs (errors) in computer program code or defects of a
hardware device. If you will involve in CS field, probably you will spent a lot of time debugging the
programs / hardware you will develop.
Why previous program didnt function? It could be a lot of answers, but I give just three examples
introduced as questions.
Page 60 of 66
Of course you found it: on the line which modifies the state of the output pin PE6 we changed the
operator from ^ to |. That means that the PE6 will not be complemented anymore and will stay all
the time in 1. Therefore the red LED is off because it is active on 0.
Of course you also noticed that in the same line, PE6 was replaced by PD6, but this doesnt affect the
code because it is part of a comment.
Q3. Your red LED is blinking but at a slower rate than you expected? For sure you have this problem if it
first time when the microcontroller is used. Thats because the microcontroller comes out from the
factory with CKDIV8 fuse set, and the clock is divided by 8.
You can see now that your red LED is blinking at the right rate.
Second, you cannot program the ATmega32U4 via USB, using Atmel Studio. For USB programming we
need a software named FLIP 3.4.7. Go to the Atmel webpage http://www.atmel.com/tools/FLIP.aspx and
use the information to install FLIP 3.4.7 on your computer.
Third, power your Karel platform and connect the microcontroller and the computer through a USB
cable. As you can see in Figure 95, Karel uses a mini B USB connector.
Page 62 of 66
Now open FLIP and program the microcontroller with the HEX files hosted at http://1drv.ms/1VdcEWi.
The three files are: Flashing LEDs, Motors Test, and Bluetooth communication.
If you have problems using FLIP, you should check the documentation on the producer website.
Page 63 of 66
7 Bibliography
[1] M. Agape and M.-G. Agape, KAREL Specifications, 12 November 2013. [Online]. Available:
http://sdrv.ms/170NTak. [Accessed 04 May 2015].
[2] C.-M. Agape, Intrerupator electronic cu protectie la conectarea inversa a bateriei, 26 May 2014.
[Online]. Available: http://1drv.ms/1gu6KCh. [Accessed 1 July 2015].
[3] Fairchild Semiconductor, FDC6329L, 14 September 2000. [Online]. Available:
http://www.fairchildsemi.com/ds/FD/FDC6329L.pdf. [Accessed 27 January 2014].
[4] International Rectifier, IRLML6401 Datasheet, 11 September 2004. [Online]. Available:
http://www.irf.com/product-info/datasheets/data/irlml6401.pdf. [Accessed 3 February 2014].
[5] C.-M. Agape, Karel Load Switch, 17 June 2014. [Online]. Available:
https://github.com/magape/KarelSwitch/. [Accessed 25 March 2015].
[6] M.-C. Agape, Intrerupator electronic cu protectie la conectarea inversa a bateriei, 6 June 2014.
[Online]. Available: http://1drv.ms/1W5kinN. [Accessed 8 March 2015].
[7] Microchip Technology Inc., MCP73833/4 Datasheet, 30 May 2009. [Online]. Available:
http://ww1.microchip.com/downloads/en/DeviceDoc/22005b.pdf. [Accessed 15 August 2015].
[8] M. Agape, Single Cell Lithium Polymer Charger with MCP73833, 18 June 2014. [Online].
Available: https://github.com/magape/KarelCharger. [Accessed 2 September 2015].
[9] Texas Instruments, DRV8833 Dual H-Bridge Motor Driver, 15 January 2011. [Online]. Available:
http://www.ti.com/lit/ds/symlink/drv8833.pdf. [Accessed 24 August 2015].
[10] M. Agape, Single Motor Driver with DRV8833, 19 September 2015. [Online]. Available:
http://1drv.ms/1OFONi0. [Accessed 19 September 2015].
[11] M. Agape, Dual Motor Driver with DRV8833 on Single Sided PCB, 19 09 2015. [Online]. Available:
http://1drv.ms/1WagtxM. [Accessed 19 09 2015].
[12] M. Agape, Dual Motor Driver with DRV8833 - Double Sided PCB Design, 19 09 2015. [Online].
Available: http://1drv.ms/1LoT0FI. [Accessed 19 09 2015].
[13] Texas Instruments, TPS6306x High Input Voltage, Buck-Boost Converter With 2-A Switch Current,
15 December 2011. [Online]. Available: http://www.ti.com/lit/ds/symlink/tps63060.pdf. [Accessed
12 September 2015].
[14] M. Agape, 7 V Switching Voltage Regulator, 14 January 2014. [Online]. Available:
http://1drv.ms/1VTje6j. [Accessed 3 September 2015].
[15] Kingbright, KTIR0711S - Subminiature, High Sensitivity Photointerrupter, 17 January 2013.
[Online]. Available:
http://www.kingbright.com/attachments/file/psearch/000/00/00/KTIR0711S(Ver.13).pdf.
[Accessed 18 September 2015].
[16] M. Agape, 12 Reflective Optical Sensors Array, 18 June 2014. [Online]. Available:
https://github.com/magape/KarelLiFo12Sensor. [Accessed 12 September 2015].
Page 64 of 66
Page 65 of 66
Page 66 of 66