fischertechnik ROBOTICS

Base Set and ADD ON - perfectly suited for teaching

First steps

To make it as easy as possible to get started, we have a small tutorial that will get you familiar with the first steps.
Click here for the video

COOMING SOON - Instruction ROBO Pro Coding

Important basics and how to work with ROBO Pro Coding can be viewed in this document - COMING SOON

Instruction manual TXT 4.0 Controller

To make it as easy as possible for you to get started with the construction kit, we have created a small tutorial that shows you the first steps.
Click here for the TXT 4.0 Controller manual

Ready lesson plans ROBOTICS Base Set

Ready-made lesson plans are available. If you want to get more details about learning contents, relation to the educational plan and downloads of the task sheets and solutions, follow the link below.
Lesson plans for the product ROBOTICS Base Set

Ready lesson plans ADD ON Omniwheels

Ready-made lesson plans are available. If you want to get more details about learning contents, relation to the educational plan and downloads of the task sheets and solutions, follow the link below.
Lesson plans for the product Add On Omniwheels

Ready lesson plans Autonomous Driving

Ready-made lesson plans are available. If you want to get more details about learning contents, relation to the educational plan and downloads of the task sheets and solutions, follow the link below.
Lesson plans for the product Add On Autonomous Driving

COMING SOON - Ready lesson plans ADD ON IoT

Ready-made lesson plans are available. If you want to get more details about learning contents, relation to the educational plan and downloads of the task sheets and solutions, follow the link below.

Download ROBO Pro Coding App

Before you start, you need to download the app. Simply select the appropriate operating system and click on the link:

Google Play Store

Microsoft Store

Apple App Store



Download Voice Control

Tell the robot where to go long! Download our Voice Control App and give the robot individual commands:

Google Play Store

Apple App Store

Topic Introduction

Computers are an essential part of our modern world. They are all around us, and not just in the form of PCs, laptops and tablets: We carry them in our pockets as smartphones; they are integrated into our cars, in dishwashers and washing machines, in our home heating controllers, in e-bikes, and even in coffee makers.

Each year, they become more powerful, even as they become smaller and more compact. Their uses are likewise growing, and they can be tailored to different, specific applications and integrated into them as embedded systems. They use sensors to record and “measure” their environments, and control motors, LEDs and other actuators. Thanks to modern radio communication technologies such as WiFi or Bluetooth, they can be networked together to exchange data with one another or with a control centre.

But how do these kinds of embedded systems work, and how does the “heart” of the system, the microprocessor, function? What is a microcontroller, and how is it used to record and analyse sensor data? How do we control mobile systems, like robots or vehicles? How can the systems communicate with one another and exchange data?

This learning unit will focus on understanding microcontrollers and their uses. We will explain central fundamentals of microcontrollers, and deepen understanding of their practical use through exercises (tasks). To do so, we will present a few important applications for microcontrollers: Measurement, communication, coding and encryption, controlling and regulation, robotics and autonomous driving. 


A microcontroller is a control system consisting of a microprocessor and a number of inputs and outputs. Sensors or memory storage are connected to the inputs, while actuators such as motors, LEDs or displays are connected to the outputs. Microcontrollers have a volatile working memory (RAM), which is deleted when they are switched off, and generally also have an EEPROM, where programs and data can be saved on a long-term basis. In contrast to laptops and PCs, there is neither a keyboard for input nor a screen as an output unit; these must be controlled separately. 

Familiar, commonly used examples of these kinds of microcontrollers are, for instance, the Arduino, the BBC micro:bit, the Calliope Mini and the TXT Controller from fischertechnik.

The heart of the microcontroller is a microprocessor. In and of itself, a microprocessor is an integrated circuit (IC), which loads commands and data from a (temporary) memory – called Random Access Memory (RAM) – into the registry of the IC, processes them in a computing unit, and saves the results back in the RAM. A microprocessor consists primarily of transistors – electronic “switches” that have exactly two states: “On” and “Off”. These transistors can be used to construct logical circuits such as “and”, “or” and “not” gates. The results are saved in a “flip-flop”, a stable changeover switch (for further information, see the “Electronics” educational box). 

A quartz oscillator indicates the clock rate, speed with which the microprocessor should process the commands and internal computing steps. The commands are indicated in a machine code (which differs by microprocessor type), and consist of a command (such as “add two values) and multiple parameters depending on the command (such as the two values to be added or the registries where the values are saved). 

The performance of the microprocessor is determined by its clock rate, the data width in bits (which indicates how large the addresses and values which the microprocessor commands can process in one step may be) and the machine code itself: The more complex the commands that the IC can execute are, the faster data processing generally is. To accelerate access to the RAM, many microprocessors today contain a separate cache memory where they temporarily store commands and data during processing. 

The microprocessors used in laptops and PCs today can process 64 bit long data (values, RAM addresses). They contain many billions of transistors, and are clocked at multiple GHz (billions of vibrations per second). They can share the work (“multi-core”) and have cache memories that are many megabytes in size. Today, microcontrollers generally use microprocessors with a word width of 32 bits and a clock frequency of less than one GHz – which is sufficient by far to handle the tasks of a microcontroller.


People have been experimenting with machines since antiquity – structures that can carry out work independently, driven by air or hydropower, that can complete specified movements on command, or that can make music. In the 15th century, Leonardo da Vinci (1452-1519) built a large number of machines that impressed the public and nobles alike at theatres and royal courts. Wolfgang von Kempelen (1734-1804) built a functional speech synthesizer in 1791. The punch card control system for mechanical looms developed by Joseph-Marie Jacquard (1752–1834) in 1805 is considered the first “programmable machine”.

However, the breakthrough in developing controllers suitable for flexible use did not occur until the development of the computer. The invention of the integrated circuit (IC) in 1958/1959 by Jack Kilby (1923-2005) and Robert Noyce (1927-1990) and the development of the microprocessor in 1971, invented and patented by engineers at the company Texas Instruments, made highly flexible, simple, fast, wear-free, and above all programmable controllers possible. The first microprocessor, the TMS1000, contained 8,000 transistors. Since that time, the number of transistors contained in a microprocessor has doubled around every 18 months. This development is also called “Moore's law”, after Gordon Moore (*1929), who identified this phenomena in 1965 based on the ongoing development of ICs in previous years. Today's microprocessors consist of billions of transistors – yet they are hardly larger than the TMS1000.


The following section will explain some basic fundamentals and background information that will be required in the associated education set; this knowledge will be deepened in the course of carrying out the tasks.

How is a microcontroller programmed?

Generally, programming of the microcontroller is not carried out on the microcontroller itself, but in a specialised programming or development environment (integrated development environment, IDE) on a PC, laptop, tablet, or even a smartphone. Programs made in this manner are then transmitted to the memory of the microcontroller via a communication interface, such as USB, WiFi or Bluetooth, and executed there. 

This is how the TXT 4.0 is programmed as well: Programs are developed in ROBO Pro Coding on a PC, laptop or tablet in the programming language Blockly or Python, then transmitted to the TXT 4.0, where they are executed. 

What is a “finite automaton”?

A “finite automaton” is a system whose behaviour can be described as a finite quantity of states. The transition from one state to another is triggered by conditions (such as events like changes in the values of sensors), each of which is followed by an action. Therefore, finite automatons are also called “state machines”, and described by state diagrams. 

Finite automatons play an important role in describing microcontrollers. Almost every embedded system (such as an elevator controller or a robot) can be understood as a system of a finite number of states. Representing these as a state diagram usually makes it much easier to understand the system, and facilitates (error-free) programming. Only the events that cause the state change need to be taken into consideration in every state - such as requesting a “green” light at a pedestrian signal (see the example shown in the figure).

What is concurrency?

Concurrency is the ability of a system to carry out different processes at the same time (or in “parallel”). Concurrency is implemented (technically) either by distributing the processes across multiple microprocessors (“multi-core”), or if the microprocessors carry out the processes alternately on a step-by-step basis by multitasking, so as to create the impression of actual parallelism.

Concurrent processes are especially well-suited for programming dependent procedures or events, especially if one or more of the processes is completed on a time-dependent basis and in a fixed rhythm (such as a flashing light). “Semaphores” are used to synchronise concurrent processes. These are usually variables accessible to both processes, the value of which the processes can use, for example, to share their status or wait for one another.

What are analogue and digital data?

Microcontrollers can only process “on” and “off” states, binary values that can take on one of two states. Therefore, evaluating sensors that likewise only have two states, such as buttons, reed contacts (magnetic switches) or phototransistors, is very simple, and the state of the sensor can be saved as digital data in a bit.

However, in reality there aren’t just binary states. Brightness, temperature, or distance, for example, can have a very wide range of different values. We can also measure such analogue data with sensors, such as a photoresistor, a thermistor, or an ultrasound distance sensor. However, for our microcontroller to process these analogue values, they must be converted into numbers, or into digital data. But these values are more complex than the binary ones the sensors delivered to us: Building on the binary states, the microprocessor can use the dual system to represent all number values (and, through suitable coding, can also represent other characters like letters - we will go into this later on).

In a microcontroller, an analogue / digital (A/D) converter converts the analogue sensor value into a number (a more complex piece of digital data): To do so, the sensor value, usually an electrical resistance or voltage, is electronically “sensed”. If the resistance or voltage is high, the A/D converter returns a higher number value; if the analogue value is low, the number value delivered to the microcontroller is low. How precisely the analogue value at the input can be determined depends on the resolution of the A/D converter. Generally, this is indicated by the bit length of the resulting value.

The eight inputs of the TXT 4.0 Controller can be used both as digital (binary) and analogue inputs. The A/D converters at the inputs scan analogue values such as the electrical resistance of the thermistor, which changes depending on the temperature, with a precision of 12 bit, and therefore convert the resistance into a number between 0 and 4096. The TXT 4.0 can use different reference voltages to determine not only resistances in the measurement range of 5 kOhm, but also much higher resistance values, very precisely.
In order to more precisely calculate the temperature value T (in Kelvin) from the resistance value R of an NTC resistor, the following Steinhart-Hart equation is generally used:
1/T=a+b(ln⁡〖R)+c〖(ln⁡〖R)〗〗^3 〗
The temperature in °C is obtained using T by subtracting 273.15. 

With two additional measured values (in addition to the resistance value of 1.5 kOhm at 25°C), we can establish a system of equations with the three unknowns a, b and c. We do not have to solve this system of equations ourselves: There is a “Thermistor Calculator” on the Stanford Research Systems website that calculates the Steinhart-Hart equation using the measured values for the parameters we are searching for.
In order to more precisely calculate the temperature value T (in Kelvin) from the resistance value R of an NTC resistor, the following Steinhart-Hart equation is generally used:
1/T=a+b(ln⁡〖R)+c〖(ln⁡〖R)〗〗^3 〗
The temperature in °C is obtained using T by subtracting 273.15. 

With two additional measured values (in addition to the resistance value of 1.5 kOhm at 25°C), we can establish a system of equations with the three unknowns a, b and c. We do not have to solve this system of equations ourselves: There is a “Thermistor Calculator” on the Stanford Research Systems website that calculates the Steinhart-Hart equation using the measured values for the parameters we are searching for.

How does the ultrasound sensor work?

Distance is measured by broadcasting multiple 40 kHz signals that are 200 µs long (in a spectrum not audible to the human ear), and measuring the time until their echoes are received, which are the sound waves reflected by an object. The propagation of the echo signals can be used to calculate distance using the speed of sound, as follows: The following applies to the speed of sound (in air):

c=(331.5+0.6∙t/(°C))   m/s

Therefore, at room temperature (t = 20°C) c is around 343.5 m/s or 0.03435 cm/µs. To determine the distance in cm based on the signal propagation delay (in µs), you first need to divide it by two and then multiply it by 0.03435 – or divide by 58.224. An IC on the ultrasound sensor completes this task and delivers the distance in cm; the sensor also automatically compensates for the influence of temperature on the measurement.

The range of the ultrasound sensor is approx. 4 m. At room temperature, therefore, 400 ∙ 58.224 = 23.3 ms pass before the echo of the trigger signal returns from an object that is 4 m away. If no echo reaches the sensor within this time, it returns the value “0” as a result (no object within range). The delay caused by the signal propagation must be taken into consideration by the controller in a mobile system (such as a vehicle).

Sound waves spread in a circular fashion, so the sensor does have a certain amount of scatter. It is able to detect obstacles that are directly in front of it, as well as objects positioned at the side (see figure). 

Ultimately, we must consider that the echoes will only reach the sensor if the sound waves hit the object at an angle that is not too acute. This is easy to check via an experiment.

What is a code?

Generally speaking, a code is an agreement for clearly representing certain information. Codes are used for both transmitting and displaying information. Each symbol in a code is associated with a certain meaning. We encounter some kinds of codes everyday, such as (Arabic) numerals used to represent numbers, or letters used to represent words and sentences. Other codes includes the notes on a line to represent pitch and tone duration, or the circuit symbols in wiring diagrams to represent electronic components. Whenever people want to document information for other people, or exchange information with them, they need a code which both the transmitter and receiver can understand.

However, codes do not only play a key role in communication between people. Without codes, computers cannot exchange information either - with people or between themselves. Codes used or understood by computers need to be particularly clear and definitive so there are no misunderstandings. Therefore, many codes are designed so that faults, such as errors during transmission, can be detected. There are even error-detection codes that can correct certain errors.

How do computers communicate?

To “communicate” with the help of microcontrollers, you have to first convert the information (messages) into data that can be transmitted by the microcontroller. The message can be almost anything: a text, an image, music, or language. This information must be coded before transmission. To do so, the transmitter and receiver must agree on a code they both know – in practice, this is done through technical standards.

The data stream resulting from the code can then be transmitted via sounds 9sound waves), visible symbols, electrical currents in a cable, light pulses in a fibreglass connection, or electromagnetic waves transmitted “through the air”. The semaphore signals at an airport, siren signals or a fire alarm, emails, chats, telephone calls, video conferences, smartphone navigation – these are all examples of communicating information in an agreed code.

How do bar codes work?

A bar code consists of black and white vertical bars of different widths. Bar codes are one-dimensional codes, since the information is contained only in the width of the bars (for example narrow bar = “0”, wide bar = “1”). The colours of the bars (b/w) serve only to differentiate between them. Bar codes are “visual codes”, meaning they can be read by a sensor that can differentiate between “light” and “dark” or by a camera with image analysis. Bar codes are generally used to label objects; they are used, for instance, on books and magazines (ISBN/ISSN), on product labels or stickers used in mailing. There are a wide range of different bar codes, which differ based on their information density and the check digits they use. The advantage of bar codes is that they are very robust and can be read in easily; the readers are also very inexpensive.

Code 39 is a typical bar code. It was developed by Intermec in 1973, and has since been defined by various standardisation organisations (including the ANSI and ISO) in specifications and standards (such as the ISO/IEC 16388). A code 39 bar code consists of nine bars – five black and four white (the spaces) – in two different widths. A wide bar stands for a “1” and a narrow one for a “0”; a code 39 bar code corresponds to a nine digit binary number. 

A (narrow) white space is before and after each character, so that the individual characters can be differentiated. Code 39 bar codes are always the same width, since the number of wide bars per character is defined at exactly three – two black and one white. A code 39 bar code, therefore, always consists of six narrow and three wide bars, or six “0”s and three “1”s. The code 39 standard defines a total of 44 characters: the 26 letters of the alphabet, the ten numbers “0” to “9” and the eight special characters “*” (start/stop character), space, “-”, “+”, “.”, “/”, “%” and “$”.

QR codes are another new development, and consist of dots arranged on a square. They are considered two-dimensional codes, and require a camera to read and decode them.

What is Morse code?

One of the first “technical” codes used to make characters legible by machines, was Morse code, developed in 1838 by Alfred Vail (1807-1859), an employee of Samuel Morse (1791-1872), and first standardised in 1865. Morse code represents numbers and the letters of the alphabet as different sequences of short (“dit”) and long “dah”) signals. Therefore, it can be used not only for electrical telegraphs, but also for other signals like light signals, sounds or lines of two different lengths, and it is completely independent of the transmission technology.

The following code tree shows the coding for the letters of the alphabet. An “E” is coded with a “dit”, an “A” with a “dit” followed by a “dah”, and an “N” with a “dah” followed by a “dit”. Therefore, the symbols used in the code are of different lengths.

Fig.: Code tree of the Morse alphabet

Therefore, the Morse code has another very valuable property: It is highly efficient, since it uses short signal sequences for frequently used letters, and longer ones for rarely used letters. In this way, it partially compensates for the redundancy of natural speech. 

The length of a “dah” corresponds to three times the length of a “dit”. A pause of one “dit” length is transmitted between two symbols; a pause of three “dit” lengths is transmitted between two letters of a word, and a pause of seven “dit” lengths is transmitted between two words. The transmission speed is determined by the length of a “dit”.

How does RGB colour code work?

The RGB code is a three-byte coding of the percentages of R (red), G (green) and B (blue, each from 0-255) in a colour shade. The RGB value can be used to determine the shade (Hue) as follows:

  • Determine the maximum Max:=max(R,G,B) and minimum Min:=min(R,G,B).
  • Calculate the difference Diff:=Max-Min. 
  • Of Diff > 0:
  • If Max=R: Hue:=(G-B)/Diff
  • If Max=G: Hue:=2+(B-R)/Diff
  • If Max=B: Hue:=4+(R-G)/Diff
  • Hue:=Hue/6
  • If Hue<0: Hue:=Hue+1
  • Colour wheel angle: Angle∶= Hue·360°

The result is the angle at which this colour is located on the colour wheel (see figure).


What is redundancy?

In information theory, redundancy describes data that can be left out without a loss of information. A code is redundant if it requires more bits than the minimum that would be necessary to represent the different characters. If all characters in a code are the same length, then the additional bits of the code that are actually not necessary to represent the information indicate its redundancy. For example, if we want to code a simple 1/0 signal, we only have to have one bit. However, if we code the signal with the numbers “1” and “0” (as an ASCII character), our code needs eight bits. The code then has a redundancy of seven (bits): 

Redundancy = log_2 (Number of possible code words/number of characters to be coded)

In our example, therefore, the redundancy is log2(28/2) = log2(27) = 7.

How does encryption work?

Data encryption is used to keep the contents of a message between a sender and recipient secret, and effectively prevent unauthorised persons from reading it. Encryption procedures that “modify” the message in a manner agreed upon by the sender and recipient are used to do so. The encryption procedure itself is not kept secret if possible, but only a key which is known to only the sender and recipient (“Kerckhoff Principle”). Usually, the characters in the message are replaced by other characters (substituted) or exchanged for one another (permutated). 

In the past, simple substitution codes were primarily used. One of the most well-known processes is the “Caesar cipher”. In it, the letters of the message are “shifted” by a set number of places in the alphabet (the key). If the key is “3”, then letter “A” becomes “D”, “B” becomes “E” and so forth, with “Z” becoming “C”. Decryption by the recipient is carried out in exactly the opposite fashion.

A Caesar cipher is easy to crack, since the encryption does nothing to change the distribution in frequency of the letters in natural speech. In longer texts, by far the most commonly used letter is “E”. If you know the most common letters in the encrypted text, then you know how many places the alphabet needs to be “shifted” to decrypt the associated text. 

In addition, there are just 25 possibilities for shifting the letters in the alphabet: This is a very small number of possible keys. You could simply test different shifts until the decryption produced a readable text.

An encryption published by Blaise de Vigenère (1523-1596) in 1586 in which the letters of the message are not all shifted by the same number of places in the alphabet, but rather according to a specified scheme, is much harder to crack. The key “1 5 12 4 8 7 11”, for instance, means that the first character of the message is shifted by one place, the second by five, the third by 12, etc., and the seventh being shifted by 11 places in the alphabet. The eighth character is once again shifted by one, the ninth by five, etc. The Vigenère encryption was considered uncrackable for almost three hundred years.

Often, the key is not represented by a sequence of numbers, but by the relevant letters of the alphabet – in the example above, by “AELDHGK”. This also makes it much simpler to program the replacement of characters (by “adding” their positions in the alphabet).

What is a controller?

In contrast to a microcontroller, in which an actuator is set to a specified value (for example an LED is set to a brightness level or an encoder motor is set to a specific position), a controller automatically ensures that a target variable is complied with, even in case of faults (for example that a track follower continues to follow the track, even through a curve).

To do so, the controller needs a “feedback” mechanism that informs it when there are deviations from the specified reference variable. A controller can be illustrated schematically as shown in the following image.
If there is a deviation between the control variable and the reference variable (the specification), then the controller makes a correction to reduce the deviation by changing a manipulated variable. For example, if you want to keep the number of revolutions for a motorised axis constant per time unit, even under changing loads, then you have to measure the rotations and increase or reduce the voltage to the motor in case of deviations.

Various options for how the deviation influences the change in the manipulated variable are differentiated among controllers. In a proportional controller (also called a P-controller), the correction occurs in relation to the extent of the deviation. If the controller overshoots, meaning that a delayed control effect causes the correction to go on for too long, you can dampen the regulation with an additional derivative term (also called a D term) that considers the change in deviation. This increases the regulating effect on a sudden, strong fault, or weakens it if the deviation lessens quickly. 

An integral controller (I-controller or I term) also takes the duration of the deviation into consideration by including the total of measured deviations in the correction, thereby accelerating the speed with which the system approaches the desired value.

When designing a suitable controller, the biggest challenge is identifying the factors by which the values that influence the control are multiplied (deviation, change in deviation, total of deviations) in order to achieve the desired control effect. Often, the fastest way to do this is to experiment. Generally, you should start by determining the factor for the P term, choosing it so that the controller does not oscillate (reducing overshoot). Then, add the factor for the D-term, starting with a very small factor and slowly increasing it until the system oscillates to the reference variable quickly enough. 
For the I-term, ensure that the deviation values do not continuously add up (for instance, that only a limited number of past deviations are taken into account, or that the old total is reduced before adding the next deviation, for instance divided by a constant value); otherwise, the I-term will very quickly dominate the P- and I- components.

A controller with P, D, and I control terms is also called a PID controller.