Download - iot section 1th
Microcontroller (Arduino uno) lab 1
An introduction
Good news 4 teaching assistant this year500 L.E prize for top ten best idea for projectsPure practical sections 6 boards will be available at the lap to be used Complete with sensors Be careful with the lap tools protect them as
yours
Grades distribution 20 lab10 final lab exam 12 lab sessions + final lab exam in total 13 labs
What is a microcontroller Small computer System on a chip (SoC)Contains processor memory storage input and outputs Contains digital and also analog inputs Communication means like wifi bluetooth or radio frequency (internet )Need very low power consumptionVery low cost Typical application iots application
Arduino uno Open source project HW / SWIt is used to digital devices that interact with the environment Contains analog and also digital inputs Can receive measurement from the environment and react to them Can be used to control other devices It uses a custom version of c and c++ programing languageWrite a code on ide on your computer and then put them on the chip And you are ready to go Cross platform linux mac and window
Hardware overview
Important notes about arduino uno USP input to put the code into the chip6 analog inputs pins values 0 -25514 digital inputs / outputs pins high or low 0 or 1 Clock speed 16 MHz
Important terminology Sketch mean program in arduino community Pin is either input or output connected to button input or to led lamp outputDigital is either low or high zero or one Analog is either 0 - 255 variables
Arduino uno
Sensors examples Measure distance It is using ultrasonic Like bats sensing the prey
Sensors examples continue It is used to start reaction To any inputs
Sensors examples continueIt is used to sense the level of water on earth Can be used to save water in agriculture
Sensors examples continue
So we have chip and input what about outputs
Outputs continue
Important sensors that we will use in the future
Breadboard
Breadboard continue We need to build some complicated project and chips Makes organizing very easy compared to plugging inputs and outputs directly
into the the board
Inputs & outputs Inputs is something that board read from the environment or the userExample temperature from the environment & push a button from user Output reaction from the board as a results of an inputsA blink of the led or a message on the lcd screen
You can connect sensors and actuators, and program your Arduino to control them
First program We will use the built in program in the arduino ide File -> examples -> 01 Basics -> Blink File -> example contains many pre made sketches that you can use right
away It is like standing on the shoulders of the giants
First program Plug the chip into the laptop or computer using usb portThen you will see a led light labels L blinking once every two second This was your first program easy right ? Why this program is preinstalled on the board To make sure it is working fine
First program bit by bit Code consisted of two main parts First part in setup for thing that we want to do once like initialization Second part is loop things that are repeated more than once hence loop pinMode(pinNumber , INPUT / OUTPUT) Pin number is the number of the pin you use Second parameter is the input or output the pin more you wantDigitalWrite (pin you want to write to , value High or Low)Delay(milliseconds) stop the loop temporarily
Notes on arduino programing You can define variables like int , float etc You can use variables to name your sensors and actuators INPUT , OUTPUT , HIGH , LOW all of them are constants
Second program modify the first program Change delay from 1000 to 200Delay is the time between each blank of the built in led light Each 1000 = 1 second 200 = second ⅕Click upload then the program will be uploaded to board
Home workWatch the video series on the YouTube Tutorial Download arduino ide from the link Arduino
Thank you