Arduino Basics PDF
Document Details
Uploaded by Deleted User
Dr. Tamer Medhat
Tags
Summary
This document provides an overview of Arduino programming and electronic components.. It's a great resource for beginners and intermediate developers.
Full Transcript
Dr. Tamer Medhat ARDUINO BOOKS What is a Microcontroller A small computer on a single chip containing a processor, memory, and input/output Typically "embedded" inside some device that they control A microcontroller is often small and low cost The Arduino Microcontroller...
Dr. Tamer Medhat ARDUINO BOOKS What is a Microcontroller A small computer on a single chip containing a processor, memory, and input/output Typically "embedded" inside some device that they control A microcontroller is often small and low cost The Arduino Microcontroller: Atmel AVR ATmega 328 The Arduino Development Board 5-24V What is the Arduino The Arduino is a family of microcontroller boards Used by: To easily: ✓Artists ✓ Design ✓Hackers ✓ Prototype ✓Hobbyists ✓ Experiment with ✓Professionals electronics. What is the Arduino it’s designed to attach all kinds of sensors, ✓LEDs, ✓small motors, ✓speakers, ✓servos, etc. directly to these pins, which can read in or output digital or analog voltages between 0 and 5 volts. What is the Arduino with an Arduino you can connect various forms of input and output, and create a program to process and respond to the inputs and outputs. Basically anything that can be switched on or off, or controlled by electricity, can be controlled by an Arduino. What is the Arduino Examples of input and output forms input: output: ✓ buttons ✓ Lights ✓ Switches ✓ noise-makers ✓ movement sensors ✓ Motors ✓ temperature sensors ✓ pumps, other circuits, ✓ light sensors ✓ liquid-crystal displays ✓ gas sensors What is the Arduino Arduino connects to your computer via USB, where you program it in a simple language (C/C++) inside the free Arduino IDE by uploading your compiled code to the board. Once programmed, Arduino can run with the USB link back to your computer, or stand- alone without it — no keyboard or screen needed, just power. Getting Started With Arduino 1. Download & install the Arduino environment (IDE) 2. Connect the board to your computer via USB 3. If needed, install the drivers 4. Launch the Arduino IDE 5. Select your board 6. Select your serial port 7. Implement your circuit 8. Write a control code 9. Upload the control code Getting Started With Arduino Arduino IDE Getting Started With Arduino Selecting the serial port and the Arduino Board Getting Started With Arduino From Coding to Execution Getting Started With Arduino Status Messages Overview of Common Components: Breadboard Overview of Common Components: Resistor A resistor is a device designed to cause ʻresistanceʼ to an electric current and therefore cause a drop in voltage across itʼs terminals. We use resistors to decrease voltage or current to other devices. The value of resistance is Ohm Ω. Overview of Common Components: Resistor Overview of Common Components: LED A Diode is a device that permits current to flow in only one direction. if the current tried to reverse and go back in the opposite direction the diode would stop it from doing so. Diodes can be useful to prevent someone from accidently connecting the Power and Ground to the wrong terminals in a circuit and damaging the components. Overview of Common Components: LED LED (Light Emitting Diode). An LED is the same thing, but it also emits light. LEDʼs come in all kinds of different colours and brightnesses and can also emit light in the ultraviolet and infrared part of the spectrum (like in the LEDʼs in your TV remote control). Overview of Common Components: Resistor Ardunio Digital Pin is outputting 5 volts DC at (according to the Atmega datasheet) 40mA (milliamps). LED requires (according to their datasheet) a voltage of 2v and a current of 20mA. We therefore need to put in a resistor that will reduce the 5v to 2v and the current from 40mA to 20mA if we want to display the LED at itʼs maximum brightness. If we want the LED to be dimmer we could use a higher value of resistance. So VR= 5- 2= 3V Then is R = 3/0.02= 150 Ω Overview of Common Components: Potentiometer A potentiometer is a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value. Overview of Common Components: Potentiometer Overview of Common Components: Buzzer Overview of Common Components: 7 Segment Overview of Common Components: Bluetooth Module Overview of Common Components: LCD Display Overview of Common Components: Dot Matrix Overview of Common Components: Temperature Sensor temp = (5.0 * analogRead(tempPin) * 100.0) / 1024; Overview of Common Components: Ultrasonic Sensor Overview of Common Components: LDR Sensor Overview of Common Components: LDR Sensor Overview of Common Components: Motion Sensor Overview of Common Components: Infrared Transmitter and Receiver Pair Overview of Common Components: Infrared Obstacle Avoidance Sensor Overview of Common Components: Sound Sensor Overview of Common Components: Fire Sensor Overview of Common Components: Soil Moisture Sensor Overview of Common Components: Soil Moisture Sensor Overview of Common Components: Rain Drop Sensor Overview of Common Components: Servo Motor Overview of Common Components: Servo Motor Overview of Common Components: DC Motor Overview of Common Components: DC Motor Overview of Common Components: DC Motor Overview of Common Components: Keypad Overview of Common Components: Keypad Sketch Structure void setup() // run once, when the sketch starts { Statements; } void loop() // run over and over again { Statements; } Sketch Structure // Blinking LED int LED = 13; // LED connected to digital pin 13 void setup() { pinMode(LED, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(LED, HIGH); // turns the LED on delay(1000); // waits for a second digitalWrite(LED, LOW); // turns the LED off delay(1000); // waits for a second } Questions ? Thank you