Prototyping with Microcontrollers and Sensors. Overview Objective Background Information Problem Statement Materials Procedure Assignment Closing.

Slides:



Advertisements
Similar presentations
Lab7: Introduction to Arduino
Advertisements

CSC 405 Lab 1 - Building a Simple Combinatorial Circuit In this laboratory exercise you will learn about the layout of some small-scale integrated circuits.
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
1 Boe-Bot Parts BOE-BOT Lecture #1b DE - Digital Electronics.
Living with the Lab Using Your Arduino, Breadboard and Multimeter EAS 199A Fall 2011 Work in teams of two!
Dr. Andreas Kunz © 10/2004 inspire icvr BASICS OF ELECTRONICS.
Arduino. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source.
Introduction.
Embedded Programming and Robotics Lesson 1 Basic Electricity and Electronics Transistor Basics Lesson 1 -- Basic Electricity1.
Using Your Arduino, Breadboard and Multimeter Work in teams of two! living with the lab 1 © 2012 David Hall.
Electronic Components
Embedded Programming and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Ch4 Electronic Components Circuit/Schematic Symbols.
Objectives How Microcontroller works
Agenda Introduction to circuits Building a simple circuit
Electronic Components. Battery A portable power source that has a positive and negative. Electronics works on Direct Current (DC) where electrons flow.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Overview What is Arduino? What is it used for? How to get started Demonstration Questions are welcome at any time.
Analog to Digital Converter David Wallace English 314.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Microcontroller Hands-on Workshop #2 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers October 31, 2009.
Basic Equipment and Schematic Reading. Objectives Learn the basic equipment that will be used in the Lab. Learn some of the basic symbols used on electrical.
18240 Element two - Components INPUTS OUTPUTS PURPOSE TYPICAL USE.
Electricity and Electronics Base of Modern Technology.
Microcontroller basics Embedded systems for mortals.
Electronics for Physical Computing Materials: capacitor, diode, LED, transistor, switch,resistor, relay, proto board, multimeter.
Introduction to Electronic Circuits Khansaa Almansor.
6.2 ELECTRONICS. CAPACITOR An electrical device used to store electrical charge.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Introducing the Arduino Uno Presented by Dave Mawdsley, DACS Member, Linux SIG Member (wiring, programming and running a cute traffic light simulation)
Logic Gates Unit 16.
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
Arduino Part 1 Topics: Microcontrollers
Prototyping with Microcontrollers and Sensors
Microcontroller basics
Electronics Part 4 Electrical Components
Microprocessors Tutorial 1: Arduino Basics
UTA010 : Engineering Design – II
Welcome to Arduino A Microcontroller.
Arduino Development for Beginners
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
Introduction to Arduino Microcontrollers
Unit 3 – Fundamentals of Electronics Examination Specifications
Introduction to Arduino Microcontrollers
Unit 3 – Fundamentals of Electronics Examination Specifications
How to avoid catching things on fire.
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Instructor Resources.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Introducing the Arduino Uno
Digital Electronics Lab 2 Instructor:
Programming Micro Controllers
Basic Electronics Part Two: Electronic Components.
Basic circuits Electrical circuits Electrical properties Ohm’s law
Arduino Part 4 Let there be more light.
Prototyping with Micro-controllers, Sensors, and Materials
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Prototyping with Micro-controllers, Sensors, and Materials
Aeroponic Engineering and Vertical Farming
Introduction to Electronics
Lab #1: Getting Started.
Prototyping with Micro-controllers, Sensors, and Materials
Intro to Arduino Part 2 The Breadboard
Prototyping with Micro-controllers, Sensors, and Materials
Introduction to arduino
Presentation transcript:

Prototyping with Microcontrollers and Sensors

Overview Objective Background Information Problem Statement Materials Procedure Assignment Closing

Objective Demonstrate basic principles of electricity, breadboarding, and Arduino programming

Background Information Electricity  Movement of electrons Electrical voltage: difference in charge  Measured in Volts (V) Electrical current: movement of electrons in a conductive wire when there is a difference in charge between two points in the wire.  Measured in Amperes (A)  Flows opposite of the electrons Electrical resistance: certain materials resist a flow of electrons  Measured in Ohms (Ω)

Ohm’s Law V = I * R  Mathematical relationship between current, voltage and resistance  Only when you have a resistor!

Electronic Components DC (Direct Current) Voltage Sources  Power circuits because they have a voltage difference across their terminals  Usually batteries (AA, AAA, etc.)  Polarized

Electronic Components Resistors: components that reduce the amount of current flowing through a circuit  Convert the excess current to thermal energy  Can be used to control voltages and currents  Color-coded with their resistance  Not polarized

Electronic Components Capacitors: store energy in an electrical field and then dissipate it at a later time  Capacitance: measure of how much charge a capacitor can store  Measured in Farads (F)  Resist voltage changes by supplying or drawing current  Sometimes polarized!

Electronic Components Inductors: store energy in a magnetic field and then dissipate it at a later time  Inductance: measure of how much energy an inductor can store  Measured in Henries (H)  Resist current changes by dropping or increasing the voltage across itself  Not polarized

Electronic Components Push Buttons and Switches: mechanical devices that interrupt or divert current running through them  Basic push buttons are polarized  Basic switches are not polarized

Electronic Components Diodes and Transistors (BJT/MOSFETS)  Diodes are components that allow current to only pass in one direction  MOSFETs are electrical components that act as electrically controlled switches

Electronic Components Light Emitting Diodes (LEDs): small electric lights which can be lit very brightly with fairly low voltages and currents  Diode! Orientation matters!  Usually require a resistor (typically 220 Ω or 470 Ω)  Polarized!

Electronic Components IC (Integrated Circuit) Chips: contain small electrical circuits inside them to usually carry out one specific purpose  Come in all shapes, sizes, and specifications  Comparators (they compare two different voltages)  Op-Amps (they amplify low voltage signals)  Timers (they switch between high and low voltages quickly to time other devices)  IC chips ARE polarized

Electronic Components Analog vs. Digital Signals  An electrical signal is any quantifiable quantity that can carry information using electricity Digital Signals Analog Signals  Have two discrete states: LOW and HIGH  When signal is LOW, most devices output a voltage level of 0V.  When signal is HIGH, most devices output a voltage level of 5V (or 3.3V)  Infinite amount of voltage values  The range 0V-5V is mapped to the range  Example: Value 255 = ~1.246V  Many electronic components are inherently analog

Microcontrollers Microcontrollers: cheap, programmable computers without any of the peripherals (such as a mouse, keyboard, or a screen)  Have direct access to the input and output pins  Reads from sensors and perform actions accordingly.  Are present in many electrical appliances (such as microwaves)

We will be using an Arduino UNO board created by Sparkfun for this lab

Arduino Hardware Overview of the RedBoard  Reset Button: restarts the Board  USB Connector: will provide power and connect it to the computer  Pin 13 LED: an LED you can use without making an LED circuit  Serial LEDS: shows if the Arduino is transmitting or receiving data from pins 0, 1 or the USB connection

Power Pins  3.3V: Usually used to power low- voltage sensors  5V: Most common power pin used to power your circuits  GND: Ground pin which is 0V  VIN: Voltage-In can be used to power the  board using a battery

I/O Pins  A0-A5: identical analog pins that can be used to read sensors or control analog devices  Pins A0-A3 are more stable than A4-A5  Pins 0-1: transmit and receive pins, don’t use these pins for this lab  Pins 2-12: digital pins that can be switched between HIGH states and LOW states  Pin 13: connected to the on-board LED

Building Circuits on a Breadboard Breadboards: are small boards that are commonly used for circuit prototyping

Arduino Programming The Arduino programming language is based on C/C++, but it is designed to be simpler and easier to learn. The most intuitive way to think about programming is like building with LEGO blocks: you are given certain rules you have to follow and different building blocks to use.

The Arduino IDE  Verify: checks your code for errors and points to where the errors occurred  Upload: verifies and sends your code to the Arduino board if there are no errors  Console: shows you any errors the software found in your hardware  Serial Monitor: a tool you can use to see how your program is running

The Arduino IDE Programs written in Arduino are called sketches with 3 different areas:  Global: Important variables, constants and imported libraries go here  Setup: activate the pins and sensors used (this code only runs once)  Loop: the code that runs continuously (reading sensors and turning pins HIGH or LOW)

The Rules and Building Blocks General  Every line must either end with a semicolon ‘;’ UNLESS it’s a conditional, loop, function or imported library  Comments start with a //  Comments are text that the program ignores  Used to label and explain code

Constants and Variables  Variables store different types of data (numbers, letters, sentences, etc.)  Variables change what data they hold through mathematical operations  Constants cannot change their value after it has been assigned

Datatypes

Operators

Common Functions

Materials and Equipment  Arduino UNO microcontroller and USB cable  Computer with Arduino IDE  Breadboard and jumper wire  Resistors  LED  Pushbutton  TMP36

Activity 1 We will be making a simple LED blinking circuit. 1.The first activity will be making a simple LED blinking circuit. The programming flowchart and circuit diagram are in the figure.

Activity 1 2.First, wire the LED to the breadboard like in the figure. Remember, since LEDs are polarized, their orientation matters. The shorter leg of the LED should be connected to the same row as GND. The resistor is NECESSARY, otherwise too much current would flow and the LED will burn out! REMEMBER: The orientation of the LED matters!

Flowcharts

Activity 1 3.Now type the following code into a new sketch. 4.The flowchart uses Digital Pin 7 on the Arduino as an output. Therefore, create a constant that holds the number 7 and in the setup area set Pin 7 as an output using pinMode. Then, turn the LED on by using digitalWrite, have a delay of one second, turn the LED off by using digitalWrite and then set another delay of one second. 5.The LED circuit will be used in the next two activities. Do not deconstruct it.

Activity 2 1.Activity 2 adds a button to the circuit from activity 1 and requires conditionals (think if-statement). The LED should be on when the button is pressed and off when the button isn’t pressed. 2.Before you breadboard the circuit look at the bottom side (pin side) of the button to examine which pins are connected. There is a line connecting the pins that are wired together internally on each side. See the schematic below, pins 1 and 2 are connected, and pins 3 and 4 are connected. 3.First, breadboard the circuit diagram in the figure and sketch a flowchart of the program needed. Have a TA verify the flowchart.

Activity 2 4.Write the Arduino program to implement the flowchart. 5.Remember to create a constant that holds the pin number to which the button is connected and that the button will be a digital input. After the button constant, create an integer that will hold the button state: 6.Within the loop function, you must check the state of the button (whether it is pressed or not pressed), using the following code:

Activity 3 1.Activity 3 introduces a loop into the program so the LED flashes three times. Make sure to sketch a flowchart and have a TA verify it. 2.Hint: Use a For-loop! The circuit does not need any modifications.

Product Evaluation

Activity 4 1.For Activity 4 the Arduino will read analog values from a temperature sensor and print out the temperature to the Serial Monitor. Carefully disconnect everything plugged into the breadboard and Arduino. Then, breadboard the circuit in Figure 6.

Activity 4 2.The TMP36 is an IC temperature sensor. The specifications of most IC chips can be found online. Below is a picture of the pinout and the specifications of the TMP36. The sensor requires a positive voltage (Vs), a ground connection (GND), and an analog input connection (Vout) to read the temperature data. Use the +5 V pin from the Arduino board as your positive voltage connection. 3.The output voltage can easily be converted to a temperature reading (in Celsius) by using a scale factor of 10 mV/°C. The Arduino should read the sensor every five seconds. Sketch a flowchart and have it verified by a TA before writing the program. Don’t forget to use an analog pin (Pin A0), convert the voltage reading and then print it out!

Activity 4 4.Take 5 measurements of the room using the temperature sensor with one minute intervals. Use this data for the accuracy and precision measurements of your temperature sensor. TAs will provide the actual room temperature. Use the following temperature sensor specifications.

Activity 4 Converting the temperature from “Arduino Units” to Celsius: 1.Convert “Arduino Units” to a voltage value is mapped from 0V to 5V 2.How much voltage is each “Arduino Unit” 2.Offset the voltage value by 500mV 3.Convert offset voltage to Celsius (10mV/1°C)

Activity 5 Brainstorming! (Your SLDP)

Assignment Lab Report Team Presentation Discuss ALL topics in this presentation and manual Include Pictures!