Arduino Basics and Prototyping Platform

lab 1 arduino basics lab 1 arduino basics n.w
1 / 15
Embed
Share

Explore the fundamentals of Arduino, an open-source prototyping platform, to connect sensors and actuators for various projects. Learn about programming environments, digital pins, analog input pins, and more.

  • Arduino Basics
  • Prototyping Platform
  • Sensors
  • Actuators
  • Programming Environment

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Lab 1: Arduino Basics Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit Date: Aug 26, 2016

  2. References ( References (s study these) tudy these) https://www.arduino.cc/en/Guide/Introduction https://www.arduino.cc/en/Tutorial/Foundations https://www.arduino.cc/en/Guide/BoardAnatomy https://www.arduino.cc/en/Tutorial/DigitalPins https://www.arduino.cc/en/Tutorial/AnalogInputPins https://www.arduino.cc/en/Tutorial/PWM https://www.arduino.cc/en/Tutorial/Memory https://www.arduino.cc/en/Reference/PinMode https://www.arduino.cc/en/Reference/DigitalWrite https://www.arduino.cc/en/Reference/DigitalRead https://www.arduino.cc/en/Reference/AnalogRead https://www.arduino.cc/en/Reference/AnalogWrite https://www.arduino.cc/en/ArduinoStarterKit/Prj02 2

  3. What is Arduino? What is Arduino? Open-source prototyping platform based on easy to use HW and SW. oInexpensive oCross-platform oSimple programming environment (IDE) oOpen-source SW and HW 3

  4. Making Stuffs using Arduino Making Stuffs using Arduino You can connect sensors and actuators, and program your Arduino to control them. Sensors (input) Actuators (output) 4

  5. Arduino Uno Anatomy Arduino Uno Anatomy http://arduinoarts.com/tag/anatomy/ 5

  6. Know Your Tools Know Your Tools (all images are from Google image search) 6

  7. Program Structure Program Structure setup() executed once at the beginning. loop() it s an infinite loop. 7

  8. Arduino Language Reference Arduino Language Reference Almost the same as C with some new things: setup() and loop() Constants: HIGH, LOW, INPUT, OUTPUT PROGMEM, EEPROM Digital/Analog input/output functions Library methods for character, bits, interrupts, and communication. https://www.arduino.cc/en/Reference/HomePage 8

  9. Digital Read and Write Digital Read and Write Digital IO: HIGH or LOW int ledPin = 13; // LED connected to digital pin 13 int inPin = 7; // pushbutton connected to digital pin 7 int val = 0; // variable to store the read value voidsetup() { pinMode(inPin, INPUT); // sets digital pin 7 as input pinMode(ledPin, OUTPUT); // sets digital pin 13 as output } voidloop() { val = digitalRead(inPin); // read the input pin (button) digitalWrite(ledPin, val); // sets the LED to the value } 9

  10. Analog Read Analog Read Arduino UNO has a 10-bit analog-to-digital converter, so input voltage mapped to [0, 1023] int analogPin = 3; // potentiometer middle terminal connected to analog pin 3 outside leads to ground and +5V int val = 0; // variable to store the value read voidsetup() { Serial.begin(9600); // setup serial } voidloop() { val = analogRead(analogPin); // read the input pin Serial.println(val); // debug value } 10

  11. Analog Write (PWM) Analog Write (PWM) Getting analog results with digital means. Must be [0, 255], and it will mean duty cycle . pinMode(9, OUTPUT); int X = 123; analogWrite(9, X); 11

  12. Memory Memory TYPE SIZE (UNO) USE Volatile? Flash 32K Program space No SRAM 2K Variables Yes EEPROM 1K Long term information No Optimizing SRAM use: Use a connected smartphone/computer to move data out for calculation. Use smaller data types (byteif you don t need an int.) Use Flash memory (PROGMEM keyword) Use EEPROM (use EEPROM library) 12

  13. Variety of Arduino Boards Variety of Arduino Boards 13

  14. Expanding Arduino with Shields Expanding Arduino with Shields Arduino + GPS Shield Arduino + Joy Stick Shield Arduino + Xbee Shield 14

  15. Lab Work: Spaceship Interface Lab Work: Spaceship Interface It s project #2 of Arduino Projects Book. https://www.arduino.cc/en/ArduinoStarterKit/Prj02 Once you are done, please take an extra 5 minutes to put all electronic elements back into the box. 15

More Related Content