Movatterモバイル変換


[0]ホーム

URL:


Punit Goswami, profile picture
Uploaded byPunit Goswami
PPTX, PDF4,643 views

Arduino and c programming

This document provides a comprehensive overview of the Arduino platform, including the hardware components of the Arduino board, such as microcontrollers, input/output pins, and programming interfaces. It outlines the software environment, particularly the Arduino IDE, which facilitates coding in C/C++, and explains the use of shields for enhanced functionality. Additionally, the document discusses debugging techniques and methodologies relevant to developing IoT systems with Arduino.

Embed presentation

Downloaded 487 times
INTERNET OF THINGS:ARDUINO AND CPROGRAMMINGCOMBINING THE TANGIBLE AND THE VOLATILE INTO ONEPunit Goswami
ARDUINO ENVIRONMENTTHE ARDUINO BOARD, ITS SOFTWARE COMPONENT AND OTHER ADD-ON HARDWARE
ARDUINO DEVELOPMENT BOARD• Eight bit microcontroller – brain of the board• USB Port – to communicate with the desktop/laptop• USB controller chip – manages USB transferred data• IO pins – board’s connection to the outside world• Quartz oscillator – board’s time keeper• Reset button – taking the board back to its initial state• External power jack – power from dedicated sourceCo-axial jack, but USB can also be used
INPUT/OUTPUT PINS (I/O PINS) Top and bottom rows of the board Holes in the board which we can stick wires in Holes are connected to the chips through traces on-board 14 Digital I/O pins on top [0-13]Highs – 5 volts Lows – 0 volts Max Current - 40 mA 6 Analog input pins on the bottom [A0 – A5] Power output pins on the bottom [ 5v , 3.3 v ] Reset pin to reset the board to initial state
MICROCONTROLLERS Two microcontrollers on the board Main ATmega328 – 8 bit microcontrollerUser programmable, runs user-written application codeCarries firmware, like bootloader ATmega16U2Handles the communication with the USB interface, notdirectly accessible
STORAGE & MEMORY Non-volatile flash memory for storage 32 kilobytes in size Static Random Access Memory (SRAM) for memory (volatile) 3 kilobytes in size
CLOCK 16 MHz clock speed ~ 16 million operations per second Helps synchronize all components together Keeping track of occurrence of events
PROGRAMMING FIRMWARE The ISCP headers can be used to program the firmware onthe board ICSP1 for the main ATmega328 microcontroller ICSP2 for the ATmega16U2 microcontroller Special equipment are required in order to re-program thefirmware through these headers
SOFTWARE ENVIRONMENT• Arduino IDE – Integrated Development Environment• Can be programmed using other IDEs too, like Eclipse• Arduino IDE is more versatile• Needs no special drivers or additional components• Available for Windows, Linux and Mac• Cross compiler – compiles for a different target platform than the one being programmed on
IDE – SOFTWARE TOOL FOR PROGRAMMING File operations and other general options on top Buttons for most commonly used options (Verify, Upload, etc.) Main window – Text editor for writing code Message area – for messages to the programmer
OPTIONS BUTTONSButtons on the top have the most common ,useful operations Verify – compiles the code and checks for errors Uploads – compiles the code, uploads it to the board. Works onlyif the board is connected New – creates a new sketch, a new program Open – opens an existing sketch Save – saves the current sketch in the directory of your choice Serial Monitor – opens window to communicate with the board
TARGET PLATFORM• ATmega328 – Arduino Uno’s processor• Arduino shields – add on hardware for specific purposes• Shields need no complicated circuitry – prewired• Stacks of shields on top of the Arduino• Prefabricated libraries of methods
ARDUINO SHIELDSThe prominent reason that Arduino got so popular Additional hardware to do particular, complex tasks Form of separate boards Pre-wired pins that stick into holes in Arduino Stack on top of the Arduino to make connections Pre-written functions for operations of these boards Open-source designs in most of the cases, third partyComplete list of shields at http://www.shieldlist.org
OPEN SOURCE• Hardware – the board’s design is open sourcehttp://www.arduino.cc• Software – the IDE is open source, written in Java, modifiable, redistributable• Open source community – easily available codes and help on troubleshooting
SETTING UP THE ENVIRONMENTLEARNING TO CODE IN C/C++ FOR ARDUINO
RUNNING IDE ON WINDOWS Emacs or NotePad++ text editor Gcc C compiler The debugger, gdbIDE provides one-stop solution
ARDUINO IDE Require Java Runtime Environment Write codes in general C language setup() – Initiates the variables and sets up device instances loop() – Runs the code that contains operations andmanipulations, iterates infinitely
BLINK LED EXAMPLE Pin 13 is represented by numeral 13 digitalWrite() writes voltage values to pins delay() sets delays in milliseconds HIGH – 5v LOW – 0v
ARDUINO PROGRAMS AND THE BUILD PROCESSHOW IT IS SAME BUT DIFFERENT TO CODE FOR THE BOARDS
SourcecodeExecutablefileHex fileUploadedto boardARDUINO TOOLCHAINSteps taken post code authoring Source code(sketch) is compiled to an executable format Executable file is linked with libraries and interpreted into ahex file Hex file is uploaded to boardStarts executing right away
CROSS COMPILATIONCompile on one machine, but the target is another machine.E.g.: compiling it on an Intel processor, compiling it for an AVR processor avr-gcc – C compiler for AVR targets, gives a *.o file avr-lnk – links library object files, results in a *.elf file avr-objcopy – change the *.elf file into Arduino compatible *.hex file
DEBUGGING AND TROUBLESHOOTINGREMOVING ERRORS AND TAKING CARE OF REPAIR AND MAINTENANCE
DEBUGGING• Finding reasons of erroneous execution or failure of execution• Software problems• Require ‘controllability’ and ‘observability’• Controllability: the ability to control sources of data that are used by the systemAllows to do testing to test certain circumstances that might be causing a bug or triggering a bug atany rate• Observability: the ability to observe intermediate and final resultsAn oscilloscope, multi-meter, or the serial monitor could be used
REAL TIME MONITORING• Includes dynamic observation of the target and its state• Viewing data about the execution as it occurs• Not intrusive in terms of performance• Important for timing constraint IoT systems• Provides timing and functional accuracy
REMOTE DEBUGGINGRemote Debugger• Host computer acts as debugger for a code that runs on the remote target system• Host computer are also the systems that the programmer programs on• Host provides the platform to interface with the debugging environment.• Provides good run control, not good for testing timingEmbedded Debug Interface• Seen in modern processors, Arduino and its likes have trace macrocells• Built in to the processor• Hardware dedicated to do debugging directly
SERIAL PROTOCOLS FOR DEBUGGING• UART: Universal Asynchronous Receiver/Transmitter, an old protocol, still useful though.• Low hardware overhead• Transmits at 9600 baud• START and STOP buts are used for synchronization• The bits in between a START bit and the next STOP bit is the data• To distinguish, the receiver samples at 16 times higher rate than the baud rate• Serial interface can be used to both send data to and from the Arduino board

Recommended

PPTX
Introduction to Arduino Microcontroller
PPS
What is Arduino ?
PPTX
Introduction to the Arduino
PPTX
Arduino Microcontroller
PPTX
Introduction to Arduino
PPT
Arduino presentation by_warishusain
PPTX
Arduino slides
PPTX
PPT ON Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Arduino
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Memories in digital electronics
PPTX
Introduction to Arduino
PPTX
Lesson sample introduction to arduino
PPTX
Embedded c
PPTX
Embedded system design process
PPT
PDF
Embedded C - Lecture 1
PPTX
microcontroller vs microprocessor
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PDF
Seven segment interfacing with 8051.pdf
PPTX
LPC 2148 ARM MICROCONTROLLER
PPT
Interrupts for PIC18
PDF
Embedded C programming based on 8051 microcontroller
PPTX
Embedded System Tools ppt
PPT
Interfacing LCD with 8051 Microcontroller
PPT
Arduino Platform with C programming.
PPTX
Arduino: On-board components description, IDE and Programming

More Related Content

PPTX
Introduction to Arduino Microcontroller
PPS
What is Arduino ?
PPTX
Introduction to the Arduino
PPTX
Arduino Microcontroller
PPTX
Introduction to Arduino
PPT
Arduino presentation by_warishusain
PPTX
Arduino slides
Introduction to Arduino Microcontroller
What is Arduino ?
Introduction to the Arduino
Arduino Microcontroller
Introduction to Arduino
Arduino presentation by_warishusain
Arduino slides

What's hot

PPTX
PPT ON Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Arduino
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Memories in digital electronics
PPTX
Introduction to Arduino
PPTX
Lesson sample introduction to arduino
PPTX
Embedded c
PPTX
Embedded system design process
PPT
PDF
Embedded C - Lecture 1
PPTX
microcontroller vs microprocessor
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PDF
Seven segment interfacing with 8051.pdf
PPTX
LPC 2148 ARM MICROCONTROLLER
PPT
Interrupts for PIC18
PDF
Embedded C programming based on 8051 microcontroller
PPTX
Embedded System Tools ppt
PPT
Interfacing LCD with 8051 Microcontroller
PPT ON Arduino
Introduction to Arduino Hardware and Programming
Arduino
Arduino Workshop Day 1 - Basic Arduino
 
Memories in digital electronics
Introduction to Arduino
Lesson sample introduction to arduino
Embedded c
Embedded system design process
Embedded C - Lecture 1
microcontroller vs microprocessor
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Seven segment interfacing with 8051.pdf
LPC 2148 ARM MICROCONTROLLER
Interrupts for PIC18
Embedded C programming based on 8051 microcontroller
Embedded System Tools ppt
Interfacing LCD with 8051 Microcontroller

Similar to Arduino and c programming

PPT
Arduino Platform with C programming.
PPTX
Arduino: On-board components description, IDE and Programming
PDF
Introduction of Arduino Uno
PPT
Embedded system programming using Arduino microcontroller
PDF
Introduction to Arduino
PDF
aurduino-200107075953.pdf
PPTX
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
PPTX
Internet of Things prescribed by University
PDF
introductiontoarduino-111120102058-phpapp02.pdf
DOCX
Winter traning arduino report final
PPTX
Arduino
PDF
4 Introduction to Arduino.pdf
PPTX
INTRODUCTION_TO_ARDUINO uno, applications
PPT
ARDUINO presentation by Bamidele Samuel.ppt
PDF
Arduino Development For Beginners
PPTX
Up and running with Arduino
 
PDF
Oop 2014 embedded systems with open source hardware v2
PPT
ARDUINO_presentation
PPT
ARDUINO_presentation_by_Ravishankar_Pati.ppt
PDF
arduino
Arduino Platform with C programming.
Arduino: On-board components description, IDE and Programming
Introduction of Arduino Uno
Embedded system programming using Arduino microcontroller
Introduction to Arduino
aurduino-200107075953.pdf
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Internet of Things prescribed by University
introductiontoarduino-111120102058-phpapp02.pdf
Winter traning arduino report final
Arduino
4 Introduction to Arduino.pdf
INTRODUCTION_TO_ARDUINO uno, applications
ARDUINO presentation by Bamidele Samuel.ppt
Arduino Development For Beginners
Up and running with Arduino
 
Oop 2014 embedded systems with open source hardware v2
ARDUINO_presentation
ARDUINO_presentation_by_Ravishankar_Pati.ppt
arduino

Recently uploaded

PPTX
Salesforce Bulk Connector V1 and V2 Deep Dive!
PPTX
Best CMMS for IoT Integration: Real-Time Asset Intelligence & Smart Maintenan...
PPTX
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
PPTX
UnrealGameplayAbilitySystemPresentation.pptx
PDF
Albert Pintoy - Specializing In Low-Latency
PPT
new Introduction to PACS.ppt Picture Archieving and communication and medicine
PPTX
Step-by-step guide to designing standard a microbiology laboratory in pharmac...
PPTX
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
PPTX
Revolutionizing Facilities Management with MaintWiz — AI CMMS for Smart FMaaS
PPTX
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
PDF
ACI 318-2205_American Concrete Institute.pdf
PDF
Enhancing Distributed Authorization with Lagrange Interpolation and Attribute...
PDF
Presentation-on-Energy-Transition-in-Bangladesh-Employment-and-Skills.pdf
PPTX
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
PPT
63490613-Boiler-Tube-Leakage-analysis-symptoms-causes.ppt
PPTX
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
PDF
Hybrid Anomaly Detection Mechanism for IOT Networks
PDF
AI-Driven CTI for Business: Emerging Threats, Attack Strategies, and Defensiv...
PDF
Advanced Intrusion Detection and Classification using Transfer Learning with ...
PPTX
Vertical turbine pump explains installed in power plants
Salesforce Bulk Connector V1 and V2 Deep Dive!
Best CMMS for IoT Integration: Real-Time Asset Intelligence & Smart Maintenan...
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
UnrealGameplayAbilitySystemPresentation.pptx
Albert Pintoy - Specializing In Low-Latency
new Introduction to PACS.ppt Picture Archieving and communication and medicine
Step-by-step guide to designing standard a microbiology laboratory in pharmac...
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
Revolutionizing Facilities Management with MaintWiz — AI CMMS for Smart FMaaS
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
ACI 318-2205_American Concrete Institute.pdf
Enhancing Distributed Authorization with Lagrange Interpolation and Attribute...
Presentation-on-Energy-Transition-in-Bangladesh-Employment-and-Skills.pdf
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
63490613-Boiler-Tube-Leakage-analysis-symptoms-causes.ppt
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
Hybrid Anomaly Detection Mechanism for IOT Networks
AI-Driven CTI for Business: Emerging Threats, Attack Strategies, and Defensiv...
Advanced Intrusion Detection and Classification using Transfer Learning with ...
Vertical turbine pump explains installed in power plants

Arduino and c programming

  • 1.
    INTERNET OF THINGS:ARDUINOAND CPROGRAMMINGCOMBINING THE TANGIBLE AND THE VOLATILE INTO ONEPunit Goswami
  • 2.
    ARDUINO ENVIRONMENTTHE ARDUINOBOARD, ITS SOFTWARE COMPONENT AND OTHER ADD-ON HARDWARE
  • 3.
    ARDUINO DEVELOPMENT BOARD•Eight bit microcontroller – brain of the board• USB Port – to communicate with the desktop/laptop• USB controller chip – manages USB transferred data• IO pins – board’s connection to the outside world• Quartz oscillator – board’s time keeper• Reset button – taking the board back to its initial state• External power jack – power from dedicated sourceCo-axial jack, but USB can also be used
  • 4.
    INPUT/OUTPUT PINS (I/OPINS) Top and bottom rows of the board Holes in the board which we can stick wires in Holes are connected to the chips through traces on-board 14 Digital I/O pins on top [0-13]Highs – 5 volts Lows – 0 volts Max Current - 40 mA 6 Analog input pins on the bottom [A0 – A5] Power output pins on the bottom [ 5v , 3.3 v ] Reset pin to reset the board to initial state
  • 5.
    MICROCONTROLLERS Two microcontrollerson the board Main ATmega328 – 8 bit microcontrollerUser programmable, runs user-written application codeCarries firmware, like bootloader ATmega16U2Handles the communication with the USB interface, notdirectly accessible
  • 6.
    STORAGE & MEMORYNon-volatile flash memory for storage 32 kilobytes in size Static Random Access Memory (SRAM) for memory (volatile) 3 kilobytes in size
  • 7.
    CLOCK 16 MHzclock speed ~ 16 million operations per second Helps synchronize all components together Keeping track of occurrence of events
  • 8.
    PROGRAMMING FIRMWARE TheISCP headers can be used to program the firmware onthe board ICSP1 for the main ATmega328 microcontroller ICSP2 for the ATmega16U2 microcontroller Special equipment are required in order to re-program thefirmware through these headers
  • 9.
    SOFTWARE ENVIRONMENT• ArduinoIDE – Integrated Development Environment• Can be programmed using other IDEs too, like Eclipse• Arduino IDE is more versatile• Needs no special drivers or additional components• Available for Windows, Linux and Mac• Cross compiler – compiles for a different target platform than the one being programmed on
  • 10.
    IDE – SOFTWARETOOL FOR PROGRAMMING File operations and other general options on top Buttons for most commonly used options (Verify, Upload, etc.) Main window – Text editor for writing code Message area – for messages to the programmer
  • 11.
    OPTIONS BUTTONSButtons onthe top have the most common ,useful operations Verify – compiles the code and checks for errors Uploads – compiles the code, uploads it to the board. Works onlyif the board is connected New – creates a new sketch, a new program Open – opens an existing sketch Save – saves the current sketch in the directory of your choice Serial Monitor – opens window to communicate with the board
  • 12.
    TARGET PLATFORM• ATmega328– Arduino Uno’s processor• Arduino shields – add on hardware for specific purposes• Shields need no complicated circuitry – prewired• Stacks of shields on top of the Arduino• Prefabricated libraries of methods
  • 13.
    ARDUINO SHIELDSThe prominentreason that Arduino got so popular Additional hardware to do particular, complex tasks Form of separate boards Pre-wired pins that stick into holes in Arduino Stack on top of the Arduino to make connections Pre-written functions for operations of these boards Open-source designs in most of the cases, third partyComplete list of shields at http://www.shieldlist.org
  • 14.
    OPEN SOURCE• Hardware– the board’s design is open sourcehttp://www.arduino.cc• Software – the IDE is open source, written in Java, modifiable, redistributable• Open source community – easily available codes and help on troubleshooting
  • 15.
    SETTING UP THEENVIRONMENTLEARNING TO CODE IN C/C++ FOR ARDUINO
  • 16.
    RUNNING IDE ONWINDOWS Emacs or NotePad++ text editor Gcc C compiler The debugger, gdbIDE provides one-stop solution
  • 17.
    ARDUINO IDE RequireJava Runtime Environment Write codes in general C language setup() – Initiates the variables and sets up device instances loop() – Runs the code that contains operations andmanipulations, iterates infinitely
  • 18.
    BLINK LED EXAMPLEPin 13 is represented by numeral 13 digitalWrite() writes voltage values to pins delay() sets delays in milliseconds HIGH – 5v LOW – 0v
  • 19.
    ARDUINO PROGRAMS ANDTHE BUILD PROCESSHOW IT IS SAME BUT DIFFERENT TO CODE FOR THE BOARDS
  • 20.
    SourcecodeExecutablefileHex fileUploadedto boardARDUINOTOOLCHAINSteps taken post code authoring Source code(sketch) is compiled to an executable format Executable file is linked with libraries and interpreted into ahex file Hex file is uploaded to boardStarts executing right away
  • 21.
    CROSS COMPILATIONCompile onone machine, but the target is another machine.E.g.: compiling it on an Intel processor, compiling it for an AVR processor avr-gcc – C compiler for AVR targets, gives a *.o file avr-lnk – links library object files, results in a *.elf file avr-objcopy – change the *.elf file into Arduino compatible *.hex file
  • 22.
    DEBUGGING AND TROUBLESHOOTINGREMOVINGERRORS AND TAKING CARE OF REPAIR AND MAINTENANCE
  • 23.
    DEBUGGING• Finding reasonsof erroneous execution or failure of execution• Software problems• Require ‘controllability’ and ‘observability’• Controllability: the ability to control sources of data that are used by the systemAllows to do testing to test certain circumstances that might be causing a bug or triggering a bug atany rate• Observability: the ability to observe intermediate and final resultsAn oscilloscope, multi-meter, or the serial monitor could be used
  • 24.
    REAL TIME MONITORING•Includes dynamic observation of the target and its state• Viewing data about the execution as it occurs• Not intrusive in terms of performance• Important for timing constraint IoT systems• Provides timing and functional accuracy
  • 25.
    REMOTE DEBUGGINGRemote Debugger•Host computer acts as debugger for a code that runs on the remote target system• Host computer are also the systems that the programmer programs on• Host provides the platform to interface with the debugging environment.• Provides good run control, not good for testing timingEmbedded Debug Interface• Seen in modern processors, Arduino and its likes have trace macrocells• Built in to the processor• Hardware dedicated to do debugging directly
  • 26.
    SERIAL PROTOCOLS FORDEBUGGING• UART: Universal Asynchronous Receiver/Transmitter, an old protocol, still useful though.• Low hardware overhead• Transmits at 9600 baud• START and STOP buts are used for synchronization• The bits in between a START bit and the next STOP bit is the data• To distinguish, the receiver samples at 16 times higher rate than the baud rate• Serial interface can be used to both send data to and from the Arduino board

Editor's Notes

  • #9 In circuit serial programmer

[8]ページ先頭

©2009-2025 Movatter.jp