Embedded Systems Coursework Assignment
This resit coursework assignment consists of an individual report on four sets of exercises related to the modelling, design, and analysis of embedded and cyber-physical systems. The exercises require an understanding of the module lecture notes and laboratory sheets. Your report should be neatly formatted in four sections with a maximum word count of 3500 words.
Exercises
Note: These do not require practical use of the Elisa robots and do not require you to execute any C code.
- Programming
- LED flasher [25 marks]
Morse code is a method of transmitting letters as a series of short dots and long dots (dashes); it was vital for communication in the 19th and 20th centuries since it could be sent over telegraph wires or using signalling lights. Figure 1 summarises the Morse code and its basic rules:
As indicated in the figure, the length of a dot is one unit, the length of a dash is three units, the space between the dots and dashes in a letter/digit is one unit, the space between letters/digits is three units and the space between words is seven units.
Assume you have an Arduino Uno (Microcontroller ATmega328P) connected to an LED at pin 13, see Figure 2.
Write an Arduino C program that makes the LED flash a single ‘word’ consisting of your personal examination candidate number(a five or six number code) 100 times using Morse code. The time interval between each repetition of your candidate number ‘word’ should be seven units.
Your code should be functional, simple and readable with correct syntax.
- Traffic light controller 1 [5 marks]
The extended finite-state machine in Figure 3 models a pedestrian crossing light.
Explain its operation.
- Traffic light controller 2 [10 marks]
The extended finite-state machine in Figure 4 models a traffic light controller for cars at a pedestrian crossing, as discussed in Example 3.9 of Lee and Seshia (pp. 62-63).
Example 3.9 of Lee and Seshia (pp. 62-63): see next two pages
This machine is time triggered and reacts once per second. It starts in the red state and counts 60 seconds with the help of the variable count. It then transitions to green, where the machine will remain until the pure input pedestrian is present. That input could be generated, for example, by a pedestrian pushing a button to request a walk light. When pedestrian is present, the machine transitions to yellow if it has been in state green for at least 60 seconds. Otherwise, it transitions to pending, where it stays for the remainder of the 60 second interval. This ensures that once the light goes green, it stays green for at least 60 seconds. At the end of 60 seconds, it will transition to yellow, where it will remain for 5 seconds before transitioning back to red. This traffic light is the light for cars, not the light for the pedestrian.
The outputs produced by this machine are sigG to turn on the green light, sigY to change the light to yellow, and sigR to change the light to red.
Assume you have an Arduino Uno (Microcontroller ATmega328P) connected to three LEDs (pin 2: Red, pin 3: Yellow, pin 4: Green) and a pedestrian push button (pin 5) as shown in Figure 5.
Write an Arduino C program that implements the function of this traffic light controller as described. Your code should be functional, simple, and readable with correct syntax.
- Finite-state machines [15 marks]
A mopping robot usually operates on a two dimensional surface of unknown shape and needs to cover it completely. Assume you are asked to make a mopping robot based on the Elisa robot described in the laboratory sheets used for your software project. Assume that this mopping robot works following the strategy described as an exhaustive walk.
Exhaustive walk
In exhaustive walk, the Elisa-based mopping robot performs firstly a horizontal scanning, and then, when it has no more possibilities to continue, it performs a vertical scanning. The robot stops when the vertical scanning cannot progress anymore. A possible trajectory of an exploration by exhaustive walk is shown in Figure 6.
Produce a detailed finite-state machine (pictorial representation) of your solution. Describe its operation and components. Could you identify a surface that your Elisa-based mopping robot cannot cover completely? Do you think the exhaustive walk algorithm is efficient in terms ofsurface coverage?
- Timed automaton and pseudocode [10 marks]
This exercise is based on Example 4.8 of Lee and Seshia (pp. 95-100). The PDF of this book is available in the reference list under ‘Course information’ on the Study Direct site.
Assume the supervisory controller of an automated guided vehicle (AGV) that moves along a closed track painted on a warehouse or factory floor is modelled as the timed automaton with four modes shown in Figure 7.
Underneath this particular AGV there is an array of photodiodes perpendicular to its body axis. When the AGV passes over the track, the diode directly above the track generates more current than the other diodes. By comparing the magnitudes of the currents through the different diodes, the sensor estimates the displacement of the centre of the array from the track. Read example 4.8 carefully to understand all details of this timed automaton and the AGV.
Write a complete C-like pseudocode, with proper comments, of the supervisory controller described. The time derivatives in the modes can be discretized using a simple backward difference, that is,
- Cyber-physical systems [25 marks]
This exercise requires you to design a cyber-physical system that provides an automatic solution for lawn mowing. Describe your system and detail its hardware architecture explaining its main components. It is not necessary to include specific products in your solution. The following information is provided to guide your design thinking.
In cyber-physical systems, embedded computers and networks monitor and control physical processes in real-time, usually with feedback loops of physical variables that affect and are affected by computations. An example structure of a cyber-physical system is shown in Figure 8.
There are three main parts in the above structure. First, the physical plant is the “physical” part of a cyber-physical system. It is simply that part of the system that is not realized with computers or digital networks. It can include mechanical parts, biological or chemical processes, or human operators. Second, there are one or more computational platforms, which consist of sensors, actuators, one or more computers, and (possibly) one or more operating systems. Third, there is a network fabric, which provides the mechanisms for the computers to communicate. Together, the platforms and the network fabric form the “cyber” part of the cyber-physical system.
An illustration of hardware architecture of a cyber-physical system is shown in Figure 9. It corresponds to the architecture of the STARMAC, a small quadrotor aircraft whose primary purpose is to serve as a testbed for experimenting with multi-vehicle autonomous control techniques.
Presentation [10 marks]
Present your report on these four exercises clearly, in labelled sections, using a correct technical writing style and with code and pseudo-code listed correctly and commented.