ROBOTICS TXT 4.0 Base Set

Make the basics of robotics understandable and sustainable!


The fischertechnik Robotics TXT 4.0 Base Set is the perfect start to programming like the pros! In addition to the camera with image processing, the comprehensive construction set contains an ultrasonic sensor, two encoder motors, a track sensor, a phototransistor as well as two buttons and two LEDs. The models can be programmed and controlled using the ROBO Pro Coding graphical programming software and the ROBOTICS TXT 4.0 controller. Beginners can use ready-made example programs, while advanced and professional users can get started directly in a Blockly programming environment or in Python. Included are 12 exciting models, ranging from pedestrian traffic lights to a barrier, a barcode scanner and mobile driving robots with encoder motors, camera, track and distance sensors. In addition to introductory and basic information, the comprehensive teaching material includes 20 experiments with solutions for the 12 models.

Number of pupils
2-4 per kit
Learning objectives
Teaching the basics of robotics in a hands-on way
Time required
Each task contains detailed time information for lesson structuring
Grade level
Secondary level

Topics and learning objectives

 

Accompanying material

First steps

First steps

A short tutorial for you to familiarize yourself with the first steps.
Click here for the introductory video
Connecting the TXT 4.0 Controller to ROBO Pro Coding

Connecting the TXT 4.0 Controller to ROBO Pro Coding

Important basics and how to work with ROBO Pro Coding
Click here for the student guide
Operating instructions TXT Controller 4.0

Operating instructions TXT Controller 4.0

Instructions for the TXT 4.0 Controller
Operating instructions TXT 4.0 Controller

Expand ROBOTICS Base Set: Add Ons

Further information

Introduction to the topic

Computers have become an integral part of our modern world. They surround us not only in the form of PCs, laptops or tablets: we carry them in our pockets as smartphones, they are in our cars, in dishwashers and washing machines, in heating controls, in e-bikes and in coffee machines. 

Year after year, they are becoming more powerful and at the same time smaller and more compact. As a result, their fields of application are also increasing, as they can now be tailored to the respective application and integrated into it as "embedded systems". They use sensors to detect and "measure" their environment and control motors, LEDs or other actuators. Using modern wireless communication technologies such as WLAN or Bluetooth, they can be networked with each other and exchange data with each other or with a control center. 
But how do such embedded systems and their respective "heart", the microprocessor, work? What is a microcontroller and how is it used to record and evaluate sensor data? How do you control mobile systems, e.g. robots or vehicles? How can the systems communicate with each other and exchange data? 

This learning unit focuses on understanding microcontrollers and their use. The central basics are explained and their practical implementation is deepened in the exercises (tasks). Various important areas of application for microcontrollers are presented: Measurement, communication, coding and encryption, control and regulation, robotics and autonomous driving.

 

Definition 

A microcontroller is a control system consisting of a microprocessor and a number of inputs and outputs. Sensors or memories 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 switched off, and usually also have an EEPROM in which programs and data can be permanently stored. In contrast to laptops and PCs, there is neither a keyboard as an input unit nor a screen as an output unit; these must be controlled separately.  
Well-known and widespread representatives of such microcontrollers are, for example, the Arduino, the BBC micro:bit, the Calliope Mini and the TXT controller from fischertechnik.

The heart of the microcontroller is a microprocessor. In itself, a microprocessor is an integrated circuit (IC) that loads instructions and data from a (temporary) memory - called random access memory (RAM) - into the IC's registers, processes them in a computing unit and stores the result back in RAM. A microprocessor essentially consists of transistors - electronic "switches" that know exactly two states: "on" and "off". These transistors can be used to construct logical circuits such as "and", "or" and "not" links. The results are stored in a "flip-flop", a stable toggle switch (for more details, see the "Electronics" education box).  
A quartz crystal sets the clock for the microprocessor, i.e. the speed at which the microprocessor processes the instructions and internal calculation steps. The instructions are specified in a machine code (which varies depending on the type of microprocessor) and consist of a command (e.g. "add two values") and, depending on the instruction, several parameters (e.g. the two values to be added or the registers in which the values are stored).  

The performance of the microprocessor is determined by the clock speed, the data width in bits (which indicates how large the addresses and values may be that the microprocessor instructions can process in one step) and the machine code itself: The more complex the instructions that the IC can execute, the faster, as a rule, the data processing. To speed up access to the RAM, many microprocessors today contain their own cache memory in which they temporarily store instructions and data during processing.  
The microprocessors used today in laptops and PCs can process 64-bit long data (values, RAM addresses), contain several billion transistors and are clocked at several GHz (billions of oscillations per second). They can share the work ("multi-core") and have many megabytes of cache memory. In microcontrollers today, microprocessors with a word width of 32 bits and a clock frequency of less than one GHz are usually used - this is by far sufficient for the tasks of a microcontroller.

History 

Since ancient times, people have been experimenting with automata - constructions which, driven by air or water power, perform work independently, execute predefined motion sequences on command or even produce music. In the 15th century AD, Leonardo da Vinci (1452-1519) constructed numerous machines that impressed the people and nobility in theaters 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 automaton". 

However, the breakthrough for the development of flexible control systems only came with 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 Texas Instruments, made very flexible, lightweight, fast and wear-free, but above all programmable controls possible. The first microprocessor, the TMS1000, contained 8,000 transistors. Since then, the number of transistors in a microprocessor has doubled approximately every 18 months. This development is also known as "Moore's Law" after Gordon Moore (*1929), who derived this correlation in 1965 from the further development of ICs in the preceding years. Today's microprocessors consist of several billion transistors - and are barely larger than the TMS1000.

Basics
In the following, some basic connections and backgrounds are explained, which are required in the corresponding education kits and are deepened in the corresponding tasks.

 

How is a microcontroller programmed?

The microcontroller is usually not programmed on the microcontroller itself, but in a special programming or development environment (integrated development environment, IDE) on a PC, laptop, tablet or even a smartphone. Programs created in this way are then transferred to the microcontroller's memory via a communication interface, e.g. USB, WLAN or Bluetooth, and executed there.  
This is exactly how the TXT 4.0 is programmed: The programs are developed in ROBO Pro Coding on a PC, laptop or tablet in the Blockly or Python programming language and then transferred to the TXT 4.0, on which they are executed.

What is a "finite automaton"?

A "finite automaton" is a system whose behavior can be described as a finite set of states. The transition from one state to another is triggered by conditions (such as events, e.g. changes in sensor values), each of which is followed by an action. Finite automata are therefore also called "state machines" and are described by state transition diagrams.  

Finite automata play an important role in the description of microcontrollers: almost every embedded system (such as an elevator controller or a robot) can be understood as a system consisting of a finite number of states. The representation as a state transition diagram usually simplifies the understanding of the system considerably and facilitates (above all error-free) programming. This is because in each state, only the events that lead to a state change need to be taken into account, such as the request for a "green" signal at a pedestrian traffic light (see the example in the figure). 

What is analog and digital data?

Microcontrollers can only process "on" and "off" states, i.e. binary values that can assume two different states. The evaluation of sensors that also only know two states, such as buttons, reed contacts (magnetic switches) or phototransistors, is therefore very simple, and the state of the sensor can be stored as digital data in one bit. 

But in reality, of course, there are not only binary states. For example, brightness, temperature or distances can take on many different values. We can also measure such analog data with sensors, such as a photo resistor, a thermistor (thermistor) or an ultrasonic distance sensor. However, in order for our microcontroller to process these analog values, it must convert them into numbers, i.e. digital data. However, these are more complex values than the binary values provided by the digital sensors: Based on the binary states, the microprocessor can represent all numerical values using the dual system (and, by means of suitable coding, also other characters, such as letters, but more on this later). 

The conversion of the analog sensor value into a number (i.e. a more complex digital datum) is performed in a microcontroller by an analog-to-digital (A/D) converter: the applied sensor value, usually an electrical resistance or a voltage, is electronically "scanned" for this purpose. If the resistance or voltage is high, the A/D converter delivers a large numerical value; if the analog value applied is low, the numerical value delivered to the microcontroller is small. How precisely the analog value present at the input can be determined depends on the resolution of the A/D converter. This is usually specified in the bit length of the result value. 

The eight inputs of the TXT 4.0 controller can be used both as digital (binary) and analog inputs. The A/D converters at the inputs sample analog values such as the electrical resistance of the thermistor, which changes depending on the temperature, with an accuracy of 12 bits, i.e. they convert the resistance into a number between 0 and 4096. Thanks to different reference voltages, the TXT 4.0 can not only precisely determine resistances in the measuring range of 5 kOhm, but also significantly higher resistance values.

What is concurrency? 


Concurrency is the ability of a system to run different processes simultaneously (or "in parallel"). Concurrency is implemented (technically) either by distributing the processes over several microprocessors ("multi-core") or by the microprocessor using multitasking to execute the processes in alternating steps, thus creating the impression of genuine parallelism. 

Concurrent processes are particularly suitable for programming sequences or events that are independent of each other, especially if one or more of the processes are time-dependent and take place in a fixed rhythm (such as a flashing light). In order to coordinate (synchronize) concurrent processes, "semaphores" are used: these are usually variables accessible to both processes, the value of which can be used by the processes to communicate their status to each other or to wait for each other, for example.

 

How do you determine the temperature with a thermistor? 

A thermistor (also known as a thermistor or NTC resistor) is a resistor whose resistance value changes depending on the temperature. Thermistors have a negative temperature coefficient (NTC), i.e. the resistance value decreases as the temperature rises. The following diagram shows the resistance characteristic of the fischertechnik thermistor.

The fischertechnik thermistor has a resistance value of 1.5 kOhm at 25°C. As can be seen from the graph, the characteristic curve of the thermistor is not linear. However, you can approximate the temperature value reasonably accurately using a linear curve. To do this, you must determine a second measured value and calculate the equation of the linear function from it. 

The fischertechnik thermistor has a resistance value of 1.5 kOhm at 25°C. As can be seen from the graph, the characteristic curve of the thermistor is not linear. However, you can approximate the temperature value reasonably accurately using a linear curve. To do this, you must determine a second measured value and calculate the equation of the linear function from it. 

For a more precise calculation of the temperature value T (in Kelvin) from the resistance value R of an NTC resistor, the following Steinhart-Hart equation is usually used:

1/T=a+b(lnR)+c(lnR)³

The temperature in °C is obtained from 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 set up a system of equations with the three unknowns a, b and c. We do not have to solve this system of equations ourselves. We do not have to solve this system of equations ourselves: On the Stanford Research Systems website there is a "Thermistor Calculator" that calculates the parameters of the Steinhart-Hart equation we are looking for from the three measured values. 

How does the ultrasonic sensor work? 


The distance is measured by emitting several 200 µs long 40 kHz signals (in the spectrum inaudible to humans) and measuring the time it takes to receive their echoes, i.e. the sound waves reflected by an object. The distance can be calculated as follows from the echo signal propagation time using the speed of sound. The following applies to the speed of sound (in air):

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

At room temperature (t=20°C), c is therefore around 343.5 m/s or 0.03435 cm/µs. To obtain the distance in cm from the signal transit time (in µs), you must first divide it by two and then multiply it by 0.03435 - or divide it by 58.224. This work is performed by an IC on the ultrasonic sensor and provides the distance in cm; the sensor also automatically compensates for the influence of temperature on the measurement. 

The range of the ultrasonic sensor is approx. 4 m. At room temperature, it therefore takes 400 ∙ 58.224 = 23.3 ms for the echo of the trigger signal to return from an object 4 m away. If no echo reaches the sensor during this time, it returns the value "0" (no object within range). The delay caused by the transit time of the signal must be taken into account in the control system of a mobile system (such as a vehicle). 

Sound waves propagate in a circle, so the sensor has a certain amount of scattering. This means that it not only detects obstacles directly in front of it, but also objects positioned to the side (see illustration).

Finally, it is important to note that the echoes only reach the sensor if the sound waves hit the object at an angle that is not too acute. This can easily be checked experimentally. 

What is a code? 


A code is - in very general terms - an agreement on the unambiguous representation of certain information. Codes are required for the transmission, but also for the display of information. Each character of a code is assigned a specific meaning. Codes that we encounter every day are, for example, (Arabic) numerals to represent numbers or written language to represent words and sentences. Other codes are the notes on staves to represent pitch and tone duration or the circuit symbols in circuit diagrams to represent electronic components. Whenever people want to document information for other people or exchange information with each other, they need a code that both the sender and the receiver know. 

However, codes do not only play an important role between people: computers cannot exchange information without codes, neither with people nor with each other. Codes that are used or understood by computers must be particularly clear and unambiguous to avoid misunderstandings. For this reason, many codes are designed in such a way that errors, e.g. caused by a fault during transmission, can be detected. There are even error-detecting codes that can correct certain errors. 

How do computers communicate? 


If you want to "communicate" with the help of microcontrollers, you first have to convert the information (messages) into data that the microcontroller should transmit. The message can be just about anything: a text, an image, music, speech. This information must be encoded for transmission. To do this, the sender and receiver must agree on a coding that they both know - in practice, technical standards ensure this. 

The data stream resulting from the coding can then be transmitted via sounds (sound waves), visible signs, electrical currents in a cable, as light pulses in a fiber optic connection or as an electromagnetic wave "through the air". The flag signals at an airport, siren signals or a fire alarm, emails, chats, telephone conversations, video conferences, smartphone navigation - all of these are examples of communication of information represented in an agreed coding.

Wie funktionieren Barcodes? 

Ein Barcode ist ein „Balkencode“ oder Strichcode, der aus schwarzen und weißen senkrechten Balken verschiedener Breite besteht. Barcodes zählen zu den eindimensionalen Codes, da die Information allein in der Breite der Balken enthalten ist (bspw. schmaler Balken = „0“, breiter Balken = „1“). Die Farbe der Balken (s/w) dient allein deren Unterscheidung. Barcodes sind „optische Codes“, d. h. sie können von einem Sensor, der „hell“ und „dunkel“ unterscheiden kann, oder von einer Kamera mit Bildauswertung gelesen werden. Barcodes werden überwiegend zur Kennzeichnung von Objekten verwendet; man findet sie z. B. auf Büchern und Zeitschriften (ISBN/ISSN), auf Waren-Etiketten oder Aufklebern für die Paketpost. Es gibt sehr viele unterschiedliche Barcodes, die sich durch ihre Informationsdichte und durch die verwendeten Prüfziffern unterscheiden. Barcodes haben den Vorteil, dass sie sehr robust sind und leicht eingelesen werden können; auch sind die Lesegeräte sehr günstig. 

Ein typischer Barcode ist der Code 39. Er wurde bereits 1973 bei der Fa. Intermec entwickelt und inzwischen von diversen Normungs-Organisationen (darunter ANSI und ISO) in Spezifikationen bzw. Normen festgelegt (u. a. der ISO/IEC 16388). Ein Code-39-Zeichen besteht aus neun Balken – fünf schwarzen und vier weißen (den Zwischenräumen) – in zwei verschiedenen Breiten. Dabei steht ein breiter Balken für eine „1“ und ein schmaler für eine „0“; ein Code-39-Zeichen entspricht also einer neunstelligen Binärzahl.  

Vor und hinter jedem Zeichen folgt ein (schmaler) weißer Zwischenraum, damit man die einzelnen Zeichen unterscheiden kann. Code-39-Barcodes sind immer gleich breit, denn die Anzahl der breiten Balken je Zeichen ist auf genau drei festgelegt: zwei schwarze und ein weißer. Ein Code-39-Zeichen besteht also immer aus sechs schmalen und drei breiten Balken, oder sechs „0“-en und drei „1“-en. Der Code-39-Standard definiert insgesamt 44 Zeichen: die 26 Buchstaben des Alphabets, die zehn Ziffern „0“ bis „9“ und die acht Sonderzeichen „*“ (Start-/Stoppzeichen), Leerzeichen, „-“, „+“, „.“, „/“, „%“ und „$“.

Eine Weiterentwicklung der Barcodes sind QR-Codes, die aus Punkten auf einer quadratischen Fläche bestehen. Sie zählen zu den zweidimensionalen Codes und erfordern eine Kamera zum Einlesen und Dekodieren. 

What is Morse code? 


One of the first "technical" codes used to make characters readable by machines was Morse code, developed in 1838 by Alfred Vail (1807-1859), an employee of Samuel Morse (1791-1872), and standardized for the first time in 1865. Morse code represents numbers and the letters of the alphabet as different sequences of short ("Dit") and long ("Dah") signals. It can therefore be used not only for electrical telegraphy, but also for other signals such as light signals, tones or dashes of two different lengths and is therefore completely independent of the transmission technology. 

The coding of the letters of the alphabet is shown in the following code tree. 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". The characters of the code are therefore of different lengths.

Morse code therefore has another very valuable property: it is very efficient because it uses short signal sequences for frequently used letters and longer ones for rare ones, thus partially compensating for the redundancy of natural languages.  

The length of a "dah" corresponds to the length of three "dits". A pause of one "Dit" is sent between two symbols, a pause of three "Dit" between two letters of a word, and a pause of seven "Dit" between two words. The transmission speed is determined by the length of a "Dit". 

How does the RGB color code work?

The RGB code is a three-byte coding of the color components R (red), G (green) and B (blue, each from 0-255) in a hue. The color tone (hue) can be determined from an RGB value as follows:

  • Determine the maximum Max:=max(R, G, B) and the minimum Min:=min(R, G, B)
  • Calculate the difference Diff:=Max-Min
  • If 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
  • Color wheel angle: Angle := Hue - 360°

The result is the angle at which this color lies in the color wheel (see illustration). 

What is redundancy? 


In information theory, redundancy refers to data that can be omitted without loss of information. A code is redundant if it requires more bits than the minimum required to represent the various characters. If all characters of the code are the same length, the number of additional bits of the code that are not actually required for the representation of information indicates its redundancy. For example, if we want to encode a simple 1/0 signal, we only need one bit. However, if we encode the signal with the digits "1" and "0" (as ASCII characters), our code requires eight bits. The coding therefore has a redundancy of seven (bits):

Redundancy = log₂ (number of possible code words/number of characters to be encoded)

In our example, the redundancy is therefore log₂ (2⁸/2) = log₂ (2⁷) = 7. 

 

How does encryption work?


Data encryption (also known as ciphering) is used to keep the content of a message secret between the sender and recipient and to effectively prevent unauthorized persons from "reading" it. To this end, encryption methods are used that "change" the message in a way agreed between the sender and recipient. As far as possible, it is not the encryption method itself that is kept secret, but only a key known only to the sender and recipient ("Kerkhoff principle"). In most cases, the characters of the message are replaced (substituted) or swapped (permuted).  

In the past, simple substitution ciphers were mainly used. One of the best-known methods is the so-called "Caesar cipher". This involves "shifting" the letters of the message to be transmitted in the alphabet by a fixed number of digits (the key). For example, with the key "3", an "A" becomes a "D", a "B" becomes an "E" and so on, until a "Z" finally becomes a "C". Decryption at the recipient's end is exactly the opposite. 

Caesar encryption is easy to crack because the frequency distribution of the letters in a natural language is not changed by the encryption: In a longer text, the most frequent letter by far is "E". If you know the most frequent letter of the encrypted text, you know how many places you have to "shift" the alphabet in order to decrypt the overheard text.  

In addition, there are only 25 different ways to shift the letters in the alphabet: That is a very small number of possible keys. You could therefore try out different shifts until a meaningful text emerges during decryption. 

A cipher published by Blaise de Vigenère (1523-1596) in 1586, in which the characters of the message are not all shifted by the same number of places in the alphabet, but according to a predetermined scheme, is much more difficult to crack. For example, the key "1 5 12 4 8 7 11" means that the first character of the message is shifted by one place, the second by five, the third by 12 and so on, and finally the seventh by 11 places in the alphabet. The eighth character is shifted again by one, the ninth by five and so on. The Vigenère encryption method was considered unbreakable for almost three hundred years.

The key is often not represented by a sequence of numbers, but by the corresponding letters of the alphabet - in the example above by "AELDHGK". This also makes it much easier to program the replacement of the characters (by "adding" the positions in the alphabet). 

What is a controller? 


In contrast to a microcontroller control, in which an actuator is set to a predefined value (e.g. an LED to a brightness value or an encoder motor to a specific position), a controller automatically ensures that a target value is maintained even in the event of faults (e.g. a track follower continues to follow the track even in a curve). 

To do this, the controller requires a "feedback" mechanism that informs it if there are deviations from the specified reference variable. A controller can be represented schematically as shown in the following diagram: 

If the controlled variable deviates from the reference variable (the specification), the controller corrects by changing a manipulated variable in order to reduce the deviation. If, for example, the number of revolutions of a motor-driven axis per time unit is to be kept constant even under a changing load, the revolutions must be measured and the motor voltage increased or decreased in the event of deviations.

With closed-loop control, there are various ways in which the deviation is incorporated into the change in the manipulated variable: In the case of a proportional controller (also P-controller), for example, the correction is made in proportion to the magnitude of the deviation. If the controller overshoots, i.e. if a delayed effect of the control causes the correction to take too long, the control can be damped with an additional differential element (also known as a D-element), which takes the change in deviation into account. This strengthens the control in the event of a sudden strong disturbance and weakens the control in the event of a rapid decrease in the deviation.

An integrating controller (I-controller or I-element) also takes the duration of the deviation into account by incorporating the sum of the measured deviations into the correction and thus accelerating the approach to the desired value.

When designing a suitable controller, the greatest challenge is determining the factors by which the values to be included in the control (deviation, change in deviation, sum of deviations) must be multiplied in order to achieve the desired control effect. It is often achieved most quickly by experimentation. Usually, you start by determining the factor for the P element and select it in such a way that the controller is not oscillating (i.e. the overshoot decreases). Then you add the factor for the D element and start with a very small factor, which you slowly increase until the transient response to the reference variable is fast enough. 

With the I-member, it is important to ensure that the values of the deviations are not permanently added together (e.g. only a limited number of past deviations are taken into account or the old total value is reduced, e.g. divided by a constant value, before the next deviation is added), as otherwise the I-member will very quickly dominate the P and I components.

A controller with P, D and I components is also referred to as a PID controller. 

Download the ROBO Pro Coding App

Before you can get started, you need to download the ROBO Pro Coding App. Simply select the appropriate operating system and click on the link:

Download

 

Download Voice Control

Tell the robot where to go! Simply download our Voice Control app and give the robot individual commands:

Download

 
cd-blue-c6785f99-b6bsb