Home About Expertise Projects Blogs Contact
RoboticsSimulationKRL ProgrammingCompleted

KUKA.Sim SCARA
PCB Assembly

A SCARA robot cell in KUKA.Sim that picks 14 real electronic components from a tray, places them on a PCB and rejects one chip. Built, programmed in KRL and timed.

TypeRobot cell simulation · KRL programming
DomainElectronics assembly
RobotKUKA KR 6 R700 Z200-2 SCARA
ToolsKUKA.Sim 4.10 · KRL · KR C5 micro
CourseUCD MEEN41350 Introduction to Robotics
By Chandan NaveenPublished 18 November 2026Updated 18 November 2026Reading time: 8 min
14
Parts placed or rejected in one run
~44 s
Run time (stopwatch, ±2 s)
±0.02 mm
Repeatability (manufacturer datasheet)
4
Robot axes (SCARA)
01 · The brief

Why build a robot cell simulation?

A block moving from point A to point B is a robot demo. It is not electronics manufacturing. For our group project on robots in the electronics industry, I wanted a simulation that looked and behaved closer to a real assembly cell, so I built one in KUKA.Sim 4.10.

I built in two stages. Case 1 placed eight plain blocks on a plain board in a 2 by 4 grid, in about 27 seconds. That proved the pick and place logic. Case 2, covered here, uses real component models and a reject step.

02 · The robot

Why a KUKA SCARA

Electronics work is mostly flat. Boards lie on a belt, parts are small, and the robot spends its day moving things down onto a surface and back up. A SCARA is fast and accurate in that plane and compact. What it gives up is payload and flexibility in height, which costs nothing when the part is a resistor or a chip.

I first looked at CoppeliaSim, but its library has no SCARA. KUKA.Sim does, and it runs real KRL programs on a virtual KUKA controller.

SpecKUKA KR 6 R700 Z200-2
Axes4
Reach700 mm
Payload3 kg rated, 6 kg maximum
Repeatabilityabout ±0.02 mm
Speedup to 157 cycles per minute on the standard test move
ControllerKR C5 micro
Mounting and weightFloor, about 21 kg

Figures are from the manufacturer datasheet as listed by a distributor. I did not measure them.

03 · The cell

What is in the cell

KUKA.Sim view of a green PCB on a flat belt with resistors, electrolytic capacitors, an LED and a SOIC-8 chip placed on and beside it
Components placed on the green PCB during a run in KUKA.Sim.

The robot carries a two-finger gripper. Beside it sit a tray holding the parts, a flat-bed belt conveyor with a green PCB on it, and a reject bin. I chose a flat belt over rollers because it suits a board better, and the belt is stopped during assembly.

The parts are real STEP models from component libraries: four through-hole resistors, two electrolytic capacitors, an LED, a transistor, a 0603 capacitor, two SOIC-8 chips, a 32-pin header and a crystal oscillator. Each is rotated so its leads point down at the board.

04 · The KRL program

How the robot is programmed

One KRL program runs the whole cell. A timer starts, then a double loop places the first eight parts. The loop counters build each pick and place position, so one short block covers a 2 by 4 grid. The rest of the parts use explicit coordinates, and one chip is rejected.

KRL · Case 2 main program (excerpt)
DEF MAIN()
DECL INT I, J
DECL REAL DZ
DECL E6POS PK, PP
TOOL_DATA[1]={X 92,Y 0,Z 17,A 0,B 0,C 0}
$TOOL=TOOL_DATA[1]
$BASE=BASE_DATA[1]
$TIMER[1]=0
$TIMER_STOP[1]=FALSE
FOR J=0 TO 1
FOR I=0 TO 3
PK={X 405, Y -265, Z 90, A 0, B 90, C 90}
PK.X=405+30*I
PK.Y=-265+30*J
PP=PK
PP.X=420+20*I
PP.Y=235+30*J
IF J==0 THEN
DZ=3
PP.A=90
ELSE
IF I<2 THEN
DZ=-3
ELSE
DZ=2
IF I==2 THEN
PP.X=455
ENDIF
ENDIF
ENDIF
PTP PK
PK.Z=27
LIN PK
$OUT[101]=TRUE
PK.Z=90
LIN PK
PTP PP
PP.Z=22+DZ
LIN PP
$OUT[101]=FALSE
PP.Z=90
LIN PP
ENDFOR
ENDFOR
; ... six more pick and place moves follow, including the reject ...
PK={X 450, Y 250, Z 90, A 0, B 90, C 90}
PTP PK
WAIT SEC 1.5
; ...
$TIMER_STOP[1]=TRUE
;@PRINT Board time ms = {$TIMER[1]}
END
01

Set up the tool and the timer

Declare variables, define the tool point at the finger centre with TOOL_DATA[1], and start timer 1. Declarations must come before anything else in KRL.
DECL · TOOL_DATA · $TIMER
02

Loop over the grid

Two nested FOR loops compute each pick position from the counters I and J, and each place position on the board.
FOR · PK.X · PP.Y
03

Pick and place pattern

Move above the part with a fast PTP, drop straight down with LIN, close the gripper with $OUT[101]=TRUE, lift, move over the board, lower, open the gripper, lift.
PTP · LIN · $OUT[101]
04

Adjust for part height

Tall and flat parts sit at different heights, so an IF block sets a height offset DZ for each case.
IF · DZ
05

Reject one chip and stop the timer

The robot waits WAIT SEC 1.5, picks one SOIC-8 chip and drops it in the reject bin. At the end the timer stops and prints the board time.
WAIT SEC · $TIMER_STOP
05 · What broke

Six problems and how I fixed them

Parts floated or the wrong part came along

The grasp detection volume was 300 mm wide, so the gripper picked up whatever was nearby. Cutting it to about 40 × 24 × 24 mm around the finger centre fixed it.

Parts sat to one side or sank into the board

I moved the tool point to the finger centre and checked the left and front views while the part was in the air. A part can look perfect from the front and sit 20 mm off from the side.

Wider parts were not picked up

A chip wider than the grab zone was ignored. Real component sizes expose problems that plain blocks hide.

KRL is strict about order

Declarations must come before everything else, and a bare INI line broke the parse.

Save only after a reset

Saving with the robot or parts in a bad state means the file reopens in that state.

Plain shapes first, real parts second

Getting the logic right on simple blocks meant the real models only had to fix geometry, not logic.
Front view in KUKA.Sim of the SCARA gripper fingers above the PCB, used to check part alignment
A front view like this is how I checked finger and part alignment.
06 · The result

Cycle time and what it means

14
Moves in one run
~44 s
Total run, including a 1.5 s pause at the reject step
±2 s
Stopwatch error at real-time speed (x1.0)

I timed the run by stopwatch, from pressing Play to the robot's last move, because the built-in timer did not show a readable value in my final setup. Case 1 took about 27 seconds for eight moves.

Dividing 3,600 by 44 gives about 82 boards an hour. Do not use that in a business case. It is an ideal run with no vision, no board handling, no gripper wear and no faults, so treat it as an upper bound.

Why it matters for the rest of the project
Our report argues that building and testing a program on a computer model before touching the real line saves commissioning time. A cell like this is a small version of that idea: I changed positions, heights and part order by editing code, not by rebuilding anything.
07 · Limits

What the simulation does not do

It has no vision system and no real inspection, so the reject is a fixed step and not a detection. It has no feeder, no part variation, no gripper change and no safety fencing. The belt is stopped, so the board stays fixed while the robot works. KUKA.Sim cannot rescale imported parts, so the long leads on the capacitors and LED were sunk 5 mm through the board to look right, which changes the picture and not the cycle time. Positions were set by eye from several views, not against a physical cell.

08 · What next

Where I would take it next

The obvious gap is the inspection. Replacing the fixed reject with a camera-based check would make the cell behave like a real one. After that I would feed boards in on the belt so the cell runs continuously, and compare the SCARA with a six-axis arm on the same job. The wider context, costs and payback evidence are in the full robots in electronics project.

KUKA.Sim 4.10KRLSCARAKR C5 microPick and placeOffline programmingSTEP models
09 · FAQ

Common questions

What is KRL, the KUKA robot language?
KRL (KUKA Robot Language) is the programming language of KUKA controllers. A program is a list of motion commands, such as PTP and LIN, plus variables, loops, conditions, timers and inputs and outputs. KUKA.Sim runs KRL on a virtual KUKA controller, so a program written there is close to what a real controller would run.
What is the difference between a PTP and a LIN move in KRL?
PTP is a point-to-point move in joint space. It is fast, but the path between the two points can curve. LIN is a straight-line move of the tool tip. In a pick and place program, PTP carries the robot quickly above a part and LIN does the straight approach down and the straight lift away.
Why was one SOIC-8 chip rejected into a bin?
It is a deliberate step that stands in for a quality check. In a real cell a vision system or tester would flag a bad part and the robot would drop it in a reject bin. This simulation has no inspection, so the same chip is rejected on every run. The robot does not detect anything.
How accurate is the 44 second cycle time?
It was timed by stopwatch at real-time speed (x1.0), from pressing Play to the robot's last move, with an error of about 2 seconds. It is an ideal figure with no vision, board handling or faults, so a real cell would be slower.
Part of a bigger projectRobots in the Electronics Industry: cases, ROI and payback →