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

PPS
What is Arduino ?
PPTX
Introduction to the Arduino
PPTX
Arduino Microcontroller
PPT
Arduino presentation by_warishusain
PPTX
Introduction to Arduino Microcontroller
PPTX
Arduino slides
PPTX
Introduction to Arduino
PPTX
Arduino course
PPTX
PPT ON Arduino
PPTX
Introduction to Arduino Hardware and Programming
ODP
Introduction to Arduino
PPT
ARDUINO AND ITS PIN CONFIGURATION
PPTX
Lesson sample introduction to arduino
PPTX
Introduction to arduino ppt main
PPTX
Arduino
PPT
Intro to Arduino
PPTX
Introduction to Arduino
 
PDF
Arduino presentation
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PPTX
Embedded c
PPTX
Introduction to Arduino
PDF
Verilog lab manual (ECAD and VLSI Lab)
PPTX
Arduino Functions
PDF
Ins and Outs of GPIO Programming
byICS
 
PPTX
Presentation on Flip Flop
PPTX
Arduino Introduction (Blinking LED) Presentation (workshop #5)
PPT
basic logic gates
PPTX
Arduino
PPT
Arduino Platform with C programming.

More Related Content

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

What's hot

PPTX
Arduino course
PPTX
PPT ON Arduino
PPTX
Introduction to Arduino Hardware and Programming
ODP
Introduction to Arduino
PPT
ARDUINO AND ITS PIN CONFIGURATION
PPTX
Lesson sample introduction to arduino
PPTX
Introduction to arduino ppt main
PPTX
Arduino
PPT
Intro to Arduino
PPTX
Introduction to Arduino
 
PDF
Arduino presentation
PDF
Arduino Workshop Day 2 - Advance Arduino & DIY
 
PPTX
Embedded c
PPTX
Introduction to Arduino
PDF
Verilog lab manual (ECAD and VLSI Lab)
PPTX
Arduino Functions
PDF
Ins and Outs of GPIO Programming
byICS
 
PPTX
Presentation on Flip Flop
PPTX
Arduino Introduction (Blinking LED) Presentation (workshop #5)
PPT
basic logic gates
Arduino course
PPT ON Arduino
Introduction to Arduino Hardware and Programming
Introduction to Arduino
ARDUINO AND ITS PIN CONFIGURATION
Lesson sample introduction to arduino
Introduction to arduino ppt main
Arduino
Intro to Arduino
Introduction to Arduino
 
Arduino presentation
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Embedded c
Introduction to Arduino
Verilog lab manual (ECAD and VLSI Lab)
Arduino Functions
Ins and Outs of GPIO Programming
byICS
 
Presentation on Flip Flop
Arduino Introduction (Blinking LED) Presentation (workshop #5)
basic logic gates

Similar to Arduino and c programming

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

Recently uploaded

PPTX
Presentation on Purdue model for control hierarchy
PDF
Basic Control system for oin and gas PART1.pdf
PPTX
firewall Selection in production life pptx
PPTX
Optimizing Plant Maintenance — Key Elements of a Successful Maintenance Plan ...
PPTX
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
PPTX
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
PPTX
Step-by-step guide to designing standard a microbiology laboratory in pharmac...
PPTX
The Complete Guide to Energy Audits_ Unlocking Savings, Sustainability, and P...
PPTX
How to Create an Effective Monthly Preventive Maintenance Plan
PDF
Handheld_Laser_Welding_Presentation 2.pdf
PPTX
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
PPTX
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
PPTX
Industrial Plant Safety – Comprehensive Guide for Workplace Safety & Risk Pre...
PPTX
MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx
PPTX
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
PPTX
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
PPTX
Vertical turbine pump explains installed in power plants
PPTX
Role of In Vitro and In Vivo Testing biomedical engineering
PDF
Hazim Gaber - A Lean Six Sigma Black Belt
PDF
Best Architecture in Kovilpatti - Amar Dexign Scape.pdf
Presentation on Purdue model for control hierarchy
Basic Control system for oin and gas PART1.pdf
firewall Selection in production life pptx
Optimizing Plant Maintenance — Key Elements of a Successful Maintenance Plan ...
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
Step-by-step guide to designing standard a microbiology laboratory in pharmac...
The Complete Guide to Energy Audits_ Unlocking Savings, Sustainability, and P...
How to Create an Effective Monthly Preventive Maintenance Plan
Handheld_Laser_Welding_Presentation 2.pdf
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
Industrial Plant Safety – Comprehensive Guide for Workplace Safety & Risk Pre...
MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
Vertical turbine pump explains installed in power plants
Role of In Vitro and In Vivo Testing biomedical engineering
Hazim Gaber - A Lean Six Sigma Black Belt
Best Architecture in Kovilpatti - Amar Dexign Scape.pdf

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