G7 SB - Embedded Systems - Student Book PDF
Document Details
Uploaded by ScenicAltoFlute
Tags
Summary
This document is a student book focused on embedded systems. It covers topics such as cyberbullying, microcontroller functions, and component usage within a larger system. It gives an overview of embedded systems and how they work using practical examples, and includes suggested activities for students.
Full Transcript
Copyright © Ministry of Education – United Arab Emirates 48 G7-Student book UNIT 2...
Copyright © Ministry of Education – United Arab Emirates 48 G7-Student book UNIT 2 Embedded Systems G7-Student book E-safety Cyberbullying Cyberbullying is sending someone hurtful messages online. Sharing someone’s information such as personal information or pictures, without them knowing is also cyberbullying. It is harmful and stressful for the victims. ing RUMORS as te ins sip ing gos ults threat s CYBER BULLYING LIES name- mentca lling mea harass nw ords If someone is cyberbullying you, you must tell your parents, teacher or other responsible adult. Copyright © Ministry of Education – United Arab Emirates The Cyber Crime Laws in the UAE make cyberbullying illegal. Anyone caught cyberbullying in the UAE can face fines of up to AED 500,000 and/or time in prison. These laws help to make the internet a safer place for technology users. ac ter tiv In Activity 1 e 49 G7-Student book Overview In this unit, students will build upon their existing knowledge of embedded systems. They will begin by reviewing embedded systems. They will progress by examining how microcontrollers in embedded systems receive and send data/signals between other components and devices. Students will further develop their practical skills by selecting and using a range of components to build an embedded system. Students will also apply knowledge and skills to troubleshoot the hardware configuration and the software settings and programs to ensure an embedded system works appropriately. Copyright © Ministry of Education – United Arab Emirates 50 G7-Student book Keywords Term Definition Image information that is stored data in and used by a computer system a computer based system embedded with hardware and software system for specific functions within a larger system a tiny programmable computer; often embedded microcontroller in electrical devices to control them the methods used to move data between components signalling within systems or data between networked systems Copyright © Ministry of Education – United Arab Emirates troubleshooting the methods used to solve strategies computer problems 51 G7-Student book Learning outcomes 2.1. Examine how microcontrollers receive and send data/signals. 2.2. Use different components with a microcontroller to build a system. 2.3. Troubleshoot the built embedded system to work appropriately. Copyright © Ministry of Education – United Arab Emirates 52 G7-Student book Embedded systems You have learned about embedded systems before. Remember, embedded systems are computer systems with hardware and software to control and/or monitor a specific task or function within a larger system. For example, a specific task in an air conditioner system could be monitoring the temperature of an environment. To embed something means to place it within something else, that’s why they are known as embedded systems. It has been estimated that ninety-eight percent of all microprocessors manufactured are used within embedded systems. Like all computer systems, embedded systems work by processing inputs and producing outputs, embedded systems do this to control the features or actions of the system. These systems have many potential Copyright © Ministry of Education – United Arab Emirates applications and may work independently or be used to perform a small part of a function within the larger system. The complexity of each embedded system varies depending on its purpose. A system can have hardware ranging from a single microcontroller with limited functionality to a suite of processors with connected peripherals and communication. A system can also range from not including a user interface to having a complex graphical user interface. 53 G7-Student book These systems are very common in the devices we use in our daily lives. Some applications of embedded system applications include digital watches, microwave ovens, hybrid vehicles and aircraft. ac ter tiv In Activity 2 e Microcontrollers You have learned about microcontrollers before. Remember, microcontrollers are tiny programmable computers. A microcontroller includes four main parts for computer processing: ~ Central Processing Unit (CPU) ~ Random Access Memory (RAM) ~ Read Only Memory (ROM) Copyright © Ministry of Education – United Arab Emirates ~ Input/output ports. 54 G7-Student book Microcontrollers are often used in embedded systems to process the inputs and produce outputs to control the features or actions of the system. Unlike personal computers which can do different tasks at the same time, a microcontroller can only do one task at a time. Often this is a dedicated function or task in an embedded system using a specific program with programming instructions that do not change. Some large systems may include many embedded systems that use a range of microcontrollers for different functions. Some examples of large systems include hybrid vehicles and aircraft. You will also find microcontrollers in many common smart devices and in IOT applications. DID YOU KNOW? IoT is an acronym for Internet of Things. IoT enabled devices are embedded with sensors, software, and other technology to communicate and exchange data. The most common use of IoT is smart home implementation. Smart homes use many IoT enabled devices and appliances such as smart lighting, thermostats, security systems and white goods. Copyright © Ministry of Education – United Arab Emirates 55 G7-Student book To create your own embedded systems, you could use an educational microcontroller board to process the inputs and produce outputs to control the features, components or actions of the system. Educational microcontroller boards include the main parts for processing along with built in components that can be used for inputs and outputs. Some examples of educational microcontroller boards are: Name Image Arduino Uno BBC Micro:bit Ibtikar Maker Copyright © Ministry of Education – United Arab Emirates 56 G7-Student book Components You have learned about components before. Remember, electronic devices and systems have components. These components are used for inputs or outputs. Components can be single parts or built into things like embedded systems. You already know that some microcontroller boards have built in components. An educational electronics kit has many components in single parts. In electronics kits the components are also called modules. To create your own embedded systems, you could use components from an electronics kit for inputs and outputs and program a microcontroller to use and control them. Here is an example of an educational electronics kit: Copyright © Ministry of Education – United Arab Emirates 57 G7-Student book Input components Input components can be used to input data to a microcontroller for processing. Some examples of input components include: Signal Name Description Example type Ambient light Measures the ambient Analogue sensor light around it. Used as a way to Push button input a single value or Digital command from a user. Used as a way to input Analogue Rotation sensor a range of values from or Digital a user. Copyright © Ministry of Education – United Arab Emirates 58 G7-Student book Output components Output components can be used to output data or control signals from a microcontroller after processing. Some examples of input components include: Name Description Signal Type Example Used to output a Buzzer Digital range of sounds. Light emitting Used to output Digital diode (LED) light. Used to output Servomotor Analogue movement. Copyright © Ministry of Education – United Arab Emirates Lab Activity 3 59 G7-Student book Data Signaling Electronic devices such as microcontrollers and computers communicate with other devices and component using electronic data signals. There are two methods of sending and receiving electronic data signals, these are analogue signals and digital signals. Digital signals Microcontrollers and computers are digital devices. This means they can communicate easily with other devices and components that use digital signals. A digital signal is an electrical signal that sends and receives information using binary digits. Binary digits are the smallest unit of data in devices. A binary digit represents single digital values in different ways: Binary Digital Boolean Electronic bit representation representation representation 0 OFF FALSE 0 volts 1 ON TRUE 5 volts Analogue signals Analogue signals contain more information than digital signals. They can use many numbers to represent their values. Analogue devices Copyright © Ministry of Education – United Arab Emirates and components cannot communicate as easily with digital devices. This diagram shows an analogue signal (red line) and how it can be represented using digital values (blue line): 111 110 101 100 011 010 001 000 60 G7-Student book To input data from an analogue device or component, computers and microcontrollers use analogue to digital converters (ADC). These devices convert analogue signals to digital values that a computer or microcontroller can use. However, in some cases digital devices do not have ADC converters. In such cases an analogue input component could be connected to the system with a separate ADC component. This diagram shows how an analogue input component could be connected to a digital device using a separate ADC component: Digital device ADC component Analogue input component To output data to an analogue device or component a microcontroller or computer can use a digital to analogue converter (DAC). These devices Copyright © Ministry of Education – United Arab Emirates convert digital values to analogue signals that can be used by analogue devices and components. However, in some cases digital devices do not have DAC converters. In such cases some devices and microcontrollers use pulse width modulators (PWM) to generate analogue signals. You will learn more about pulse width modulators in your future studies. ac ac ter tiv ter tiv In In Activity 4 Activity 5 e e 61 G7-Student book Breadboards and expansion shields Breadboards and expansion shields can be used to connect microcontrollers and other electronic components together without wire crimping or soldering. This can allow microcontrollers to communicate with other components using data signalling. Breadboards and expansion shields are also used to supply electrical power to the components. Name Image Description A breadboard is a board with holes. Electronic components and devices can be connected Breadboard to the board via the holes using wires. These can be used to test programs and circuits. An expansion shield connects directly to a microcontroller Expansion or minicomputer. They often shield include header pins to connect other components using wires. This diagram shows how a microcontroller board and components can be connected using a breadboard or expansion shield. Copyright © Ministry of Education – United Arab Emirates Microcontroller Breadboard or Power Expanshion supply shield Input Output components components 62 G7-Student book Most components are connected by using three wires. Traditionally, you would use colour coded wires: ~ a red wire to supply electrical power ~ a black wire for grounding ~ a yellow wire for data signalling DID YOU KNOW? The colour of the wires is not important. You can connect components use wires of any colour as long as they are connected properly for power, ground and data signalling. Copyright © Ministry of Education – United Arab Emirates 63 G7-Student book Building embedded systems To build an embedded system you could start by selecting the required components for the task or function, then connect them to a microcontroller board using a breadboard or expansion shield. Here is an example showing a servomotor component connected to a microcontroller using an expansion shield: After connecting the physical parts of the system, you could create a program for the microcontroller board to process the inputs and produce outputs to control the features, components or actions of the system. Incorporating existing code You have learned about incorporating existing code before. Remember programmers often use existing Copyright © Ministry of Education – United Arab Emirates code within new programming projects. This is efficient compared to re-writing commands for similar procedures or tasks. Programming libraries are collections of pre-programmed commands, procedures and modules that can be incorporated IBSerial.py into programs. A microcontroller does not have the hardware required to run text- based computer programs. However, you can create a text-based program using a communication library to communicate with and 64 G7-Student book control a microcontroller and connected components. Assuming the microcontroller has been pre-programmed for communication. One example of a communication library is IBSerial. Here is an example program that uses a communication library to communicate with and control a microcontroller and a connected LED component: 1. # Arduion sketch «Serialmaker.ino» must be uploaded # first to configure the microcontroller for communication 2. import time Import the 3. from IBSerial import * communication library 4. import IBSerial as IBMaker 5. IBMaker.Open_port(“COM3“,“115200“) Configure 6. IBMaker.PinMAP(“MAKER“) communication setting 7. IBMaker.begin(“V0.00“) 8. LED = 9 Configure the pin used to 9. pinMode(LED,OUTPUT) connect an LED component 10. digitalWrite(LED,HIGH) Command to turn on the LED component 11. time.sleep(20) 12. digitalWrite(LED,LOW) Command to turn off the LED component 13. IBMaker.Close_Port() In this example: ~ Lines 2-4 of the program import the communication library. ~ Lines 5-7 configure communication settings. ~ Lines 8-9 configure the pin used to connect an LED component. Copyright © Ministry of Education – United Arab Emirates ~ Line 10 uses a digital.write command to turn on the LED component. ~ Line 12 uses a digital.write command to turn off the LED component. Lab Lab Activity 6 Activity 7 65 G7-Student book Smart lighting mini project The school principal has asked you to create a smart lighting system to improve school energy efficiency. This mini project will let you show your skills with microcontrollers, components, programming structures and incorporating existing code to build and program an embedded system. A smart lighting system is an embedded system that uses an ambient light sensor to monitor the light in a classroom. It will process the information from the light sensor and turn on an LED light when the classroom does not have adequate natural lighting. Copyright © Ministry of Education – United Arab Emirates o The ry Activity 8 Lab Activity 9 66 G7-Student book Troubleshooting embedded systems You have learned about troubleshooting before. Remember, troubleshooting is a term used to describe the strategies and methods that you can implement to solve computer system problems. Embedded systems are a type of computer system that can have a range of problems that can stop them from working appropriately. If you are experiencing a problem with an embedded system, you may be able to find out what the problem is using the process of elimination this is also known as trial and error. You can do this by making a list of potential causes for the problem them eliminate them out one by one by trying known solutions. Copyright © Ministry of Education – United Arab Emirates 67 G7-Student book Here are some examples of embedded system problems and troubleshooting strategies that could potentially solve these problems: Problem/ Causes Solutions Symptoms Cause 1: Microcontroller Solution 1: Connect the is not connected to the microcontroller to the Program computer computer communication Cause 2: The wrong com Solution 2: Correct com error. port has been configured port number used in the in the program. program. Cause 1: Microcontroller Solution 1: Configure has not been configured the microcontroller for No reaction from for communication communication. the system. Cause 2: Microcontroller Solution 2: Replace board has developed a microcontroller board. fault Cause 1: The component Cause 1: Connected the has not been connected component to the system to the system correctly correctly (power, ground, A component is (power, ground, communication) not working. communication) Solution 2: Correct the Cause 2: The wrong pin pin number used in the has been configured in program. the program. Cause 1: The program has The system is Solution 1: Correct the a logical error such as working but not programming commands incorrect commands or as expected. or operators. Copyright © Ministry of Education – United Arab Emirates operators. o The ry Activity 10 68 G7-Student book Unit 2 summary In this unit, you: ~ Reviewed fundamentals of embedded systems. ~ Examined how microcontrollers receive and send data/signals. ~ Used different components with a microcontroller to build a system. ~ Performed troubleshooting for an embedded system to make it work appropriately. o The ry Activity 11 ac ter tiv In Activity 12 e Copyright © Ministry of Education – United Arab Emirates 69