Arduino Introduction PDF
Document Details
Uploaded by SophisticatedOrangutan
Tags
Summary
This document introduces Arduino, an open-source electronics platform. It details the components, programming, and applications of this platform.
Full Transcript
INTRODUCTI ON TO ARDUINO WHAT IS ARDUINO? Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's designed for anyone making interactive projects. The platform consists of a physical programmable circuit board (microcontroller) and a software, or...
INTRODUCTI ON TO ARDUINO WHAT IS ARDUINO? Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's designed for anyone making interactive projects. The platform consists of a physical programmable circuit board (microcontroller) and a software, or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board. HISTORY OF ARDUINO Developed by Massimo Banzi and David Cuartielles in 2005 in Italy. Originally intended to be a tool for students without a background in electronics and programming. Has since grown to be widely used by hobbyists, students, and professionals. ARDUINO BOARD OVERVIEW (MAIN COMPONENTS) Microcontroller: The brain of the Arduino board. For Arduino Uno, it's the ATmega328P. Digital Pins: Used for digital input/output operations. The Arduino Uno has 14 digital pins, numbered from 0 to 13. Analog Pins: Used for analog input, allowing the board to read signals from analog sensors. The Arduino Uno has 6 analog pins, labeled A0 to A5. ARDUINO BOARD OVERVIEW (MAIN COMPONENTS) Power Supply Pins: Vin: Input voltage to the Arduino when using an external power source (7-12V). 5V: Provides a regulated 5V from the regulator on the board. 3.3V: A 3.3V supply generated by the on-board regulator. GND: Ground pins. SUMMARY Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader SRAM 2 KB (ATmega328) EEPROM 1 KB (ATmega328) Clock Speed 16 MHz ARDUINO BOARD OVERVIEW (MAIN COMPONENTS) Reset Button: Resets the microcontroller. USB Interface: Used for programming the Arduino board and for power. Crystal Oscillator: Provides a clock signal to the microcontroller (typically 16 MHz for Arduino Uno). ARDUINO PROGRAMMING LANGUAGE Basic Structure: setup(): A function that runs once when you press reset or power the board. loop(): The main part of your code, it runs continuously after the setup is done. EXAMPLE: “BLINK” PROGRAM THAT MAKES AN LED ON PIN 13 BLINK. void setup() { pinMode(13, OUTPUT); // Set digital pin 13 as an output } void loop() { digitalWrite(13, HIGH); // Turn on the LED delay(1000); // Wait for one second digitalWrite(13, LOW); // Turn off the LED delay(1000); // Wait for one second } BASIC CONCEPTS AND FUNCTIONS Digital Input and Output Use pinMode() to set a pin as INPUT or OUTPUT. Use digitalWrite() to set a pin to HIGH or LOW. Use digitalRead() to read the value of a digital input. BASIC CONCEPTS AND FUNCTIONS Analog Input Use analogRead() to read a value (0-1023) from an analog pin. PWM (Pulse Width Modulation) Use analogWrite() to output a PWM signal on pins marked with a tilde (~). This can be used to dim LEDs or control motor speed. BASIC CONCEPTS AND FUNCTIONS Serial Communication Use Serial.begin(9600) to start the serial communication. Use Serial.print() and Serial.println() to send data to the computer. INTERFACING WITH SENSORS AND ACTUATORS Digital Actuators Servo Motor (SG90) Stepper Motor Relay Module Digital Buzzer INTERFACING WITH SENSORS AND ACTUATORS Digital Sensor DHT11/DHT22 (Temperature and Humidity Sensor) PIR Motion Sensor (HC-SR501) Ultrasonic Distance Sensor (HC-SR04) Infrared (IR) Obstacle Avoidance Sensor INTERFACING WITH SENSORS AND ACTUATORS Analog Actuator DC Motor Servo Motor LED (Brightness Control via PWM) Vibration Motor (Controlled via PWM) INTERFACING WITH SENSORS AND ACTUATORS Analog Sensor Potentiometer Soil Moisture Sensor LDR (Light Dependent Resistor) Temperature Sensor (LM35) Gas Sensor (MQ-2, MQ-7, etc.) APPLICATIONS OF ARDUINO In Education Arduino is used as a teaching tool to introduce students to electronics and programming. In Industry Used for prototyping, automation, and control systems in various industries. SRAM, EEPROM, FLASH SRAM (Static Random-Access Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), and Flash Memory are all types of memory used in microcontrollers, each with specific purposes and characteristics. SRAM (STATIC RANDOM-ACCESS MEMORY) Purpose: Used as a working memory for storing variables and temporary data during program execution. Volatility: Volatile memory, meaning it loses its data when the power is turned off. Speed: Very fast; allows quick read and write operations, making it ideal for tasks requiring frequent data access and manipulation. EEPROM (ELECTRICALLY ERASABLE PROGRAMMABLE READ-ONLY MEMORY) Purpose: Used for storing data that must be preserved between power cycles, such as configuration settings or user preferences. Volatility: Non-volatile memory, retaining data even when the power is turned off. Speed: Slower than SRAM; writing to EEPROM is particularly slow, and there are limitations on the number of write cycles (typically around 100,000 cycles). FLASH MEMORY Purpose: Used for storing the microcontroller's firmware (the program code) and large amounts of data that need to be retained between power cycles. Volatility: Non-volatile memory, retaining data even when the power is turned off. Speed: Faster than EEPROM for reading, but slower for writing. Flash memory typically has more complex write/erase processes. PIN STRUCTURE OF ARDUINO UNO IN DETAIL NODEMCU ESP8266 WHAT IS NODEMCU? NodeMCU is an open-source development board and firmware based on the ESP8266 Wi-Fi module. It allows you to create IoT projects by connecting microcontrollers to the internet. OVERVIEW OF THE ESP8266 WI-FI MODULE The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability. Used widely in IoT applications due to its affordability and ease of use. HISTORY AND DEVELOPMENT OF NODEMCU Initially developed as firmware in 2014 to run on the ESP8266. The hardware development board followed, making it easier to prototype IoT projects. WHY USE NODEMCU? Cost-effective: NodeMCU is one of the cheapest options for IoT projects. Wi-Fi Capabilities: Built-in Wi-Fi for easy network connectivity. Easy to Program: Supports the Arduino IDE and Lua scripting language. HARDWARE OVERVIEW NodeMCU Board Layout and Components Microcontroller: ESP8266 Flash Memory: 4MB USB to Serial Converter: Allows easy programming via USB. Reset and Flash Buttons: Used to reset the board or put it into flash mode. HARDWARE OVERVIEW ESP8266 Microcontroller: Features and Specifications 32-bit RISC CPU running at 80 MHz. 11 GPIO pins (General Purpose Input/Output). 1 Analog Input pin (10-bit resolution). Integrated Wi-Fi 802.11 b/g/n. Supports multiple interfaces like SPI, I2C, and UART. HARDWARE OVERVIEW Pinout Diagram Highlight key pins: GPIO, ADC (Analog to Digital Converter), Power Pins. Explain the multi-functional nature of GPIO pins (can be used as PWM, I2C, etc.). Power Supply Options USB Power: Standard 5V through a micro USB cable. External Power: 3.3V regulated power through the VIN pin. WI-FI AND IOT CAPABILITIES Connecting to a Wi-Fi Network Using the WiFi library to connect NodeMCU to a Wi-Fi network. Example code for establishing a Wi-Fi connection. WI-FI AND IOT CAPABILITIES Setting Up a Web Server Hosting a simple web server on NodeMCU to control outputs (like LEDs) via a web page. Example of creating a basic HTML page served by NodeMCU. WI-FI AND IOT CAPABILITIES Sending Data to IoT Platforms Integrating with platforms like ThingSpeak, Blynk, or Firebase. Example: Sending sensor data to ThingSpeak for visualization.