kramann.info
© Guido Kramann

Login: Passwort:










kramann.info
© Guido Kramann

Login: Passwort:




Development of Fault Tolerant Software for Embedded Realtime Systems, winter semester 2025/26

(EN google-translate)

(PL google-translate)


Start of the course: 9:00 a.m.


  • Tasks for those who arrive early:
  • Download the course text and read it.
  • Learn how to log in to the PCs in the lab.
  • Take a look at processing.org and try out some examples on the PCs running Linux.
  • Aufgaben für alle, die früher da sind:
  • Laden Sie sich den Text beim Kurs herunter und lesen ihn.
  • Lernen Sie, wie Sie sich auf den PCs im Labor einloggen können.
  • Schauen Sie sich processing.org an und probieren Beispiele auf den PCs unter Linux aus.
  • student group: 1 ME
  • Here at "day by day," the content covered is noted chronologically over the course of the semester.
  • In most cases, links are provided within kramann.info where the respective material is presented.
  • For your reference, you will also find the "day by day" for the same course from the previous year on kramann.info.
  • The examination in this subject takes place throughout the semester and consists of a project that is presented at the end of the semester.

Wednesday, September 24, 2025

Topics today

  1. Organizational matters
  2. Why do malfunctions occur in Western technology in the first place -- an anthropological perspective
  3. Introduction to the topic of fault tolerance
  4. Introduction to the terms "fault," "error," and "failure"
  5. Introduction to the term "mitigation"
  6. Examples of "mitigation" in modern technology
  7. Division into groups of two
  8. Scheduling appointments for presentations on fault tolerance patterns
  9. Practical application: Smart Watch
  10. Discussion of possible areas in the Smart Watch where fault tolerance can play a role
  1. Organisatorisches
  2. Warum ergeben sich überhaupt Funktionsstörungen bei der abendländischen Technik -- eine anthropologische Betrachtung
  3. Einführung in das Thema Fehlertoleranz
  4. Einführung der Begriffe "fault", "error" und "failure"
  5. Einführung des Begriffs "mitigation"
  6. Beispiele für "mitigation" in der modernen Technik
  7. Gruppenaufteilung in Zweiergruppen
  8. Terminvereinbarungen für die Präsentationen der Fehlertoleranz Muster
  9. Praktische Anwendung: Smart Watch
  10. Diskussion zu möglichen Bereichen bei der Smart Watch, bei denen Fehlertoleranz eine Rolle spielen kann
  11. Vorübungen mit Java/Processing
  12. Einführung in die Entwicklungsumgebung von Processing

1. Organizational matters

  • The exam takes place throughout the semester and consists of a theoretical presentation, a project assignment, and the presentation of the project assignment at the end of the lecture period.
  • Students are to work in pairs.
  • A group list will be circulated for registration.
  • A fault tolerance pattern will be presented in the theoretical presentation.
  • In the project work, a smart watch will be programmed and at least two fault tolerance patterns will be applied during implementation.
  • In the first half of the semester, introductory projects will be carried out together with the smart watch and the basics will be worked out.
  • From the second half of the semester onwards, work on the projects will mainly take place independently in the groups.
  • Work on the projects will take place during regular class time.
  • The final project presentation must represent what has been developed during the semester as seen by the lecturer.
  • The project part of the exam counts for 80 percent, and the theoretical presentation of a pattern counts for 20 percent of the overall grade.
  • Die Prüfung ist semesterbegleitend und besteht aus einer theoretischen Präsentation, einer Projektarbeit und der Präsentation der Projektarbeit am Ende der Vorlesungszeit.
  • Es soll dazu in Zweiergruppen gearbeitet werden.
  • Eine Gruppenliste zum Eintragen wird herumgegeben.
  • In der theoretischen Präsentation wird ein Fehlertoleranz Muster vorgestellt.
  • In der Projektarbeit wird eine Smart Watch programmiert und mindestens zwei Fehlertoleranz Muster bei der Umsetzung angewendet.
  • In der ersten Semesterhälfte werden gemeinsam Einführungsprojekte mit der Smart Watch durchgeführt und die Grundlagen erarbeitet.
  • Ab der zweiten Semesterhälfte finden hauptsächlich die Arbeiten an den Projekten selbstständig in den Gruppen statt.
  • Die Arbeit an den Projekten erfolgt innerhalb der regulären Unterrichtszeit.
  • Die abschließende Projektpräsentation muss das repräsentieren, was für den Dozenten sichtbar während des Semesters erarbeitet wurde.
  • Der Projektteil der Prüfung zählt 80 Prozent, die theoretische Präsentation eines Pattern zählt 20 Prozent der Gesamtnote.

2. Why do malfunctions occur in Western technology in the first place -- an anthropological perspective

I would like to help you understand what makes Western technology so special. I would like to work with you to identify the strengths and, if they exist, the fundamental weaknesses of Western technology. One way to do this is through comparison. Technical anthropology is a science that compares technologies from different cultures.

Heßler, M., Liggieri, K.: Technikanthropologie: Handbuch für Wissenschaft und Studium, Nomos, Baden-Baden 2020.

Code 0-1: Literatur zu Technikanthropologie

As an example, I will use ship navigation in the following.


Marianne George (2012) Polynesian Navigation and Te Lapa -- "The Flashing", Time and Mind: The Journal of Archaeology, Consciousness and Culture, 5:2, 135-173, aufgerufen: 22.09.2025, url: https://www.researchgate.net/publication/261594890_Polynesian_Navigation_and_Te_Lapa-_The_Flashing

Example: Boatbuilding in Taumako, documentary film by Michael Tauchert.

mitropico.com/filter/Reihe-Magische-Welten-ZDF/Polynesien-Nomaden-der-Sudsee

Visual documentation

vaka.org -- Taumako Projekt

Navigation with Te Puke Booten -- Dr. Mimi George

https://www.vaka.org/blog/categories/navigation
ÜBUNG
  • Discuss the difference between Western technology, with which you are familiar, and the Polynesian art of boat building and navigation.
  • The Polynesian islands were colonized by various European countries until the 1950s.
  • Consider the advantages and disadvantages of the different types of technology, as represented on the one hand by Polynesian navigation and boatbuilding and on the other by their Western counterparts today.
  • Living with technology: Consider the two types of technology in terms of everyday life. Categories such as happiness and satisfaction are rarely discussed in a technological context, but ultimately, the technologization of the world should have this as its goal. So what is the situation here?
Wave interference pattern caused by an island. Kenneth Lohmann und Graeme C Hays: Goal Navigation and Island-Finding in Sea Turtles, Journal of Experimental Marine Biology and Ecology 356(1-2):83-95 DOI:10.1016/j.jembe.2007.12.017, url: https://www.researchgate.net/publication/222699397_Goal_Navigation_and_Island-Finding_in_Sea_Turtles
see also: https://de.wikipedia.org/wiki/Polynesische_Navigation#Navigationstechniken
Clock "H5" by John Harrison, ca. 1770: https://de.wikipedia.org/wiki/John_Harrison_(Uhrmacher)

3. Introduction to the topic of fault tolerance

81_FTSD/01_Fehlertoleranz

4. Introduction to the terms "fault," "error," and "failure"

Exercise
  1. Describe the concepts of "fault", "error" and "failure".

5. Introduction to the term "mitigation"

6. Examples of "mitigation" in modern technology

Exercise
  1. Group exercise: Find examples of where modern technology automatically mitigates the effects of errors that occur.

7. Division into groups of two

8. Scheduling appointments for presentations on fault tolerance patterns

9. Practical application: Smart Watch

T-Watch 2020 V3 from Lilygo.

Bild 0-1: T-Watch 2020 V3 from Lilygo.

  • We will be working with a T-Watch 2020 V3.
  • This will be done within the Arduino development environment.

These are peripherals that can be controlled by programming on the watch:

  1. Display
  2. Touch
  3. IMU (Inertia Measurement Unit)
  4. RTC (Real Time Clock)
  5. WiFi
  6. Bluetooth
  7. Button
  8. Vibration
  9. Mikrophone
  10. Loudspeaker
Programming examples: https://youtu.be/xQJAm8CVC_4
T-WATCH send Acceleration to Laptop via WiFi: https://youtu.be/rJJumsD5vB8

  • So you have a whole list of components that only make sense as a whole when they are linked together in some way by software.
  • That is exactly what we will be dealing with: linking the internal peripherals of an embedded system together using software to form a useful whole.
"Any sufficiently advanced technology is indistinguishable from magic "

Arthur C. Clarke


...in diesem Sinne:

  1. How could a smartwatch help support your life on this campus?
  2. Which of the internal peripherals listed above would be used in the application you have proposed?
  3. Which externally available infrastructure would be used by your newly created system?
  4. What disruptions could occur during the interaction of the smartwatch with its environment and the surrounding infrastructure?
  5. What measures could be taken to minimize the impact of the identified potential disruptions?

Corresponding links, see:


Purchase from Lilygo: https://lilygo.cc/products/t-watch-2020-v3

TTGO_TWatch_Library V1.4.3: https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library


necessary: esp32 Board Library 2.09 (exactly this one!)


10. Discussion of possible areas in the Smart Watch where fault tolerance can play a role

Wednesday, September 30, 2025

Topics today

  1. Quiz
  2. Overview over fault tolerance pattern
  3. Initial collection of ideas on possible applications for the clock and possible fault tolerance patterns that could be used in this context
  4. Presentation: Hello World-program with T-WATCH
  5. Preliminary exercises with Java/Processing
  6. Introduction to the Processing development environment
  7. Presentation: Starting with T-WATCH
  8. Exercise: Hello World-program with T-WATCH

1. Quiz

Define the terms "fault," "error," and "failure"

2. Initial collection of ideas on possible applications for the clock and possible fault tolerance patterns that could be used in this context




DAILY LIFE

   step counter (IMU sensor)
   remote control for TV, radio etc. (infrared data transmitter)

   recognition of too intensive sun exposure (Light intensity sensor)

   using bluetooth to connect to the phone for passing messages

   doing calls using microphone and loudspeaker

   performing alarms by using vibration

   games with distributed users

SPORTS

   compass

MEDICINE

   Reminder for taking medicine / body sensoring ... measurement of level of insuline e.g.
   heart rate monitoring sensor

   rescue system (alarm if no motion)
   rescue system (alarm if to hard motion)

WORK CONTEXTS


Code 0-2: Initial collection of ideas on possible applications for the clock and possible fault tolerance patterns that could be used in this context.

3. Overview: fault tolerance pattern

81_FTSD/01_Fehlertoleranz

4. Presentation: Hello World-program with T-WATCH

5. Preliminary exercises with Java/Processing

36_Java
78_Processing

https://processing.org/

74_EmbSyst/02_Eingebettete_Systeme/03_Android/06_Processing

6. Introduction to the Processing development environment

...will be done on PCs.

7. Presentation: Starting with T-WATCH

07_TWATCH_EN -- english version.
06_TWATCH -- german version.

8. Exercise: Hello World-program with T-WATCH

Follow steps here: 07_TWATCH_EN/03_Hello_world.


Wednesday, October 07, 2025


Topics today

  1. Organization of presentation dates for fault tolerance patterns
  2. Systematic introduction to programming the watch
  3. Small programming tasks for using the screen, touchscreen, button, IMU sensor, and real-time clock.
  4. Small project for an application program using the internal peripherals covered so far

1. Organization of presentation dates for fault tolerance patterns


WEDNESDAY 15.10. 22.10. 29.10. 
          05.11. 12.11. 19,11,
          --------------------
          26.11. 03.12. 10.12.
          17.12.

Code 0-3: Dates for the presentations.

  • Appointments according to the group list

2. Systematic introduction to programming the watch

  1. Basic structure of a C/C++ program
  2. Hello world program, processing in the console
  3. Comparison of standard C programs with program structure for the clock
  4. Declaration and initialization of variables
  5. Variable types
  6. Functions in C/C++
  7. Transfer and return values for functions
  8. Distinction between call by value and call by reference
  9. Classes and objects in C++ and Java
Programs made during the course:
#include <iostream>
using namespace std;
int main(void)
{
    cout<<endl<<"Hello world!"<<endl;
    return 0;
}

Code 0-4: hello.cpp

#include <iostream>
using namespace std;

int x=7; // declaration and initialization == definition
char y='4';
char text[]="My text."; // ends with 0 == ''
int main(void)
{
    cout<<endl<<"Hello world! "<<"x="<<x<<endl;
    cout<<(int)y<<endl;
    cout<<text<<endl;
    cout<<size(text)<<endl;
    return 0;
}

Code 0-5: hello2.cpp (variables)

#include <iostream>
using namespace std;

int mult(int x, int y)
{
   int z = x*y;
   return z;
}

int main(void)
{
    cout<<"4*5="<<mult(4,5)<<endl;
    return 0;
}

Code 0-6: hello3.cpp

#include <iostream>
using namespace std;

bool hasE(char text[])
{
   int index = 0;
text[0]='#';
   while(text[index]!='')
   {
       if(text[index]=='e' || text[index]=='E')
           return true;
       index++;
   }
   return false;
}

int main(void)
{
    char sentence1[] = "This is cool!";
    char sentence2[] = "This is an elephant!";

    cout<<sentence1<<" ..has an e?:"<<hasE(sentence1)<<endl;
    cout<<sentence2<<" ..has an e?:"<<hasE(sentence2)<<endl;
    cout<<sentence1<<endl;
    cout<<sentence2<<endl;

    return 0;
}

Code 0-7: hello4.cpp (call by reference)

#include <iostream>
#include <math.h>
using namespace std;
class Vektor
{
    public:
       double x,y;
   
       double calculateLength()
       {
           return sqrt(x*x+y*y);
       }
}; 
int main(void)
{
    Vektor v1,v2;
    v1.x=3.0;
    v1.y=4.0;
    v2.x=1.0;
    v2.y=0.0;
    double l1 = v1.calculateLength();
    double l2 = v2.calculateLength();
    cout<<"|v1|="<<l1<<endl;
    cout<<"|v2|="<<l2<<endl;
    return 0;
}

Code 0-8: hello5.cpp (explain classes and objects in objectoriented programing)

3. Small programming tasks for using the screen, touchscreen, button, IMU sensor, and real-time clock.

  • The list of simplified commands has been expanded specifically for the internal peripheral elements listed here.
  • To complete the following tasks, refer to the descriptions and examples here:
07_TWATCH_EN/04_Simplified_Commands

Exercise 1: Switsch Background color by pressing the button multiple times between red, green, blue, red, green, blue, red, ... and so on.

#include "twatch.h"
#include "variables.h"
#include "functions.h"
 int state=0;
void setup() 
{
    setupTWATCH();
    backlight(true); 
    
}

void loop() 
{
  
    if(button()) {
      state++;
      if(state > 2){
        state=0;
      }
      switch(state){
        case 0:
        background(255,0,0);
       break;
       case 1:
       background(0,255,0);
       break;
       case 2:
       background(0,0,255);
       break;
      }
    }
    
    
    delay(100);  
}

Code 0-9: Student solution.

Exercise 2: Program a type of water clock. The deviation of the clock from the horizontal position should be visualized graphically by moving a small circle on the display away from the center of the display.

#include "twatch.h"
#include "variables.h"
#include "functions.h"

float skalierung=0.5;
float KreisX=0;
float KreisY=0;
void setup() 
{
    setupTWATCH();
    backlight(true); 
}

void loop() 
{
    bool res = acceleration();

  if(KreisX>240){
    KreisX=240;
  }else if(KreisX<0){
    KreisX=0;
  }else{
    KreisX = 120 - (float)(accY*skalierung);
  }
  if(KreisY>240){
    KreisY=240;
  }else if(KreisY<0){
    KreisY=0;
  }else{
    KreisY = 120 + (float)(accX*skalierung);
  }
  

 fill(0,0,255);
 circle(KreisX,KreisY,20);
    delay(50);
    clear();
    delay(50);
}

Code 0-10: Student solution.

Exercise 3: Program a type of stopwatch. The stopwatch should be accurate to one-hundredth of a second. To do this, analyze in project "TWATCH_PROC023" the "functions.h" tab to find out how to obtain the elapsed time in milliseconds.

4. Small project for an application program using the internal peripherals covered so far

Implement the following project: A warning system should sound an alarm via the vibration motor and a suitable display if the watch is not held horizontally for more than 10 seconds.

Wednesday, October 15, 2025

Topics today

  1. Discussion of useful literature
  2. Analysis of last week's projects
  3. Notes on Internet programming
  4. Data transfer via Wi-Fi
  5. Transferring a Processing sketch to a mobile device
  6. EXERCISE: Implementing an initial fault tolerance concept
  7. Continuing collecting project ideas

1. Discussion of useful literature

The source for fault tolerance patterns is Hanmer's book:

  • Hanmer, R.S., “Patterns for Fault Tolerant Software,” John Wiley & Sons, Weinheim 2007.

To understand how to program an esp32, you can use the relevant programming manuals:

  • Brandes, U., “Mikrocontroller ESP32,” Rheinwerk, Bonn 2020.

It may also be worthwhile to learn more about Processing, as the simplified programming of the clock is based on it:

  • Shiffman, D., “Learning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction,” Morgan Kaufmann, Burlington 2015.

If you also want to use a smartphone as a remote station, the following book is worth reading, as it covers the development of Android apps based on Processing:

  • Sauter, D., “Rapid Android Development,” The Pragmatic Bookshelf, Dallas 2013.

Books of this type can be helpful. It does not necessarily have to be these specific ones. In addition to the THB library, you can also use the TU library (Volkswagen Library) in Berlin, near the bus station/Zoologischer Garten station.

2. Analysis of last week's projects

3. Notes on Internet programming

30_Informatik3/16_Nuetzliches/05_Internetprogrammierung/04_Java

4. Data transfer via Wi-Fi

T-WATCH send Acceleration to Laptop via WiFi: https://youtu.be/rJJumsD5vB8
  • The above example shows a special use of the smartwatch, in which acceleration data from the watch is sent to a PC via Wi-Fi.
  • Since two devices are communicating with each other via radio waves, a number of things can go wrong.
EXERCISE
  • List possible sources of error that may occur when attempting to establish a data connection between the watch and the PC via Wi-Fi.

Concept for establishing a data connection via Wi-Fi

  • The well-known TWATCH_PROC023 project has the ability to send acceleration data to a PC via Wi-Fi.
  • As soon as the button is pressed, it checks whether a Wi-Fi connection is available and, if not, attempts to establish one:
    if(button()) //wird ausgeführt, wenn Knopf gedrückt
    { 
        if(!WIFIOKAY) //Falls WIFi NICHT verfügbar
        {
            setupWIFI(hotspot,password,udpport); //...Verbindungsversuch starten
        }
        ....
     }

Code 0-11: Main tab of project TWATCH_PROC023 from line 227 onwards.

  • Once the WiFi connection is established, the acceleration data is sent to the PC cyclically in MODE No. 2 on the watch:
      case 2: //Acceleration (Switch Anweisung bei MODE 2)
      {
        backlight(true);
        cursor(0,0);
        bool res = acceleration();            //Auslesen der Beschleunigungswerte
        if(WIFIOKAY && udp.listen(UDPPORT))   //Wenn WiFi Verbindung vorhanden und ein Datenpaket vom PC empfangen wird...
        {
            udp.onPacket([](AsyncUDPPacket packet) 
            {
                if(Serial) Serial.write(packet.data(), packet.length());            
                if(Serial) Serial.println();
                packet.printf("accX=%d accY=%d accZ=%d", accX,accY,accZ);  //Übertrage die Beschleunigungsdaten          
            });      
        }
        ...
      }
      ...

Code 0-12: Main tab of project TWATCH_PROC023 from line 110 onwards.

  • The following important data and libraries must be provided in the header of the main tab:
#include "twatch.h"
#include "variables.h"
#include "functions.h"

...

const char* hotspot = "hotspotX";
const char* password = "12345678";
int udpport = 6000;
...


Code 0-13: Main tab of project TWATCH_PROC023 from line 1 onwards.

  • Im setup() wird die Uhr folgendermaßen konfiguriert:
void setup() 
{
    setupTWATCH();
    setupSERIAL(115200);
    setupWIFI(hotspot,password,udpport); Bereits hier wird ein Verbindungsversuch gestartet
    setupMotor();
    //setFont(3);
    //setFont(2,255,55,0,  0,0,0);
    setFont(1, 255,255,255,  255,0,0);
    updateTime(); //RTC Zeit nehmen
    backlight(true); 
}

Code 0-14: Main tab of project TWATCH_PROC023 from line 1 onwards.

PC-side program

  • A processing program is used on the PC side to establish the WiFi connection with the clock.
  • In addition, a hotspot must be provided to which both devices must be connected.
  • PLEASE NOTE: The PCs in the PC pool are not WiFi-enabled. Smartphones or laptops can be used to carry out experiments.
TWATCH_PROC005_hotspot.zip -- Processingsketch für den PC-seitigen Part.
TWATCH_PROC005_hotspot_ANDROID.zip -- Android version of the project.
import hypermedia.net.*;
String IP = "10.42.0.255"; 
int PORT = 6000; //für UDP benötigt.
UDP udp;

String NACHRICHT="";

public void setup()
{
    size(700,500);
    udp = new UDP( this, 6000 );
    udp.listen( true ); 
    frameRate(10);
}

public void draw()
{
    background(255);
    fill(0);
    textSize(20);
    text("Empfangen:",30,30);
    text(NACHRICHT,30,60);     //Nachricht der Uhr ggf. anzeigen.
    
    udp.send("Test", IP, PORT );  //Zyklisch einen "PING" an die Uhr schicken.
}

   void receive( byte[] data, String ip, int port ) //Callback Funktion, die auf hereinkommende Pakete reagiert.
   {  
      // <-- extended handler  
      // get the "real" message =
      // forget the ";
" at the end <-- !!! only for a communication with Pd !!!
      //data = subset(data, 0, data.length-2);
      String x = new String( data );
      if(x!=null && !x.equals("Test"))  //Nachricht der Uhr bereitstellen.
         NACHRICHT = x;
   }     

Code 0-15: Processing sketch for the PC/laptop side.

5. Transferring a processing sketch to a mobile device

6. EXERCISE: Implementing an initial fault tolerance concept

Exercise 1

  • Over the past two weeks, we have discussed small sample programs for various internal peripherals.
  • Write your own sample program related to WiFi.
  • It should consist of the parts discussed above from the TWATCH_PROC023 project.
  • This means you need to reduce the large project to a smaller one that does the following:
  • zip
  • studentischeloesung1.zip
  • studentischeloesung1.zip
  1. Attempt to establish a WiFi connection when the button is pressed.
  2. Display acceleration data on the touchscreen.
  3. Send acceleration data to the PC when the WiFi connection is established.

Exercise 2

  • Instead of establishing the WiFi connection at the touch of a button, the watch should attempt to connect every 10 seconds if no connection is available.
  • Implement this as a variant of the previous program.

Exercise 3

  • Go through the list of error tolerance patterns.
  • Determine whether and, if so, which error tolerance patterns are used in solving task 2.
  • Consider an extension of the program from task 2 in which additional patterns are used.
  • Present your individual variant.

7. Continuing collecting project ideas


...see above:


2. Initial collection of ideas on possible applications for the clock and possible fault tolerance patterns that could be used in this context