28
Microcontroller (Arduino uno) lab 1 An introduction

iot section 1th

Embed Size (px)

Citation preview

Page 1: iot section 1th

Microcontroller (Arduino uno) lab 1

An introduction

Page 2: iot section 1th

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

Page 3: iot section 1th

Grades distribution 20 lab10 final lab exam 12 lab sessions + final lab exam in total 13 labs

Page 4: iot section 1th

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

Page 5: iot section 1th

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

Page 6: iot section 1th

Hardware overview

Page 7: iot section 1th

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

Page 8: iot section 1th

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

Page 9: iot section 1th

Arduino uno

Page 10: iot section 1th

Sensors examples Measure distance It is using ultrasonic Like bats sensing the prey

Page 11: iot section 1th

Sensors examples continue It is used to start reaction To any inputs

Page 12: iot section 1th

Sensors examples continueIt is used to sense the level of water on earth Can be used to save water in agriculture

Page 13: iot section 1th

Sensors examples continue

Page 14: iot section 1th

So we have chip and input what about outputs

Page 15: iot section 1th

Outputs continue

Page 16: iot section 1th

Important sensors that we will use in the future

Page 17: iot section 1th

Breadboard

Page 18: iot section 1th

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

Page 19: iot section 1th

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

Page 20: iot section 1th

You can connect sensors and actuators, and program your Arduino to control them

Page 21: iot section 1th

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

Page 22: iot section 1th
Page 23: iot section 1th

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

Page 24: iot section 1th

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

Page 25: iot section 1th

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

Page 26: iot section 1th

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

Page 27: iot section 1th

Home workWatch the video series on the YouTube Tutorial Download arduino ide from the link Arduino

Page 28: iot section 1th

Thank you