Movatterモバイル変換


[0]ホーム

URL:


Uploaded byVishnu
7,328 views

Arduino Workshop Day 1 - Basic Arduino

The document covers an Arduino workshop, explaining Arduino as an open-source electronics prototyping platform meant for artists and designers. It details Arduino's significance, capabilities, and various components, as well as basic electrical concepts related to Arduino use. Additionally, it provides insights into programming with Arduino, including sketches, loops, and the use of components such as sensors and actuators.

Embed presentation

Downloaded 303 times
WORKSHOP ON ARDUINODAY – 1: ARDUINO BASICSDESIGN INNOVATION CENTRE
Free and Open-Source Software (FOSS) Free and open-source software (FOSS) allows users and programmers to edit,modify or reuse the software's source code. This gives developers theopportunity to improve program functionality by modifying it. The term “free” indicates that the software does not have constraints oncopyrights. The term “open source” indicates the software is in its projectform, enabling easy software development from expert developerscollaborating worldwide without any need for reverse engineering. Some examples of FOSS include: Linux Kernel, Ubuntu, Nextcloud, GoogleChrome OS, Android OS, BSD, GIMP, Blender, OpenOffice, ChromeBrowser, Eclipse, etc.
Why Was Arduino Developed? Physical Computing – using components that can interact with people andwith the world around us The Arduino was originally developed for artists and designers to prototypeinteractive displays at Italy by Massimo Banzi and David Cuartielles in2005. Developed for non-scientists Minimalist programming “Forgiving” circuitry that can handle a wide variety of wiring errors
What is Arduino Not? It is not a chip (IC) It is not a board (PCB) It is not a company or a manufacturer It is not a programming language It is not a computer architecture(although it involves all of these things...)Official Definition: Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware and software. It'sintended for artists, designers, hobbyists, and anyone interested increating interactive objects or environments.
So, What is Arduino? It’s a movement, not a microcontroller Founded by Massimo Banzi and David Cuartielles in 2005 based on“Wiring Platform”, which dates to 2003 Open-source hardware platform Open source development environment Easy-to learn language andlibraries (based on Wiringlanguage) Integrated developmentenvironment (based onProcessing programmingenvironment) Available for Windows /Mac / Linux
Why Arduino? For whatever reason, Arduino microcontrollers havebecome the de facto standard Strives for the balance between ease of use andusefulness1. Programming languages seen as majorobstacle2. Arduino C is a greatly simplified version ofC++ It is an open-source project, software/hardware isextremely accessible and very flexible to becustomized and extended Arduino is backed up by a growing onlinecommunity, lots of source code is already availableand we can share and post our examples for others touse, too! It is inexpensive and comes with free authoringsoftwareOriginal Arduino.cc Manufactured Arduino Uno: ₹ 2,400.00Electrical & Code compatible Arduino Uno Clone: ₹ 500.00
Electricity  Electronics Basic Concepts Voltage (V)Voltage, also called electromotive force, is the potential difference incharge between two points in an electrical field.It is measured in Volt (V). Current (I)Current is the rate at which electric charge flows past a point in a circuit. Inother words, current is the rate of flow of electric charge.It is measured in Ampere (A). Resistance (R)Resistance is a measure of theopposition to current flow in anelectrical circuit.It is measured in ohms, symbolizedby the Greek letter omega (Ω).
Alternating Current & Direct Current Alternating Current (AC)Alternating current is defined as the flow of charge that changes directionperiodically. The result obtained will be, the voltage level also reverses along withthe current. Basically, AC is used to deliver power to industries, houses, officebuildings, etc. Direct current (DC)Direct current is the movement of electric charge carriers, i.e. electrons in aunidirectional flow. In DC, the intensity of the current will vary along with time,but the direction of movement stays the same in all time. Here DC is referred to avoltage whose polarity never reverses. DC power is widely used in low voltageapplications such as charging batteries, automotive applications, aircraftapplications.
Ohm’s Law The relationship between Voltage, Current and Resistance inany DC electrical circuit was firstly discovered by the Germanphysicist Georg Ohm. Ohm's law states that the current through a conductor betweentwo points is directly proportional to the voltage across the twopointsThe Power TriangleThe Ohm’s Law Triangle
Current Flow , Voltage Flow & Resistance AnalogiesWater = ChargePressure = Voltage (V)Flow = Current (I)Size of the Pipe = Resistance (R)
Circuit An electronic circuit is composed of individual electroniccomponents, such as resistors, transistors, capacitors, inductorsand diodes, connected by conductive wires or traces throughwhich electric current can flow. To be referred to as electronic,rather than electrical, generally at least one active componentmust be present. The word “circuit” is derived from the circle. An ElectricalCircuit must have a continuous loop from Power (Vcc) toGround (GND).
Electronic Components Active ComponentsThose devices or components whichrequired external source to theiroperation is called Active Components.For Example: Diode, Transistors,SCR, ICs, etc. Passive ComponentsThose devices or components which donot required external source to theiroperation is called PassiveComponents.For Example: Resistor, Capacitor,Inductor, LDR, etc.
Resistor A resistor is a passive two-terminal electrical component thatimplements electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce current flow,adjust signal levels, to divide voltages, bias active elements, andterminate transmission lines, among other uses.
Breadboard A breadboard is a solder-less device fortemporary prototype with electronics and testcircuit designs. Because the solder-less breadboard does notrequire soldering, it is reusable. This makes it easy to use for creatingtemporary prototypes and experimenting withcircuit design.
Analog & Digital SignalsWhat is analog ? It is continuous range of voltagevalues (not just 0 or 5V) Analog has many (infinite) valuesWhy convert to digital ? Because our microcontroller onlyunderstands digital. Digital has two values: on and off
Arduino Uno & Its Parts
ATMega328P MicrocontrollerCPU Speed: 20MHzRAM: 2KBStorage: 32KBProgram MemoryI/O: Up to 23 GenericI/O, 6 are AnalogCapable, UART / I2C /SPI
ATMega328p Specifications
Microcontroller (µC, MCU)Computer on a single Integrated Chip Processor (CPU) Memory (RAM / ROM / Flash) I/O ports (USB, I2C, SPI, ADC)Common microcontroller families: Intel: 4004, 8008, etc. Atmel: AT and AVR Microchip: PIC ARM: (multiple manufacturers)Used in:Cell Phones, Toys, Household Appliances, Cars, Cameras, etc.
Embedded SystemEmbedded System An embedded system is a combination of computer hardware and software,either fixed in capability or programmable, designed for a specific function orfunctions within a larger system. Industrial machines, agricultural and process industry devices, automobiles,medical equipment, household appliances, vending machines and toys, as wellas mobile devices, are possible locations for an embedded system.
Boot LoaderWhat's a boot loader?Microcontrollers are usually programmed througha programmer unless you have a piece of firmware in yourmicrocontroller that allows installing new firmware withoutthe need of an external programmer. This is called a bootloader.
Communication: I2C, SPI1. I2C (Inter-Integrated Circuit) Speed = 100 kHz, 400 kHz, and 3.4MHz (not supported by Arduino) Two bi-directional lines: SDA &SCL Multiple slaves can share same bus2. SPI (Serial Peripheral Interface Bus) Speed = 1-100 MHz (clock/devicelimited) Four-wire bus: SCLK, MOSI, MISO &SS Multiple slaves can share same bus (buteach needs a dedicated SS, slave select)
PWM & Duty Cycle Pulse-width modulation (PWM) is used forcontrolling the amplitude of digital signals inorder to control devices and applicationsrequiring power or electricity. Duty cycle = Pulse Width / Wave Period
Different Arduino Boards Arduino Uno Arduino Leonardo Arduino LilyPad Arduino Mega Arduino Nano Arduino Mini Arduino Mini Pro Arduino BT Arduino Due
Different Arduino ShieldsTFT Touch ScreenData LoggerMotor/Servo ShieldEthernet ShieldAudio Wave ShieldCellular/GSM ShieldWifi ShieldProto-shield, etc.
Getting Started with ArduinoDownload Arduino compiler and development environment from:http://arduino.cc/en/Main/Software Current version: 1.8.10 Available for Windows, Mac OS X & Linux Downloadable as Installer & Zip File Before running Arduino, plug in your board using USB cable (external poweris not necessary) When USB device is not recognized, navigate to and select the appropriatedriver from the installation directory Run Arduino
Arduino IDE(Integrated Development Environment)1. Verify2. Upload3. New4. Open5. Save6. Serial Monitor7. Sketch Name8. Code Area9. Message Area10. Text Console11. Board & Serial Port
Setting Up of Arduino IDE The computercommunicatesto the Arduinomicrocontrollervia a serial portthrough a USB-Serial adapter. Check to makesure that thedrivers areproperlyinstalled.Step 1Settings: Tools  Board  Arduino UnoStep 2Settings: Tools  Settings: Tools  Serial Port  COM#(Arduino Uno)
Arduino Sketch Structurevoid setup()Will be executed only whenthe program begins (or resetbutton is pressed)void loop()Will be executed repeatedly
Arduino Program Development Based on C++ without 80% ofthe instructions. A handful of new commands. Programs are called 'sketches'. Sketches need two functions: void setup( ) void loop( ) setup( ) runs first and once. loop( ) runs over and over,until power is lost or a newsketch is loaded.
Important Functions pinMode(pin, mode)Designates the specified pin for input or output digitalWrite(pin, value)Sends a voltage level to the designated pin digitalRead(pin)Reads the current voltage level from the designated pin analogWrite(pin, value)Sends analog voltage of the range 0 to 1023 to the designated pin digitalRead(pin)Reads the current analog voltage of the range 0 to 1023 from the designatedpin delay(delaytime)pauses the execution of the program for the given amount of time Serial Commandsprint(), println(), write(), read(), begin(), end(), find()
Variables A variable is a way of naming and storing a value for later use by theprogram, such as data from a sensor or an intermediate value used in acalculation.Declaration Before they are used, all variables have to be declared. Declaring a variablemeans defining its type, and optionally, setting an initial value (initializingthe variable). Variables do not have to be initialized (assigned a value)when they are declared, but it is often useful.8 bits 16 bits 32 bitsbytecharintunsigned intlongunsigned longfloat
ConditionsIf Statement: If a certain condition is true, theset of statements enclosed in curly braces areexecuted. If the condition is false, then the set ofstatements are skipped during the execution.if(some variable ?? state){}If Else Statement makes an “either-or decision.The if statements checks a condition. If it is true,it executes a set of statements; if the condition isnot true, it executes other set of statements underelse.if (some variable ?? state){}else{}For Loop: If you want to repeatedly execute a setof statements for a specific number of times, thenyou can use a for loop.for(initialization; condition; expression){}While Loop executes a set of statements until theexpression inside the parentheses is falsewhile (some variable ?? value){}Do While Loop executes a set of statements onceand repeatedly execute the set if a certain conditionis true.do{} while (some variable ?? value);Switch Case Statement allows to execute onecode block among many alternatives.switch (expression)​{case 1:// statementsbreak;case 2:// statementsbreak;default: // default statements}
Basic IDE Code// Basic blinking LEDint ledPin = 13;//Variable to store the pin numbervoid setup(){pinMode(ledPin, OUTPUT);//set ledPin as output}void loop(){digitalWrite(ledPin, HIGH);//LED ONdelay(1000); //Wait 1000ms (=1s)digitalWrite(ledPin, LOW);//LED OFFdelay(1000); //Wait 1000ms (=1s)}
SensorWhat is a sensor? A device that receives a stimulus and responds with anelectrical signal. A special type of transducer, device that converts one type ofenergy into another
Common Sensors Mechanical Accelerometers Gyroscopes Optical Photo Detectors Infrared Semiconductor Gas Temperature MagneticSensor Characteristics Range Accuracy Transfer Function Sensitivity Error
Actuators Device that turns energy (typically electrical) to motion. An actuator is a component of a machine that is responsiblefor moving and controlling a mechanism or system, forexample by opening a valve. In simple terms, it is a "mover". An actuator requires a control signal and a source of energy.Features:ForceSpeedTorquePowerEfficiency
ActivitiesActivity 1 : Blinking & Fading an LEDWhat is LED? An LED lamp or LED light bulb is an electric light for use in light fixtures thatproduces light using one or more light-emitting diodes (LEDs). LED lamps have a lifespan many times longer than equivalent incandescent lamps,and are significantly more efficient than most fluorescent lamps. The main semiconductor materials used to manufacture LEDs are: InGaN, AlGaInP,AlGaAs, GaPLEDApplications
Circuit Connections
Code & Explanation/*LED Blink Experiment */int led =9; // LED anode is connected to Arduino Pin 9void setup(){pinMode(led,OUTPUT); // Initialize the digital pin as an output}// The loop routine runs over and over again forever:void loop(){digitalWrite(led,HIGH); // turn the LED on by making voltage HIGHdelay(1000); // wait for a seconddigitalWrite(led,LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second}
Activity 2 : PotentiometerPotentiometer A potentiometer is a three-terminal resistor with a sliding or rotatingcontact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variableresistor or rheostat.Applications: Controllers Audio Systems Measuring Devices Tuners & Calibrators
Circuit Connections
Code & Explanation/* Program to control LED by varying the pulse width */int potPin = 2; // select input pin A2 for the potint ledPin = 13; // select output pin 13 for the LEDint val = 0; // variable to store pot voltagevoid setup() {pinMode(ledPin, OUTPUT); // declare ledPin13 as anOUTPUT}void loop() {val = analogRead(potPin); // read pot voltage as integerdigitalWrite(ledPin, HIGH); // turn the ledPin ondelay(val); // stop the program for some timedigitalWrite(ledPin, LOW); // turn the ledPin offdelay(val); // stop the program for some time}
Activity 3 : Push Button SwitchSwitch A switch is an electrical component that can "make" or "break" anelectrical circuit, interrupting the current or diverting it from one conductorto another. The mechanism of a switch removes or restores the conducting path in acircuit when it is operated. It may be operated manually, for example, a light switch or a keyboardbutton, may be operated by a moving object such as a door, or may beoperated by some sensing element for pressure, temperature or flow.
Circuit Connections
Code & Explanation// Program for Push Button with LED// set pin numbers:const int buttonPin = 7; // Pushbutton pinconst int ledPin = 9; // LED pin// variables will change:int buttonState = 0;// variable reads pushbutton statusvoid setup() {pinMode(ledPin, OUTPUT);// initialize the LED pin as an outputpinMode(buttonPin, INPUT);// initialize the pushbutton pin as an input}void loop(){buttonState =digitalRead(buttonPin);// read the state of the pushbutton value// if it is, the buttonState is HIGH:if (buttonState == HIGH) {// check if the pushbutton is presseddigitalWrite(ledPin, HIGH);// turn LED on}else{digitalWrite(ledPin, LOW); // turnLED off}}
Activity 3.1 : InterruptInterrupt Introduction An interrupt, in microcontroller context, is a signal that temporarily stops whatthe CPU is currently working at. A typical Arduino sketch consists of setup() and loop() functions. When asketch is executed, the top most lines are run first. So logicallythe setup() function is run before the loop() function. Although it’s far morecommon to have headers for libraries above setup() which are of course cateredfirst by the compiler. The loop() function is an endless loop so there is no wayto exit it. If we will now use interrupts, we add a third function named isr(). ISR is shortfor Interrupt Service Routine. This is where the program jumps to wheneverthere is an interrupt. When does the program jump to isr()? Arduino Uno Digital Pins: 2 & 3 usable for interrupts attachInterrupt(digitalPinToInterrupt(interruptPin), isr, CHANGE);void setup(){}void loop(){}void isr(){}
Code & Explanation//Program for Arduino Interrupt//Make connections as per the code ! const byte ledPin = 13;const byte interruptPin = 2;volatile byte state = LOW;void setup() {pinMode(ledPin, OUTPUT);pinMode(interruptPin, INPUT_PULLUP);attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); //Interrupt}void loop() {digitalWrite(ledPin, state);}void blink() { //ISRstate = !state;}
Activity 4 : Controlling an RGB LEDRGB LED RGB LED means Red, Blue and Green Light Emitting Diode. By configuring the intensity of each LED, other colours can be produced.There are two kinds of RGB LEDs: common anode LED and commoncathode LED.Applications: Interior Lighting Signs & Displays Designer Decorations
Circuit Connections
Code & Explanation/* Program to control RGBLED */int redPin = 11;int greenPin = 10;int bluePin = 9;void setup(){pinMode(redPin, OUTPUT);pinMode(greenPin,OUTPUT);pinMode(bluePin, OUTPUT);}void loop(){setColor(255, 0, 0); // reddelay(1000);setColor(0, 255, 0); //greendelay(1000);setColor(0, 0, 255); //bluedelay(1000);// Next, we also get somesecondary colours!setColor(255, 255, 0); //yellowdelay(1000);setColor(80, 0, 80); //purpledelay(1000);setColor(0, 255, 255);// aquadelay(1000);}Void setColor(int red, intgreen, int blue){analogWrite(redPin, red);analogWrite(greenPin,green);analogWrite(bluePin,blue);}
Activity 5 : Piezo BuzzerPiezo Buzzer A buzzer or beeper is an audio signalling device, which may be mechanical,electromechanical, or piezoelectric (piezo for short). Typical uses of buzzers and beepers include alarm devices, timers, and confirmationof user input such as a mouse click or keystroke. Whenever an electric potential is applied across a piezoelectric material, a pressurevariation is generated. A piezo buzzer consists of piezo crystals in between twoconductors. When a potential difference is applied across these crystals, they pushone conductor and pull the other conductor by their internal property. Thecontinuous pull and push action generates a sharp sound wave.
Circuit Connections
Code & Explanation//A sketch to demonstrate the tone()function//Specify digital pin on the Arduino thatthe positive lead of piezo buzzer isattached.int piezoPin = 9;void setup() {}//close setupvoid loop() {/*Tone needs 2 arguments, but cantake three1) Pin#2) Frequency - this is in hertz (cyclesper second) which determines the pitchof the noise made3) Duration - how long teh toneplays */tone(piezoPin, 1000, 500);//tone(piezoPin, 1000, 500);//delay(1000);}
Activity 6 : LCD DisplayLCD LCD (Liquid Crystal Display) is a type of flat panel display which uses liquidcrystals in its primary form of operation. LCDs have a large and varying set of use cases for consumers and businesses, asthey can be commonly found in smartphones, televisions, computer monitors andinstrument panels.I2C Bus I2C stands for Inter Integrated Circuit A I2C bus is a bidirectional two-wiredserial bus which is used to transport the databetween integrated circuits.
Circuit Connections
Code & Explanation//Program for LCD Display with I2CBus#include <Wire.h>#include <LiquidCrystal_I2C.h>LiquidCrystal_I2C lcd(0x27,20,4); //set the LCD address to 0x27 for a 16chars and 2 line displayvoid setup(){lcd.init(); // initialize thelcdlcd.scrollDisplayLeft();// Print a message to the LCD.lcd.backlight();lcd.setCursor(2,0);lcd.print("Hello Everyone");lcd.setCursor(2,1);lcd.print("Welcome To DIC");}void loop(){}
Activity 7 : Alphanumeric KeypadAlphanumeric Keypad An alphanumeric keypad is a keyboard that contains both numbers andletters on the same keys. Typically, they are found on telephones and cellular phones.
Circuit Connections
Code & Explanation/* Program for Using Keypad with Arduino */#include <Keypad.h>#include <Wire.h>const byte Rows= 4;//number of rows on the keypad i.e. 4const byte Cols= 4;char keymap[Rows][Cols]={{'1', '2', '3','A'},{'4', '5', '6','B'},{'7', '8', '9','C'},{'*', '0', '#','D'}};//a char array is definedbyte rPins[Rows]= {9,8,7,6};//Rows 0 to 3byte cPins[Cols]= {5,4,3,2};//Columns 0 to 3// command for library for keypadKeypad kpd=Keypad(makeKeymap(keymap), rPins, cPins,Rows, Cols);void setup(){Serial.begin(9600); // serial monitor}//If key is pressed, this key is stored in'keypressed' variable’//If key is not equal to 'NO_KEY', then thiskey is printed outvoid loop() //main program{char keypressed = kpd.getKey();if (keypressed != NO_KEY){Serial.print(keypressed); // write this string onthe top row}}
Activity 8 : HC-05 Bluetooth ModuleBluetooth Bluetooth is a wireless technology standard for exchanging data betweenfixed and mobile devices over short distances using short-wavelength UHFradio waves in the industrial, scientific and medical radio bands, from 2.400to 2.485 GHz, and building personal area networks (PANs). It was originally conceived as a wireless alternative to RS-232 data cables.HC-05 Bluetooth Module HC‐05 module is an easy to use Bluetooth SPP(Serial Port Protocol) module, designed fortransparent wireless serial connection setup. The HC-05 Bluetooth Module can be used in aMaster or Slave configuration, making it a greatsolution for wireless communication.
AT Command Mode AT commands are instructions used to control a modem. AT is theabbreviation of ATtention. Every command line starts with "AT" or "at".Few commonly used AT commands are: AT : Check the connection AT+NAME : See default name AT+ADDR : see default address AT+VERSION : See version AT+UART : See baudrate AT+ROLE : See role of bt module (1=master/0=slave) AT+RESET : Reset and exit AT mode AT+ORGL : Restore factory settings AT+PSWD : see default password
AT Command Code//Make the Connections as per the code !#include <SoftwareSerial.h>SoftwareSerial BTSerial(5, 6); // RX | TXvoid setup(){Serial.begin(9600);Serial.println("Enter AT commands:");BTSerial.begin(38400); // HC-05 default speed in AT command more}void loop(){if (BTSerial.available()) // read from HC-05 and send to Serial MonitorSerial.write(BTSerial.read());if (Serial.available()) // Keep reading from Serial Monitor and send to HC-05BTSerial.write(Serial.read());}
Circuit Connections
Bluetooth Terminal App Download & Install BluetoothTerminal Apphttps://play.google.com/store/apps/details?id=Qwerty.BluetoothTerminal&hl=en_IN Open the app and pair the HC-05module to your mobile. Thepassword is: 1234 (default) Then select the Byte Stream modeout of the three modes that appear. Send “1” to ON the LED and “0”to OFF the LED. Thus the LED on the Arduino canbe controlled by the App throughBluetooth.
Code & Explanation/* Program to interface BluetoothModule with Arduino */#include <SoftwareSerial.h>SoftwareSerial mySerial(3, 2);int ledpin=13;int Data;void setup() {mySerial.begin(9600);pinMode(ledpin,OUTPUT);}void loop(){if (mySerial.available()){Data=mySerial.read();if(Data=='1'){digitalWrite(ledpin,HIGH);mySerial.println("LED On!");}else if (Data=='0'){digitalWrite(ledpin,LOW);mySerial.println("LED Off!");}}}
Recommended Books
Additional Resources1. https://www.arduino.cc/ - Arduino.cc is the home of Arduino platform. Ithas extensive learning materials such as Tutorials, References, code forusing Arduino, Forum where you can post questions on issues/problemsyou have in your projects, etc.2. http://makezine.com/ - Online page of Maker magazine, with lots ofinformation on innovative technology projects including Arduino.3. http://www.instructables.com/ - Lots of projects on technology and arts(including cooking), with step-by-instructions, photographs, and videos4. http://appinventor.mit.edu/ - It allows the budding computerprogrammers to build their own apps that can be run on Android devices. Itused a user-friendly graphical user-interface that allows drag-and-droptechnique to build applications that impacts the world.5. http://fritzing.org/ - Fritzing is open source computer aided design (CAD)software for electronic circuit design and printed circuit board (PCB)fabrication, especially with Arduino prototyping. It is an electronic designautomation (EDA) tool for circuit designers.
Desgin Innovation Centre,Indian Institute of Information Technology, Design &Manufacturing, Kancheepuram, Chennai – 600127E-mail: designinnovationcentre@gmail.com

Recommended

PPTX
Arduino
PPTX
Ardui no
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Introduction to the Arduino
PPTX
Basics of arduino uno
PPTX
Arduino Microcontroller
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PPTX
Introduction to arduino
PPS
What is Arduino ?
PPTX
PPT ON Arduino
PPT
Intro to Arduino
PPT
Arduino
PPT
Arduino presentation by_warishusain
PPTX
Introduction to arduino ppt main
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Introduction to Arduino
PDF
Introduction to arduino
PPTX
Introduction to Arduino
PDF
Introduction to Arduino Programming
PPTX
Lesson sample introduction to arduino
PPTX
Wi-Fi Esp8266 nodemcu
PPT
IoT with Arduino
PDF
Esp8266 basics
PPTX
Introduction to Node MCU
PPTX
Introduction to Arduino Microcontroller
PPTX
Iot based home automation
PPTX
Esp8266 NodeMCU
PPTX
Nodemcu - introduction
PPTX
embedded_in_Arduino_with_basic_embedded.pptx
PPT
Introduction to Arduino and Internet of Things

More Related Content

PPTX
Arduino
PPTX
Ardui no
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Introduction to the Arduino
PPTX
Basics of arduino uno
PPTX
Arduino Microcontroller
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PPTX
Introduction to arduino
Arduino
Ardui no
Introduction to Arduino Hardware and Programming
Introduction to the Arduino
Basics of arduino uno
Arduino Microcontroller
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Introduction to arduino

What's hot

PPS
What is Arduino ?
PPTX
PPT ON Arduino
PPT
Intro to Arduino
PPT
Arduino
PPT
Arduino presentation by_warishusain
PPTX
Introduction to arduino ppt main
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Introduction to Arduino
PDF
Introduction to arduino
PPTX
Introduction to Arduino
PDF
Introduction to Arduino Programming
PPTX
Lesson sample introduction to arduino
PPTX
Wi-Fi Esp8266 nodemcu
PPT
IoT with Arduino
PDF
Esp8266 basics
PPTX
Introduction to Node MCU
PPTX
Introduction to Arduino Microcontroller
PPTX
Iot based home automation
PPTX
Esp8266 NodeMCU
PPTX
Nodemcu - introduction
What is Arduino ?
PPT ON Arduino
Intro to Arduino
Arduino
Arduino presentation by_warishusain
Introduction to arduino ppt main
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Introduction to Arduino
Introduction to arduino
Introduction to Arduino
Introduction to Arduino Programming
Lesson sample introduction to arduino
Wi-Fi Esp8266 nodemcu
IoT with Arduino
Esp8266 basics
Introduction to Node MCU
Introduction to Arduino Microcontroller
Iot based home automation
Esp8266 NodeMCU
Nodemcu - introduction

Similar to Arduino Workshop Day 1 - Basic Arduino

PPTX
embedded_in_Arduino_with_basic_embedded.pptx
PPT
Introduction to Arduino and Internet of Things
PPT
introduciotn to arduino is very important
PPT
Intro_to_Arduino introductionn_-_v30.ppt
PPT
Arduino uno basics with pin diagram program
PPT
Intro_to_Arduino_with_coding_explained.ppt
PDF
Intro_to_Arduino_-_v30_1.pdf
PPTX
Intro_to_Arduino_Full_ppt_with_examples_and_excersices
PPT
Introductory level to Arduino programming
PPT
Arduino Introduction.ppt
PPT
Introduction to Arduino Version 3 Zero to Prototyping
PDF
Intro_to_AFrduinoFFFFFFFFFFF_-_v30_1.pdf
PPT
Intro to arduino
PPT
Intro_to_Arduino_-_v30 (3).ppt
PPT
Intro_to_Arduino_-_v30.ppt
PPT
IntrotoArduino.ppt
PPT
Intro_to_Arduino_v31_a_workshop_for_beginners
PPT
Intro_to_Arduino_-_v30dadasdadadadaasda.ppt
PPT
IntrotoArduino.ppt
PDF
Making things sense - Day 1 (May 2011)
embedded_in_Arduino_with_basic_embedded.pptx
Introduction to Arduino and Internet of Things
introduciotn to arduino is very important
Intro_to_Arduino introductionn_-_v30.ppt
Arduino uno basics with pin diagram program
Intro_to_Arduino_with_coding_explained.ppt
Intro_to_Arduino_-_v30_1.pdf
Intro_to_Arduino_Full_ppt_with_examples_and_excersices
Introductory level to Arduino programming
Arduino Introduction.ppt
Introduction to Arduino Version 3 Zero to Prototyping
Intro_to_AFrduinoFFFFFFFFFFF_-_v30_1.pdf
Intro to arduino
Intro_to_Arduino_-_v30 (3).ppt
Intro_to_Arduino_-_v30.ppt
IntrotoArduino.ppt
Intro_to_Arduino_v31_a_workshop_for_beginners
Intro_to_Arduino_-_v30dadasdadadadaasda.ppt
IntrotoArduino.ppt
Making things sense - Day 1 (May 2011)

Recently uploaded

DOCX
Introduction to the World of Computers (Hardware & Software)
PDF
Day 2 - Network Security ~ 2nd Sight Lab ~ Cloud Security Class ~ 2020
PDF
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
PPTX
Unit-4-ARTIFICIAL NEURAL NETWORKS.pptx ANN ppt Artificial neural network
PDF
Security Forum Sessions from Houston 2025 Event
PDF
Security Technologys: Access Control, Firewall, VPN
PDF
The year in review - MarvelClient in 2025
PDF
Vibe Coding vs. Spec-Driven Development [Free Meetup]
PDF
Making Sense of Raster: From Bit Depth to Better Workflows
PPTX
Coded Agents – with UiPath SDK + LangGraph [Virtual Hands-on Workshop]
PDF
API-First Architecture in Financial Systems
PDF
The major tech developments for 2026 by Pluralsight, a research and training ...
PDF
Unser Jahresrückblick – MarvelClient in 2025
PDF
Usage Control for Process Discovery through a Trusted Execution Environment
PPTX
Chapter 3 Introduction to number system.pptx
PPTX
Cloud-and-AI-Platform-FY26-Partner-Playbook.pptx
PPTX
AI in Cybersecurity: Digital Defense by Yasir Naveed Riaz
PDF
Session 1 - Solving Semi-Structured Documents with Document Understanding
PPTX
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
PDF
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape
Introduction to the World of Computers (Hardware & Software)
Day 2 - Network Security ~ 2nd Sight Lab ~ Cloud Security Class ~ 2020
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
Unit-4-ARTIFICIAL NEURAL NETWORKS.pptx ANN ppt Artificial neural network
Security Forum Sessions from Houston 2025 Event
Security Technologys: Access Control, Firewall, VPN
The year in review - MarvelClient in 2025
Vibe Coding vs. Spec-Driven Development [Free Meetup]
Making Sense of Raster: From Bit Depth to Better Workflows
Coded Agents – with UiPath SDK + LangGraph [Virtual Hands-on Workshop]
API-First Architecture in Financial Systems
The major tech developments for 2026 by Pluralsight, a research and training ...
Unser Jahresrückblick – MarvelClient in 2025
Usage Control for Process Discovery through a Trusted Execution Environment
Chapter 3 Introduction to number system.pptx
Cloud-and-AI-Platform-FY26-Partner-Playbook.pptx
AI in Cybersecurity: Digital Defense by Yasir Naveed Riaz
Session 1 - Solving Semi-Structured Documents with Document Understanding
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape

Arduino Workshop Day 1 - Basic Arduino

  • 1.
    WORKSHOP ON ARDUINODAY– 1: ARDUINO BASICSDESIGN INNOVATION CENTRE
  • 2.
    Free and Open-SourceSoftware (FOSS) Free and open-source software (FOSS) allows users and programmers to edit,modify or reuse the software's source code. This gives developers theopportunity to improve program functionality by modifying it. The term “free” indicates that the software does not have constraints oncopyrights. The term “open source” indicates the software is in its projectform, enabling easy software development from expert developerscollaborating worldwide without any need for reverse engineering. Some examples of FOSS include: Linux Kernel, Ubuntu, Nextcloud, GoogleChrome OS, Android OS, BSD, GIMP, Blender, OpenOffice, ChromeBrowser, Eclipse, etc.
  • 3.
    Why Was ArduinoDeveloped? Physical Computing – using components that can interact with people andwith the world around us The Arduino was originally developed for artists and designers to prototypeinteractive displays at Italy by Massimo Banzi and David Cuartielles in2005. Developed for non-scientists Minimalist programming “Forgiving” circuitry that can handle a wide variety of wiring errors
  • 4.
    What is ArduinoNot? It is not a chip (IC) It is not a board (PCB) It is not a company or a manufacturer It is not a programming language It is not a computer architecture(although it involves all of these things...)Official Definition: Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware and software. It'sintended for artists, designers, hobbyists, and anyone interested increating interactive objects or environments.
  • 5.
    So, What isArduino? It’s a movement, not a microcontroller Founded by Massimo Banzi and David Cuartielles in 2005 based on“Wiring Platform”, which dates to 2003 Open-source hardware platform Open source development environment Easy-to learn language andlibraries (based on Wiringlanguage) Integrated developmentenvironment (based onProcessing programmingenvironment) Available for Windows /Mac / Linux
  • 6.
    Why Arduino? Forwhatever reason, Arduino microcontrollers havebecome the de facto standard Strives for the balance between ease of use andusefulness1. Programming languages seen as majorobstacle2. Arduino C is a greatly simplified version ofC++ It is an open-source project, software/hardware isextremely accessible and very flexible to becustomized and extended Arduino is backed up by a growing onlinecommunity, lots of source code is already availableand we can share and post our examples for others touse, too! It is inexpensive and comes with free authoringsoftwareOriginal Arduino.cc Manufactured Arduino Uno: ₹ 2,400.00Electrical & Code compatible Arduino Uno Clone: ₹ 500.00
  • 7.
    Electricity ElectronicsBasic Concepts Voltage (V)Voltage, also called electromotive force, is the potential difference incharge between two points in an electrical field.It is measured in Volt (V). Current (I)Current is the rate at which electric charge flows past a point in a circuit. Inother words, current is the rate of flow of electric charge.It is measured in Ampere (A). Resistance (R)Resistance is a measure of theopposition to current flow in anelectrical circuit.It is measured in ohms, symbolizedby the Greek letter omega (Ω).
  • 8.
    Alternating Current &Direct Current Alternating Current (AC)Alternating current is defined as the flow of charge that changes directionperiodically. The result obtained will be, the voltage level also reverses along withthe current. Basically, AC is used to deliver power to industries, houses, officebuildings, etc. Direct current (DC)Direct current is the movement of electric charge carriers, i.e. electrons in aunidirectional flow. In DC, the intensity of the current will vary along with time,but the direction of movement stays the same in all time. Here DC is referred to avoltage whose polarity never reverses. DC power is widely used in low voltageapplications such as charging batteries, automotive applications, aircraftapplications.
  • 9.
    Ohm’s Law Therelationship between Voltage, Current and Resistance inany DC electrical circuit was firstly discovered by the Germanphysicist Georg Ohm. Ohm's law states that the current through a conductor betweentwo points is directly proportional to the voltage across the twopointsThe Power TriangleThe Ohm’s Law Triangle
  • 10.
    Current Flow ,Voltage Flow & Resistance AnalogiesWater = ChargePressure = Voltage (V)Flow = Current (I)Size of the Pipe = Resistance (R)
  • 11.
    Circuit An electroniccircuit is composed of individual electroniccomponents, such as resistors, transistors, capacitors, inductorsand diodes, connected by conductive wires or traces throughwhich electric current can flow. To be referred to as electronic,rather than electrical, generally at least one active componentmust be present. The word “circuit” is derived from the circle. An ElectricalCircuit must have a continuous loop from Power (Vcc) toGround (GND).
  • 12.
    Electronic Components ActiveComponentsThose devices or components whichrequired external source to theiroperation is called Active Components.For Example: Diode, Transistors,SCR, ICs, etc. Passive ComponentsThose devices or components which donot required external source to theiroperation is called PassiveComponents.For Example: Resistor, Capacitor,Inductor, LDR, etc.
  • 13.
    Resistor A resistoris a passive two-terminal electrical component thatimplements electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce current flow,adjust signal levels, to divide voltages, bias active elements, andterminate transmission lines, among other uses.
  • 14.
    Breadboard A breadboardis a solder-less device fortemporary prototype with electronics and testcircuit designs. Because the solder-less breadboard does notrequire soldering, it is reusable. This makes it easy to use for creatingtemporary prototypes and experimenting withcircuit design.
  • 15.
    Analog & DigitalSignalsWhat is analog ? It is continuous range of voltagevalues (not just 0 or 5V) Analog has many (infinite) valuesWhy convert to digital ? Because our microcontroller onlyunderstands digital. Digital has two values: on and off
  • 16.
    Arduino Uno &Its Parts
  • 17.
    ATMega328P MicrocontrollerCPU Speed:20MHzRAM: 2KBStorage: 32KBProgram MemoryI/O: Up to 23 GenericI/O, 6 are AnalogCapable, UART / I2C /SPI
  • 18.
  • 19.
    Microcontroller (µC, MCU)Computeron a single Integrated Chip Processor (CPU) Memory (RAM / ROM / Flash) I/O ports (USB, I2C, SPI, ADC)Common microcontroller families: Intel: 4004, 8008, etc. Atmel: AT and AVR Microchip: PIC ARM: (multiple manufacturers)Used in:Cell Phones, Toys, Household Appliances, Cars, Cameras, etc.
  • 20.
    Embedded SystemEmbedded SystemAn embedded system is a combination of computer hardware and software,either fixed in capability or programmable, designed for a specific function orfunctions within a larger system. Industrial machines, agricultural and process industry devices, automobiles,medical equipment, household appliances, vending machines and toys, as wellas mobile devices, are possible locations for an embedded system.
  • 21.
    Boot LoaderWhat's aboot loader?Microcontrollers are usually programmed througha programmer unless you have a piece of firmware in yourmicrocontroller that allows installing new firmware withoutthe need of an external programmer. This is called a bootloader.
  • 22.
    Communication: I2C, SPI1.I2C (Inter-Integrated Circuit) Speed = 100 kHz, 400 kHz, and 3.4MHz (not supported by Arduino) Two bi-directional lines: SDA &SCL Multiple slaves can share same bus2. SPI (Serial Peripheral Interface Bus) Speed = 1-100 MHz (clock/devicelimited) Four-wire bus: SCLK, MOSI, MISO &SS Multiple slaves can share same bus (buteach needs a dedicated SS, slave select)
  • 23.
    PWM & DutyCycle Pulse-width modulation (PWM) is used forcontrolling the amplitude of digital signals inorder to control devices and applicationsrequiring power or electricity. Duty cycle = Pulse Width / Wave Period
  • 24.
    Different Arduino BoardsArduino Uno Arduino Leonardo Arduino LilyPad Arduino Mega Arduino Nano Arduino Mini Arduino Mini Pro Arduino BT Arduino Due
  • 25.
    Different Arduino ShieldsTFTTouch ScreenData LoggerMotor/Servo ShieldEthernet ShieldAudio Wave ShieldCellular/GSM ShieldWifi ShieldProto-shield, etc.
  • 26.
    Getting Started withArduinoDownload Arduino compiler and development environment from:http://arduino.cc/en/Main/Software Current version: 1.8.10 Available for Windows, Mac OS X & Linux Downloadable as Installer & Zip File Before running Arduino, plug in your board using USB cable (external poweris not necessary) When USB device is not recognized, navigate to and select the appropriatedriver from the installation directory Run Arduino
  • 27.
    Arduino IDE(Integrated DevelopmentEnvironment)1. Verify2. Upload3. New4. Open5. Save6. Serial Monitor7. Sketch Name8. Code Area9. Message Area10. Text Console11. Board & Serial Port
  • 28.
    Setting Up ofArduino IDE The computercommunicatesto the Arduinomicrocontrollervia a serial portthrough a USB-Serial adapter. Check to makesure that thedrivers areproperlyinstalled.Step 1Settings: Tools  Board  Arduino UnoStep 2Settings: Tools  Settings: Tools  Serial Port  COM#(Arduino Uno)
  • 29.
    Arduino Sketch Structurevoidsetup()Will be executed only whenthe program begins (or resetbutton is pressed)void loop()Will be executed repeatedly
  • 30.
    Arduino Program DevelopmentBased on C++ without 80% ofthe instructions. A handful of new commands. Programs are called 'sketches'. Sketches need two functions: void setup( ) void loop( ) setup( ) runs first and once. loop( ) runs over and over,until power is lost or a newsketch is loaded.
  • 31.
    Important Functions pinMode(pin,mode)Designates the specified pin for input or output digitalWrite(pin, value)Sends a voltage level to the designated pin digitalRead(pin)Reads the current voltage level from the designated pin analogWrite(pin, value)Sends analog voltage of the range 0 to 1023 to the designated pin digitalRead(pin)Reads the current analog voltage of the range 0 to 1023 from the designatedpin delay(delaytime)pauses the execution of the program for the given amount of time Serial Commandsprint(), println(), write(), read(), begin(), end(), find()
  • 32.
    Variables A variableis a way of naming and storing a value for later use by theprogram, such as data from a sensor or an intermediate value used in acalculation.Declaration Before they are used, all variables have to be declared. Declaring a variablemeans defining its type, and optionally, setting an initial value (initializingthe variable). Variables do not have to be initialized (assigned a value)when they are declared, but it is often useful.8 bits 16 bits 32 bitsbytecharintunsigned intlongunsigned longfloat
  • 33.
    ConditionsIf Statement: Ifa certain condition is true, theset of statements enclosed in curly braces areexecuted. If the condition is false, then the set ofstatements are skipped during the execution.if(some variable ?? state){}If Else Statement makes an “either-or decision.The if statements checks a condition. If it is true,it executes a set of statements; if the condition isnot true, it executes other set of statements underelse.if (some variable ?? state){}else{}For Loop: If you want to repeatedly execute a setof statements for a specific number of times, thenyou can use a for loop.for(initialization; condition; expression){}While Loop executes a set of statements until theexpression inside the parentheses is falsewhile (some variable ?? value){}Do While Loop executes a set of statements onceand repeatedly execute the set if a certain conditionis true.do{} while (some variable ?? value);Switch Case Statement allows to execute onecode block among many alternatives.switch (expression)​{case 1:// statementsbreak;case 2:// statementsbreak;default: // default statements}
  • 34.
    Basic IDE Code//Basic blinking LEDint ledPin = 13;//Variable to store the pin numbervoid setup(){pinMode(ledPin, OUTPUT);//set ledPin as output}void loop(){digitalWrite(ledPin, HIGH);//LED ONdelay(1000); //Wait 1000ms (=1s)digitalWrite(ledPin, LOW);//LED OFFdelay(1000); //Wait 1000ms (=1s)}
  • 35.
    SensorWhat is asensor? A device that receives a stimulus and responds with anelectrical signal. A special type of transducer, device that converts one type ofenergy into another
  • 36.
    Common Sensors MechanicalAccelerometers Gyroscopes Optical Photo Detectors Infrared Semiconductor Gas Temperature MagneticSensor Characteristics Range Accuracy Transfer Function Sensitivity Error
  • 37.
    Actuators Device thatturns energy (typically electrical) to motion. An actuator is a component of a machine that is responsiblefor moving and controlling a mechanism or system, forexample by opening a valve. In simple terms, it is a "mover". An actuator requires a control signal and a source of energy.Features:ForceSpeedTorquePowerEfficiency
  • 38.
    ActivitiesActivity 1 :Blinking & Fading an LEDWhat is LED? An LED lamp or LED light bulb is an electric light for use in light fixtures thatproduces light using one or more light-emitting diodes (LEDs). LED lamps have a lifespan many times longer than equivalent incandescent lamps,and are significantly more efficient than most fluorescent lamps. The main semiconductor materials used to manufacture LEDs are: InGaN, AlGaInP,AlGaAs, GaPLEDApplications
  • 39.
  • 40.
    Code & Explanation/*LEDBlink Experiment */int led =9; // LED anode is connected to Arduino Pin 9void setup(){pinMode(led,OUTPUT); // Initialize the digital pin as an output}// The loop routine runs over and over again forever:void loop(){digitalWrite(led,HIGH); // turn the LED on by making voltage HIGHdelay(1000); // wait for a seconddigitalWrite(led,LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second}
  • 41.
    Activity 2 :PotentiometerPotentiometer A potentiometer is a three-terminal resistor with a sliding or rotatingcontact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variableresistor or rheostat.Applications: Controllers Audio Systems Measuring Devices Tuners & Calibrators
  • 42.
  • 43.
    Code & Explanation/*Program to control LED by varying the pulse width */int potPin = 2; // select input pin A2 for the potint ledPin = 13; // select output pin 13 for the LEDint val = 0; // variable to store pot voltagevoid setup() {pinMode(ledPin, OUTPUT); // declare ledPin13 as anOUTPUT}void loop() {val = analogRead(potPin); // read pot voltage as integerdigitalWrite(ledPin, HIGH); // turn the ledPin ondelay(val); // stop the program for some timedigitalWrite(ledPin, LOW); // turn the ledPin offdelay(val); // stop the program for some time}
  • 44.
    Activity 3 :Push Button SwitchSwitch A switch is an electrical component that can "make" or "break" anelectrical circuit, interrupting the current or diverting it from one conductorto another. The mechanism of a switch removes or restores the conducting path in acircuit when it is operated. It may be operated manually, for example, a light switch or a keyboardbutton, may be operated by a moving object such as a door, or may beoperated by some sensing element for pressure, temperature or flow.
  • 45.
  • 46.
    Code & Explanation//Program for Push Button with LED// set pin numbers:const int buttonPin = 7; // Pushbutton pinconst int ledPin = 9; // LED pin// variables will change:int buttonState = 0;// variable reads pushbutton statusvoid setup() {pinMode(ledPin, OUTPUT);// initialize the LED pin as an outputpinMode(buttonPin, INPUT);// initialize the pushbutton pin as an input}void loop(){buttonState =digitalRead(buttonPin);// read the state of the pushbutton value// if it is, the buttonState is HIGH:if (buttonState == HIGH) {// check if the pushbutton is presseddigitalWrite(ledPin, HIGH);// turn LED on}else{digitalWrite(ledPin, LOW); // turnLED off}}
  • 47.
    Activity 3.1 :InterruptInterrupt Introduction An interrupt, in microcontroller context, is a signal that temporarily stops whatthe CPU is currently working at. A typical Arduino sketch consists of setup() and loop() functions. When asketch is executed, the top most lines are run first. So logicallythe setup() function is run before the loop() function. Although it’s far morecommon to have headers for libraries above setup() which are of course cateredfirst by the compiler. The loop() function is an endless loop so there is no wayto exit it. If we will now use interrupts, we add a third function named isr(). ISR is shortfor Interrupt Service Routine. This is where the program jumps to wheneverthere is an interrupt. When does the program jump to isr()? Arduino Uno Digital Pins: 2 & 3 usable for interrupts attachInterrupt(digitalPinToInterrupt(interruptPin), isr, CHANGE);void setup(){}void loop(){}void isr(){}
  • 48.
    Code & Explanation//Programfor Arduino Interrupt//Make connections as per the code ! const byte ledPin = 13;const byte interruptPin = 2;volatile byte state = LOW;void setup() {pinMode(ledPin, OUTPUT);pinMode(interruptPin, INPUT_PULLUP);attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); //Interrupt}void loop() {digitalWrite(ledPin, state);}void blink() { //ISRstate = !state;}
  • 49.
    Activity 4 :Controlling an RGB LEDRGB LED RGB LED means Red, Blue and Green Light Emitting Diode. By configuring the intensity of each LED, other colours can be produced.There are two kinds of RGB LEDs: common anode LED and commoncathode LED.Applications: Interior Lighting Signs & Displays Designer Decorations
  • 50.
  • 51.
    Code & Explanation/*Program to control RGBLED */int redPin = 11;int greenPin = 10;int bluePin = 9;void setup(){pinMode(redPin, OUTPUT);pinMode(greenPin,OUTPUT);pinMode(bluePin, OUTPUT);}void loop(){setColor(255, 0, 0); // reddelay(1000);setColor(0, 255, 0); //greendelay(1000);setColor(0, 0, 255); //bluedelay(1000);// Next, we also get somesecondary colours!setColor(255, 255, 0); //yellowdelay(1000);setColor(80, 0, 80); //purpledelay(1000);setColor(0, 255, 255);// aquadelay(1000);}Void setColor(int red, intgreen, int blue){analogWrite(redPin, red);analogWrite(greenPin,green);analogWrite(bluePin,blue);}
  • 52.
    Activity 5 :Piezo BuzzerPiezo Buzzer A buzzer or beeper is an audio signalling device, which may be mechanical,electromechanical, or piezoelectric (piezo for short). Typical uses of buzzers and beepers include alarm devices, timers, and confirmationof user input such as a mouse click or keystroke. Whenever an electric potential is applied across a piezoelectric material, a pressurevariation is generated. A piezo buzzer consists of piezo crystals in between twoconductors. When a potential difference is applied across these crystals, they pushone conductor and pull the other conductor by their internal property. Thecontinuous pull and push action generates a sharp sound wave.
  • 53.
  • 54.
    Code & Explanation//Asketch to demonstrate the tone()function//Specify digital pin on the Arduino thatthe positive lead of piezo buzzer isattached.int piezoPin = 9;void setup() {}//close setupvoid loop() {/*Tone needs 2 arguments, but cantake three1) Pin#2) Frequency - this is in hertz (cyclesper second) which determines the pitchof the noise made3) Duration - how long teh toneplays */tone(piezoPin, 1000, 500);//tone(piezoPin, 1000, 500);//delay(1000);}
  • 55.
    Activity 6 :LCD DisplayLCD LCD (Liquid Crystal Display) is a type of flat panel display which uses liquidcrystals in its primary form of operation. LCDs have a large and varying set of use cases for consumers and businesses, asthey can be commonly found in smartphones, televisions, computer monitors andinstrument panels.I2C Bus I2C stands for Inter Integrated Circuit A I2C bus is a bidirectional two-wiredserial bus which is used to transport the databetween integrated circuits.
  • 56.
  • 57.
    Code & Explanation//Programfor LCD Display with I2CBus#include <Wire.h>#include <LiquidCrystal_I2C.h>LiquidCrystal_I2C lcd(0x27,20,4); //set the LCD address to 0x27 for a 16chars and 2 line displayvoid setup(){lcd.init(); // initialize thelcdlcd.scrollDisplayLeft();// Print a message to the LCD.lcd.backlight();lcd.setCursor(2,0);lcd.print("Hello Everyone");lcd.setCursor(2,1);lcd.print("Welcome To DIC");}void loop(){}
  • 58.
    Activity 7 :Alphanumeric KeypadAlphanumeric Keypad An alphanumeric keypad is a keyboard that contains both numbers andletters on the same keys. Typically, they are found on telephones and cellular phones.
  • 59.
  • 60.
    Code & Explanation/*Program for Using Keypad with Arduino */#include <Keypad.h>#include <Wire.h>const byte Rows= 4;//number of rows on the keypad i.e. 4const byte Cols= 4;char keymap[Rows][Cols]={{'1', '2', '3','A'},{'4', '5', '6','B'},{'7', '8', '9','C'},{'*', '0', '#','D'}};//a char array is definedbyte rPins[Rows]= {9,8,7,6};//Rows 0 to 3byte cPins[Cols]= {5,4,3,2};//Columns 0 to 3// command for library for keypadKeypad kpd=Keypad(makeKeymap(keymap), rPins, cPins,Rows, Cols);void setup(){Serial.begin(9600); // serial monitor}//If key is pressed, this key is stored in'keypressed' variable’//If key is not equal to 'NO_KEY', then thiskey is printed outvoid loop() //main program{char keypressed = kpd.getKey();if (keypressed != NO_KEY){Serial.print(keypressed); // write this string onthe top row}}
  • 61.
    Activity 8 :HC-05 Bluetooth ModuleBluetooth Bluetooth is a wireless technology standard for exchanging data betweenfixed and mobile devices over short distances using short-wavelength UHFradio waves in the industrial, scientific and medical radio bands, from 2.400to 2.485 GHz, and building personal area networks (PANs). It was originally conceived as a wireless alternative to RS-232 data cables.HC-05 Bluetooth Module HC‐05 module is an easy to use Bluetooth SPP(Serial Port Protocol) module, designed fortransparent wireless serial connection setup. The HC-05 Bluetooth Module can be used in aMaster or Slave configuration, making it a greatsolution for wireless communication.
  • 62.
    AT Command ModeAT commands are instructions used to control a modem. AT is theabbreviation of ATtention. Every command line starts with "AT" or "at".Few commonly used AT commands are: AT : Check the connection AT+NAME : See default name AT+ADDR : see default address AT+VERSION : See version AT+UART : See baudrate AT+ROLE : See role of bt module (1=master/0=slave) AT+RESET : Reset and exit AT mode AT+ORGL : Restore factory settings AT+PSWD : see default password
  • 63.
    AT Command Code//Makethe Connections as per the code !#include <SoftwareSerial.h>SoftwareSerial BTSerial(5, 6); // RX | TXvoid setup(){Serial.begin(9600);Serial.println("Enter AT commands:");BTSerial.begin(38400); // HC-05 default speed in AT command more}void loop(){if (BTSerial.available()) // read from HC-05 and send to Serial MonitorSerial.write(BTSerial.read());if (Serial.available()) // Keep reading from Serial Monitor and send to HC-05BTSerial.write(Serial.read());}
  • 64.
  • 65.
    Bluetooth Terminal AppDownload & Install BluetoothTerminal Apphttps://play.google.com/store/apps/details?id=Qwerty.BluetoothTerminal&hl=en_IN Open the app and pair the HC-05module to your mobile. Thepassword is: 1234 (default) Then select the Byte Stream modeout of the three modes that appear. Send “1” to ON the LED and “0”to OFF the LED. Thus the LED on the Arduino canbe controlled by the App throughBluetooth.
  • 66.
    Code & Explanation/*Program to interface BluetoothModule with Arduino */#include <SoftwareSerial.h>SoftwareSerial mySerial(3, 2);int ledpin=13;int Data;void setup() {mySerial.begin(9600);pinMode(ledpin,OUTPUT);}void loop(){if (mySerial.available()){Data=mySerial.read();if(Data=='1'){digitalWrite(ledpin,HIGH);mySerial.println("LED On!");}else if (Data=='0'){digitalWrite(ledpin,LOW);mySerial.println("LED Off!");}}}
  • 67.
  • 68.
    Additional Resources1. https://www.arduino.cc/- Arduino.cc is the home of Arduino platform. Ithas extensive learning materials such as Tutorials, References, code forusing Arduino, Forum where you can post questions on issues/problemsyou have in your projects, etc.2. http://makezine.com/ - Online page of Maker magazine, with lots ofinformation on innovative technology projects including Arduino.3. http://www.instructables.com/ - Lots of projects on technology and arts(including cooking), with step-by-instructions, photographs, and videos4. http://appinventor.mit.edu/ - It allows the budding computerprogrammers to build their own apps that can be run on Android devices. Itused a user-friendly graphical user-interface that allows drag-and-droptechnique to build applications that impacts the world.5. http://fritzing.org/ - Fritzing is open source computer aided design (CAD)software for electronic circuit design and printed circuit board (PCB)fabrication, especially with Arduino prototyping. It is an electronic designautomation (EDA) tool for circuit designers.
  • 69.
    Desgin Innovation Centre,IndianInstitute of Information Technology, Design &Manufacturing, Kancheepuram, Chennai – 600127E-mail: designinnovationcentre@gmail.com

[8]ページ先頭

©2009-2025 Movatter.jp