0% found this document useful (0 votes)
48 views23 pages

Artificial Intelligence and Programming

The document outlines a series of lessons focused on artificial intelligence and programming, including topics such as types of AI, sensors, robotics, and programming languages like Python and Scratch. Each lesson has specific objectives aimed at helping learners understand the applications and importance of these technologies in daily life. The document also includes practical examples and activities to engage learners in applying their knowledge.

Uploaded by

Ihab Freiha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views23 pages

Artificial Intelligence and Programming

The document outlines a series of lessons focused on artificial intelligence and programming, including topics such as types of AI, sensors, robotics, and programming languages like Python and Scratch. Each lesson has specific objectives aimed at helping learners understand the applications and importance of these technologies in daily life. The document also includes practical examples and activities to engage learners in applying their knowledge.

Uploaded by

Ihab Freiha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Objectives

Lesson 2
Lesson I
Sensors
Artificial Intelligence Applications
By the end of the lesson, I will be able to :
By the end of the lesson, I will be able to :
1. Mention the different types of sensors and
I. List types of artificial intelligence
their areas of use
2. Review some practical applications of
2. List the importance of sensors in our modern life
artificial intelligence
3. Design a simple project based on the idea of
3. Suggest the largest number of ideas for the
sensors
uses Of artificial intelligence in our lives
Lesson 4
Lesson 3
Scratch
Robot
By the end of the lesson, I will be able to :
By the end Of the lesson, I Will be able to :
I. Explain the uses Of the Scratch program
I. Explain the concept Of robot
2. Deduce the features of the Scratch program
2. List the types of robots and their functions
3. Use the Scratch program to create a simple
3. Suggest the largest number of ideas for the
project
uses of robots in our lives
Lesson 6
Lesson 5
Principles of Python
Sprites Area in Scratch
By the end of the lesson, I will be able to :
By the end of the lesson, I will be able to :
1. Explain the concept of the Python
1. Discuss the concept of sprites area in Scratch
programming language
2. Create a simple project in Scratch and its role
2. List the uses of the Python
in our lives
language
3. Develop my project (add-delete-modify) for
3. Practice the steps to
sprites on the project
download the Python
Lesson 7 language to my device
Variables in Python

By the end of the lesson, I will be able to :

I. Explain the concept of variables

2. Deduce the types of variables

3. Write a simple programming code in Python


Artificial Intelligence and Programming

Lesson One
Artificial Intelligence Applications
Lesson Two
Sensors
Lesson Three
Robot
Lesson Four
Scratch
Lesson Five
Sprites Area in Scratch
Lesson Six
Principles of Python
Lesson Seven
Variables in Python
Lesson One
Artificial Intelligence Applications
Types of Artificial Intelligence:

Artificial intelligence is not just one type, but there are many and varied types. Imagine that we
have a large garden full of different flowers, each flower has a different shape and color, and so is
the case with artificial intelligence.

➢ Narrow AI:

This type of artificial intelligence focuses on performing a specific task, such as recognizing faces
or translating languages. Another example is a robot that can play chess brilliantly, but it cannot
do anything else.
➢ General artificial intelligence (GAI):

This type of artificial intelligence is more advanced and can perform any task that a human can
do. Example: A robot that completely mimics a human, as it can think, innovate, solve complex
problems, learn, and adapt to different situations.
➢ Super artificial intelligence (SAI):

This type of artificial intelligence is the most advanced; it can solve problems that are difficult for
humans to solve easily and discover new things that we have never imagined before.
Applications of artificial intelligence in daily life:

1- Personal Assistant: Do you have a friend who talks to you, answers your
questions, and performs tasks? This is the personal assistant like (Siri) or
(Alexa), it uses artificial intelligence to understand your commands and
perform them.
2- Smart Games: Do you play video games? Some of these games use
artificial intelligence to make the game more fun and challenging, as
the characters in the game can learn from their mistakes and
become smarter.
3- Smart Cars: Have you ever imagined a car driving itself without a
driver? This is the dream of the future that is getting closer to being
realized thanks to artificial intelligence.

4- Digital Doctors: Doctors use artificial intelligence to help them


diagnose and treat diseases faster and more accurately.

5- Instant Translator: Have you traveled to another country and spoken a


different language? Artificial intelligence can translate words and
sentences instantly, making it easier for people to communicate.

6- Smart Shopping: Have you noticed that shopping sites offer you
suggestions for products that you might like? This is thanks to artificial
intelligence that analyzes your previous purchasing behavior.
Artificial Intelligence Fields:

1. Machine Learning -Learning from Mistakes:


AI has to learn new things, the more we show it a picture of a cat, the more it learns to name it,
and the more we play a game with it, the smarter it becomes, this is called
Machine Learning, and it is like when you learn to ride a bike, the more you fall, the better you
learn how to balance.
2. Natural Language Processing -Understanding Languages:
Can you imagine talking to your computer as if it were a friend? It understands our different
languages and can answer our questions. This is Natural Language Processing, and it is like an
intelligent language translator as it understands written and spoken human language, interprets
it, and learns to "speak" human language.
3. Computer Vision -Sees the World:
AI can look at a picture and tell you everything in it, and it can find your face in a crowded picture,
and distinguish between pictures of different animals, which is called Computer Vision.
4. Robotics:
There are smart robots that do many tasks such as cleaning the house, playing chess, or
performing complex and precise surgery, and they can work with great accuracy even in
environments that are dangerous to humans.
5. Simulation of human thinking and decision-making -Expert Systems:
Artificial intelligence can solve complex problems and make difficult decisions. This is the field of
expert systems. It is like an intelligent doctor who can diagnose diseases.
6. Simulation of human learning -Deep Learning:
Deep learning aims to enable computer systems to learn complex tasks in a way similar to the
way humans learn. Artificial intelligence has a mind similar to the human mind. It uses this mind
to learn things very quickly. Deep learning relies mainly on neural networks and deep learning.

Create intelligent models to recognize images, sounds, and movements using machine
learning (Teachable Machine):
Imagine if you could teach a computer to recognize objects in the same way you learn! This is
exactly what Teachable Machine does, an easy-to-use tool that helps you create intelligent
models to recognize images, sounds, and movements.
Activity
Model Building Training:
download the Teachable Machine website.
Note: It is preferable to update your internet browser and work on the Microsoft Edge browser.
Click on the following link to enter the website [Link]
Home screen layout of the site

Imagine that you are training a young child to do new things! First, you need to teach him the
names of things.
• You show the young child a picture of a cat and say, “This is a cat,” then you show him a
picture of a dog and say, “This is a dog.”
• You are telling the child what things he sees, just as you teach him the names of letters and
numbers.
• After the young child sees a lot of pictures and hears names, his little brain starts to
understand the difference between a cat and a dog, just like when scientists try to train a
computer to understand pictures and sounds.
• The child has learned so well that he can now tell the difference between a cat and a dog
on his own, and in the same way, the computer has learned to recognize different things,
and we can use it for a lot of fun things!
Imagine that we want to teach the computer to recognize numbers. We can start by giving him
pictures of numbers from “0-9,” and telling him what number is in each picture. After a while, the
computer will be able to look at any number and tell us what it is.
Website login window layout
Ready to explore the world of photography? Our first project will take you on an exciting journey!

The images of numbers from "0-9" are prepared in the form of images of files stored on the computer.

1. Classification that includes a group of


images that belong to a specific category
such as images of numbers "from 0-9" and
another classification that includes images
of alphabet letters.
2. Upload images of numbers in (Class1).
3. Open the camera, prepare images of numbers on paper boards" and have the model take them
in (Class2),
Note: The images were provided to the model in the form of files or he takes them through the
Web camera.
4. The artificial intelligence model is trained on the image categories that were given to it.
5. Add more image categories when needed, for example "adding special symbols".
6. After that, the model can be given an image that determines for us which category of images it
follows.

Save the project:


1-Save the project on Google Drive…
2-Download the project to the device..
Practical example:
Suppose you want to make a game where you control a character on the screen with your hand
movement, here are the steps:
• Training: You record your hand in different positions (such as raising the hand, lowering it,
moving it right and left).
• Recognition: Teachable Machine learns to associate each position of your hand with a
specific movement of the character on the screen.
• Game: When you move your hand in front of the camera, the character on the screen
moves according to what the computer has learned.

Example application:
• Access the site:
Open your browser and type "Teachable Machine" in the search bar, then access the site.
• Select the training model:
We find several options, choose the option related to image recognition (Image).
• Prepare the camera:
The site will ask you to choose to upload images (Upload) or allow it to use your device's camera
(web). Click on the camera (web) and make sure that the lighting is good and the camera
background is simple so that the computer focuses on the movement of your hand.
• Train the computer.
• Create Classes:

Create at least two classes (Class1) and (Class2), for example (Class1) "Raised hand" and
(Class2) "Shaky hand".
• Record examples: In front of each category, record several examples of the corresponding
hand movement, for example, in front of the category "raised hand", raise your hand several
times and each time raise it with a specific movement or a different shape, and so on in
front of the category "shaky hand".
• Review examples: Make sure that the examples are clear and that the computer
understands the difference between the two movements.
• Training: After you finish taking the pictures, click on the "Train Model" button to teach the
computer these movements.
• Test the model: After you finish training, the site will ask you to test the model.
• Camera: Point the camera at your hand and perform the movements you trained.
• Results: You will see that the computer will try to guess the movement you are performing.
• Save the model: If you like the model, you can save it and use it in other projects.

Ideas for your projects:


• Recognize faces: Train the computer to recognize the faces of your friends and family.
• Create a motion control game: Use your body movements to control characters in a video
game.
• Image classification: Teach the computer to classify images into different categories (such
as animals, food, colors).
• Create a robot that follows you: Build a small robot that follows you wherever you go.
Put a check mark (√) in front of the correct sentence and a check mark (×) in front of the
incorrect sentence.
[Link] intelligence is only used in the video game industry. ( )
[Link] intelligence can help doctors diagnose diseases. ( )
[Link]-driving cars depend entirely on artificial intelligence. ( )
[Link] intelligence can learn new things slowly. ( )
[Link] intelligence is a science of computer science. ( )
[Link] artificial intelligence to become intelligent, it needs small amounts of information. ( )
[Link] intelligence is only one type. ( )
[Link] artificial intelligence can perform any task that a human can perform. ( )
[Link] artificial intelligence is more advanced. ( )
[Link] artificial intelligence focuses on performing a specific task. ( )
[Link] artificial intelligence can solve specific problems. ( )
[Link] Games are used to make playing games more fun. ( )
[Link] Translator is used to facilitate communication between people. ( )
[Link] Shopping gives you suggestions for products you might like. ( )
[Link] language processing is like a machine language translator. ( )
[Link] are very good at doing a lot of things with great accuracy. ( )
Choose the correct answer from a, b, c or d.
1. is a type of artificial intelligence that focuses on one specific task.
a. Super AI b. Personal AI c. General AI d. Narrow AI
2. use artificial intelligence to make the game more fun and challenging.
a. Smart games b. Smart cars c. Instant translator d. Digital numbers
3. Which of the following is an application of AI in daily life ?
a. Writing with a pen b. Smart cars c. Traditional cars d. All of them
4. is one of the roles performed by personal assistants like Siri and Alexa.
a. Understanding our commands b. Performing surgeries c. Teaching languages
d. Creating computer programs
5. is the main goal of deep learning.
a. Performing specific tasks without learning
b. Simulating human learning through neural networks
c. Performing only mathematical calculations d. Translating written texts
6. Machine learning helps to
a. reducing the system's ability to adapt
b. enabling systems to learn from data and improve their performance
c. interacting with sound only d. operating robots only
7. is used in instant translation.
a. Natural Language Processing b. Expert Systems
c. Computer Vision d. Deep Learning only
Lesson Two
Sensors

➢ are simple devices that play a major role in our daily lives.
➢ They sense changes in the surrounding environment.
➢ They convert changes into signals that help machines make appropriate decisions based
on them.
➢ Sensors are considered the eyes and ears of machines.

For example: Sensors are used in :


• robots • smartphones • modern cars • alarms

How do sensors work?


A sensor is a translator that translates those sensations (such as heat, light, or sound) into a
language that the computer understands, which is the language of numbers.
Sensors Working steps:

1. Sensing: Captures information from the


surrounding environment (such as heat, light, or
sound).
2. Signal Conversion: Converts this information
into electrical signals that can be read by
electronic devices.
3. Transmission: Signals are sent to another
device to display the results or perform a
specific operation.
For example, a thermometer displays the temperature result on a digital screen.

The importance of sensors for robots:


Imagine robots without sensors,
• They would be like a person walking with their eyes closed and their ears covered,
• They cannot recognize what is happening around them or recognize those around them or
how to behave,
• They represent the "senses" of the robot, helping it to see, hear, sense, and even touch
things around it.

Types of robotic sensors:


There are many different types of sensors used in robots, and each type has a specific function.
Here are some examples:
o Distance Sensors: Measure the distance between the robot and surrounding obstacles,
this helps the robot avoid collisions.
o Light Sensors: Used in robots that operate in places where light is variable, such as home
robots, these sensors help the robot adapt to changing light conditions.
o Sound Sensors: These are used in robots that react to sounds, for example: robots that can
respond to voice commands.
o Motion Sensors: These detect movement and changes in direction. These sensors help the
robot navigate and interact with surrounding objects.
o Special Sensors: Such as temperature and humidity sensors.
Some examples of electronic devices that use sensors:
o Vacuum cleaner robot: uses sensors to avoid obstacles and clean under furniture.
o Surgical robot: uses precise sensors to perform surgeries.
o Self-driving cars: rely heavily on sensors to see the road and make decisions.

Types of distance sensors and examples of them:


The types of distance sensors used in robots and smart devices vary, and each type has its own
advantages and uses. Here is a detailed explanation of the types of these devices with
illustrative examples:
1-Ultrasonic Sensors:
Working principle: These devices emit high-
frequency sound waves, then receive the returning
waves after they bounce off an object, and by
measuring the time, it takes for the wave to return,
the distance to the object can be calculated.
Examples:
o Vacuum cleaner robots: These devices are used to locate furniture and obstacles to avoid
colliding with them.
o Parking systems: They help measure the distance between the car and surrounding
obstacles.
o Fluid levels: They are used to measure the level of fluids in tanks and reactors.
2-Laser Rangefinders:
o Working principle: These devices emit a laser
beam and then measure the time it takes for the
beam to return after bouncing off the object,
and are characterized by high accuracy and a
longer range compared to ultrasonic devices.
Examples:
o 3D laser scanners: They are used to create
o 3D models of spaces.
o Ground scanning systems: They are used in geological and archaeological surveys.
o Industrial measurement systems: They are used to measure dimensions with high accuracy in
various industries.
3-Visible Light Sensors:
Working principle: These devices use digital cameras to analyze images and determine the
distance to objects based on the size and distortion of the image.
Examples:
o Self-driving car cameras: used to determine the
distance to other cars, pedestrians, and traffic signals.
o Industrial vision systems: used to inspect products
and identify errors.
o Augmented reality systems: used to integrate digital
elements with the real world.
4-Infrared Sensors:
o Working principle: These devices emit infrared
rays and then receive the returning rays after they
bounce off the object, widely used in consumer
electronics.

Examples:
o Remote controls: Infrared rays are used to
communicate with electronic devices.
o Non-contact thermometers: Used to measure body
temperature without the need for direct contact.

5-Time of Flight sensors:


o Working principle: It depends on measuring the
time it takes for a light pulse to reach an object
and return to it, characterized by high accuracy
and high speed.

Examples:
o 3D sensors: Used to create 3D models of
objects.
o Motion tracking systems: Used in video games and virtual reality systems.
Activity:
mention electronic devices that you use in your daily life and that depend on sensors in their
work?
Answers
Daily applications of sensors:
Sensors are used daily in our lives, and the most prominent of these applications are:
o In smartphones: There are sensors that help in taking pictures, adjusting the lighting level,
and even determining the location of the phone.
o In modern cars: Sensors are used to determine speed, warn of collisions, and help the
driver park his car.
o In smart homes: Motion sensors turn on the lights automatically when someone enters the
room.
o Phone microphone: It is a sound sensor that converts the sound you pick up into electrical
signals that can be understood by the phone.
o Motion sensor in games: When you tilt your phone to the right or left while playing a game,
the motion sensor is what tells the game to change the direction of the character.
o Touch screen: It is a group of small sensors that sense where your finger touches the
screen.
Questions:
Choose the correct answer from the following:
1. The main function of the sensor is …….....
A. Store data
B. Capture environmental changes and convert them into signals
C. Display images
D. Produce sound
2. Sensors help robots to..........
A. Teach them new languages
B. Allow them to interact with their environment
C. Increase their size
D. Slow down their operations
3. A type of sensor ............ is used to avoid obstacles.
A. Light sensors
B. Sound sensors
C. Distance sensors
D. Heat sensors
4. The first step in the operation of the sensor is ………...
A. Transmitting
B. Displaying
C. Sensing
D. Transduction
5. ……....... are commonly used in remote controls.
A. Ultrasonic sensors
B. Infrared sensors
C. Light sensors
D. Motion sensors 24

6. Laser rangefinders are accurate because they use ……......


A. Sound waves
B. Visible light
C. High frequency waves
D. Laser beams
7. A common application of sensors is the use of infrared in .............
A. Smartphones
B. Remote controls
C. Vacuum cleaners
D. 3D scanning
8. In which environment are light sensors useful? ………....
A. In dark rooms
B. In places with variable lighting conditions
C. In underwater environments
D. In noisy factories
9. One of the sensors that are used to measure distance using high frequency sound waves
is ………......
A. Ultrasonic sensors
B. Laser rangefinders
C. Infrared sensors
D. Motion sensors
10. ……....... sensors are used to turn on lights when someone enters the room.
A. Smartphone
B. Smart car
C. Smart Home Lighting System
D. Smart Watch 25

11. …………. is used for non-contact temperature measurement.


A. Ultrasonic sensor
B. Infrared sensor
C. Light sensor
D. Motion sensor
12. ……….. is the main purpose of the signal conversion step in sensors.
A. Display the results
B. Send the signals to another device
C. Convert the information into electrical signals
D. Turn off the sensor
13. …………… helps cars determine the distance to other vehicles.
A. Sound sensors
B. Light sensors
C. Infrared sensors
D. Distance sensors
14. …………… is the practical use of motion sensors in games.
A. Change the volume
B. Adjust the brightness of the screen
C. Track the movements of players
D. Improve the sound quality
15. Factors that determine the choice of a sensor for a particular application……….. .
A. Brand of the device
B. Color of the device
C. Environment and required accuracy
D. Size of the device
Lesson Three: Robots

Definition of Robot:
A robot is a device that can be programmed to perform a set of specific
tasks automatically. The robot can move, sense (via sensors), and interact
with its surroundings and can be used in environments that require
precision and speed of performance.
Example:
When we see a vacuum cleaner moving by itself in the house to clean the
floor, this is a type of robot that works independently.
1-Types of robots: There are several types of robots, including:
o Industrial robots:
They are robots used in factories, and they can perform work with high accuracy, such as
robots that work in car production plants on production lines quickly and accurately.
o Home robots:
These robots are found in homes, cleaning robots such as Roomba that help clean floors
without any human effort, such as smart vacuums.
o Medical robots:
Medical robots help doctors perform surgeries, and they can be very accurate.
These robots are used in schools to teach students how to program and technology, such
as LEGO Mindstorms robots that can be programmed to perform specific tasks, to help
students and to be an aid to the teacher.

2-Robot components:
o Structure
The structure is the main part that carries all the components of the robot. It can be made
of different materials such as metal, plastic, or carbon. The design of the structure affects
the weight of the robot and its ability to move.
o Sensors
Sensors are the senses of a robot. Just as we use our
eyes to see and our ears to hear, a
robots use sensors to pick up information from its
surroundings. Some examples of sensors
are:
➢ Sound sensors: pick up and analyze sounds.
➢ Cameras: help robots “see” things in front of
them.
o Motors
Motors are used to move parts of a robot. There
are different types of motors, such as
Electric motors and pneumatic motors, each
with its own uses. Motors are the industrial
muscles of robots. Thanks to motors
(actuators), robots can move and execute
commands.
➢ Motors: make robots move.
➢ Robotic arms: used in factories to move
objects with precision.
o Controller:
The controller is the “brain” of the robot, processing the data collected by the sensors and
issuing commands to the motors. The controller can be as simple as electronic circuits or
as complex as microcomputers. Just as our brain thinks when we decide to move, the
processor makes the decisions necessary to move the robot.
o Power Source:
Robots need a power source to operate. Power sources can
be batteries, solar cells, or even
direct electrical power sources. The choice of power
source depends on the type of robot
and the required operating time.
o Software:
Software is what makes a robot “smart.” Software includes algorithms that determine how
the robot responds to information it receives from sensors. Software can range from simple
programs to complex artificial intelligence systems.
Communication tools:
Robots use communication tools to interact with users or
other robots. These tools can
include Bluetooth, Wi-Fi, or other communication
technologies.

Example: A home robot, such as a robot vacuum cleaner, has sensors to avoid collisions
with furniture and room walls.

3-Areas of use of robots:

Robots have become part of our daily lives and are used in several fields, such as medicine,
industry, and education.
For example, in hospitals, there are robots that perform precise surgeries, while in factories,
they help manufacture cars. Robots have many applications in different fields,
including:
• Industry: Improving productivity and reducing human errors.
• Healthcare: Assisting doctors in surgeries or providing care for patients.
• Education: Providing interactive educational experiences for students.
• Agriculture: Using robots in precision agriculture to increase crops and reduce
waste.

You might also like